Jump to content
Sign in to follow this  
Nielsen

Problem with using format in setTriggerStatements.

Recommended Posts

As the headline states, I am having a problem using format when setting trigger statements in a script.

What I am really trying to do is to transfer a local variable to a trigger.

IEDtrigger setTriggerStatements ["this",format["%1 action [""TOUCHOFF"",%1]",_ai],""];

_ai is defined and private above.

I get a script-error telling me that I'm missing a ; but I cant figure out where.

Any help would be greatly appreciated.

Thanks

Share this post


Link to post
Share on other sites

And _ai contains an object/unit without a name (set in editor or setvehiclevarname)?

In that case the trigger will look something like:

C 1-1-A 1 action...

Which will break the trigger, it doesn't understand your reference to the object. So, name the unit first.

Share this post


Link to post
Share on other sites

Aha. That was exactly it. It returned C 1-1-A 1 as the unit name, but I did'nt realize that the trigger would'nt accept that as legal input. Should have given more information about my problem - well spotted.

Thanks for the help!

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  

×