Jump to content

Recommended Posts

Hi

I'm trying to set a web link to one the debfriefings config values but can't figure the proper way to it.

 

This is what I have tried:

 

description = __EVAL("<a href='http://arma3.com'>Link to arma site</a>"); \

But I get error:

 

"Some input after the EOF"

 

If I remove that line it works.

 

Anyone knows the right syntax?

 

thx!

 

Edit: I need to use __EVAL because I'm actually putting some variables together

Share this post


Link to post
Share on other sites

What eval is supposed to do? Evaluate string which is one of the primitive types you can use directly in configs? Makes no sense

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, killzone_kid said:

What eval is supposed to do?

 

I'm adding strings together for the description

Share this post


Link to post
Share on other sites

It's not the eval that fails but this also fails:

 

description = "<a href='http://arma3.com'>Link to arma site</a>";

 

With simple text works, with that not

Share this post


Link to post
Share on other sites
11 minutes ago, gc8 said:

It's not the eval that fails but this also fails:

 


description = "<a href='http://arma3.com'>Link to arma site</a>";

 

With simple text works, with that not

// is treated as a comment
I had to do some thing like that to get it working with preprocessor

#define URL_MACRO(slash)     url = "http:##slash####slash##armacenter.pl"
#define PSZ_CREDITS         author = $STR_PSZ_MOD_TEAM; URL_MACRO(/); dlc = "PSZ_PolishArmedForces"

 

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

@reyhard thanks I tried that but now the link opens to blank web page.

 

Here's all my code I'm working with, I think the problem is in how macros are processed:

 

#define MISSINGMOD(modname,sl) \
    class MissingMod##modname { \
        title = "Missing mod"; \
        description = "<a href='https:##sl####sl##steamcommunity.com/workshop/filedetails/?id=843770737'>Example URL B</a>"; \
        pictureBackground = ""; \
        picture = "\a3\ui_f\data\igui\cfg\simpletasks\types\intel_ca.paa"; \
        pictureColor[] = {1.0,1.0,1.0,1}; \
    };



class CfgDebriefing
{  
    class MissingMod
    {
        title = "Missing mod";
        //subtitle = "";
        //description = "You are missing required mod to play on this server";
        

       // THIS WORKS!
        description = "You are missing <a href='https://steamcommunity.com/workshop/filedetails/?id=843770737'>Example URL B</a>";
        
        pictureBackground = "";
        picture = "\a3\ui_f\data\igui\cfg\simpletasks\types\intel_ca.paa";
        pictureColor[] = {0.0,0.3,0.6,1};

    };
    

 // THIS DOES NOT WORK!
 MISSINGMOD(TEST,/)
};

 

Like you can see I'm trying to add some debriefs with the help of macros

Share this post


Link to post
Share on other sites

Hey I got it working! 😄

 

This worked for me:

#define MISSINGMOD(modname,sl) \
	class MissingMod##modname { \
		title = "Missing mod"; \
		description = __EVAL("<a href='https:" + #sl + #sl + "steamcommunity.com/workshop/filedetails/?id=843770737'>Example URL TEST!</a>"); \
		pictureBackground = ""; \
		picture = "\a3\ui_f\data\igui\cfg\simpletasks\types\intel_ca.paa"; \
		pictureColor[] = {1.0,1.0,1.0,1}; \
	};

 

weird looking code but it works

Share this post


Link to post
Share on other sites

there is no need for #define trickery, you can escape " with "

description = "<a href=""http://arma3.com"">Link to arma site</a>";

Should work just fine

// inside double quoted "string" is ignored

 

  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, killzone_kid said:

there is no need for #define trickery, you can escape " with "

 

I tried all kinds of quotation marks "" and ' but didn't get it to work. But it could be just me

Share this post


Link to post
Share on other sites

What can I say, even 

description = __EVAL("<a href=""http://arma3.com"">Link to arma site</a>");

works

Share this post


Link to post
Share on other sites
13 hours ago, killzone_kid said:

What can I say, even 


description = __EVAL("<a href=""http://arma3.com"">Link to arma site</a>");

works

 

Have you tried it with defines? I think I got it working too without defines but inside my MISSINGMOD define I had to deal with the slashes

Share this post


Link to post
Share on other sites
On 3/10/2019 at 5:28 PM, reyhard said:

// is treated as a comment
I had to do some thing like that to get it working with preprocessor 

Preprocessor doesn't process things inside double quoted strings. That should include slashes.

 

 

Why are you trying to play around with __EVAL? That's just making it harder than it needs to be.

 

#define QUOTE(x) #x
#define HTTPS_QUOTE(x) https:/x
#define MISSINGMOD(modname,modid) \
	class MissingMod##modname { \
		title = "Missing mod"; \
		description = '<a href=HTTPS_QUOTE(/steamcommunity.com/workshop/filedetails/?id=modid)>Example URL TEST!</a>'); \
		pictureBackground = ""; \
		picture = "\a3\ui_f\data\igui\cfg\simpletasks\types\intel_ca.paa"; \
		pictureColor[] = {1.0,1.0,1.0,1}; \
	};

 

Share this post


Link to post
Share on other sites
16 minutes ago, Dedmen said:

Preprocessor doesn't process things inside double quoted strings. That should include slashes.

Have you tried it actually? What you have wrote is not working with neither Bohemia cfgConvert nor with game parser (diag_mergeConfigFile or just using file patching). Perhaps pboproject is a little bit different there

