Jump to content
Sign in to follow this  
lucilk

apostrophes and and a format

Recommended Posts

ok i got another one, i want to add a action to the player inside a trigger

so:

//this "i" i will need it later
i=1;

//now the trigger
_brig = createTrigger ["EmptyDetector", getpos _civvehicle]; 
_btrig setTriggerArea [100, 100, 0, false];
_btrig setTriggerActivation ["WEST", "present", false];

//now the part with the problem

[b][php]_btrig setTriggerStatements ["this", "pac1 = player addAction [""Stop Vehicle """"format [""""%1"""",i]"""" for inspection"", ""civc\stop.sqf"",[], 0, true, true, """", """"]; i=i+1", ""];[/php]

[/b]

the ideea was that Stop Vehicle for inspection should be:

Stop Vehicle [b][color=Red]1[/color][/b] for inspection

Stop vehicle [b][color=red]2[/color][/b] for inspection

Stop Vehicle [b][color=red]3[/color][/b] for inspection

.....etc

any ideeas

Thanks

Edited by lucilk

Share this post


Link to post
Share on other sites

its not that is necessary, is that i know it can be done and i might need it later, this is how i learned to do everything, just trying to do stuff and eventualy remember something form another script and use it for my needs, i was just curios how its made, beacuse i learn a script command every day and now i bumped in to "format" command and i dont know how to use it

Share this post


Link to post
Share on other sites

Try:

_str = format["Stop Vehicle %1 for inspection", i];
_btrig setTriggerStatements ["this", "pac1 = player addAction [_str, ""civc\stop.sqf"",[], 0, true, true, """", """"]; i=i+1", ""];  

Easier to manage it via another variable than trying to put in 8 sets of quotes.

Share this post


Link to post
Share on other sites

Use single quote marks inside of the double quotes. It's kinda ridiculous having four double quotation marks in a row, it will be impossible to debug a beast such as that.

Share this post


Link to post
Share on other sites

Yeah, for example in the post from beita above it would be:

"pac1 = player addAction [_str, 'civc\stop.sqf',[], 0, true, true, '', '']; i=i+1"

'' inside " is two '

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
Sign in to follow this  

×