Share this post


Link to post
Share on other sites
15 minutes ago, Dedmen said:

Want to modify the link too?

 

Yes that was the original reason I started playing with eval. but it's working now (with eval)

Share this post


Link to post
Share on other sites
20 minutes ago, reyhard said:

Have you tried it actually?

I have written my own preprocessor in the past. I know how the Arma preproc works. So yes. I know that everything inside double quotes is ignored, but stuff inside single quotes is processed.

And KK also confirmed that

On 3/10/2019 at 8:22 PM, killzone_kid said:

// inside double quoted "string" is ignored

 

 

21 minutes ago, reyhard said:

What have you wrote is not working with neither Bohemia cfgConvert nor with game parser (diag_mergeConfigFile or just using file patching). Perhaps pboproject is a little bit different there

I have tried that in a custom preprocessor (SQF-VM)

I just ran it through CfgConvert.

 

Had to remove the single quotes because CfgConvert for some reason puts another pair of doublequotes around it, even though the text is already quoted. And I forgot the QUOTE part of HTTPS_QUOTE in my last post. Fixed it here.
Input

#define QUOTE(x) #x
#define HTTPS_QUOTE(x) QUOTE(https:/x)
#define MISSINGMOD(modname,modid) \
	class MissingMod##modname { \
		title = "Missing mod"; \
		description = <a href=HTTPS_QUOTE(/steamcommunity.com/workshop/filedetails/?id=modid)>Example URL TEST!</a>; \
		pictureBackground = ""; \
		picture = "\a3\ui_f\data\igui\cfg\simpletasks\types\intel_ca.paa"; \
		pictureColor[] = {1.0,1.0,1.0,1}; \
	};
    
MISSINGMOD(nametest,12345);

Command

CfgConvert.exe -txt -dst dest.cpp config.cpp

Output

class MissingModnametest
{
	title="Missing mod";
	description="<a href=""https://steamcommunity.com/workshop/filedetails/?id=12345"">Example URL TEST!</a>";
	pictureBackground="";
	picture="\a3\ui_f\data\igui\cfg\simpletasks\types\intel_ca.paa";
	pictureColor[]={1,1,1,1};
};

 

Looks good to me.

 

 

This also works fine if you want to specify the full URL. Just need to split the two // apart by using a macro for half of it.

 

#define QUOTE(x) #x
#define HTTPS https:/
#define MISSINGMOD(modname,url,urltext) \
	class MissingMod##modname { \
		title = "Missing mod"; \
		description = <a href=QUOTE(url)>urltext</a>; \
		pictureBackground = ""; \
		picture = "\a3\ui_f\data\igui\cfg\simpletasks\types\intel_ca.paa"; \
		pictureColor[] = {1.0,1.0,1.0,1}; \
	};
    
MISSINGMOD(nametest,HTTPS/steamcommunity.com/workshop/filedetails/?id=123,Hello World);

 

Share this post


Link to post
Share on other sites
#define HTTPS_QUOTE(x) QUOTE(https:/x)

So I guess you've agreed about // being recognized as a comment 😉

Share this post


Link to post
Share on other sites
7 minutes ago, reyhard said:

So I guess you've agreed about // being recognized as a comment

No. You said // is recognized as a comment in here:

description = "<a href='http://arma3.com'>Link to arma site</a>";

Which is not the case. Because preproc ignores everything in double quoted string as I've said.

That snippet also runs through CfgConvert cleanly without problems. Nothing being recognized as a comment there.

Also tried the same in a C++ preprocessor. Same result.

 

 

I have to use that macro because we cannot use double quoted strings. As we want the preprocessor to actually process on that, and not just ignore it.

Share this post


Link to post
Share on other sites
13:20:37 ErrorMessage: File a3\test\config.cpp, line 10: Config: End of line encountered after <a href='http:
13:20:37 Application terminated intentionally
ErrorMessage: File a3\test\config.cpp, line 10: Config: End of line encountered after <a href='http:
#define TEST description = "<a href='http:// arma3.com'>Link to arma site</a>";
TEST

Well, it's not working

 

We were speaking about define and macros (\ in initial post suggested that) from the beginning so I guess you have missed this and assumed that I'm talking about

description = "<a href='http://arma3.com'>Link to arma site</a>";

in core config, not in macro, which wasn't the case.

Share this post


Link to post
Share on other sites

As I mentioned // is ignored in double quoted string, but macros are different. You can however pass your double quoted string to macro as an argument:

 

#define MISSINGMOD(MODNAME,URL,URLTEXT) \
	class MissingMod##MODNAME { \
		title = "Missing mod"; \
		description = __EVAL(format["<a href=%1>%2</a>", str URL, URLTEXT]); \
		pictureBackground = ""; \
		picture = "\a3\ui_f\data\igui\cfg\simpletasks\types\intel_ca.paa"; \
		pictureColor[] = {1.0,1.0,1.0,1}; \
	}
    
MISSINGMOD(test,"http://steamcommunity.com/workshop/filedetails/?id=123","Hello, World");

Works fine. Note how you can pass coma inside the URL text which you can't do if you don't pass url text as a string
EDIT: Aaaaand of course Arma being Arma, the preprocessor eats the comma. Pretty sure it is yet another bug. Well at least it doesn't cut off the string at the comma.

  • Like 3

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×