Jump to content
Sign in to follow this  
AngusHeaf

Addaction and variables

Recommended Posts

I'm interested in passing some variables to a script being called by an item that has been added to the action menu. Essentially I just want to play the following in the scripting...

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

[variable] exec "script.sqs"

<span id='postcolor'>

However, the following code that I thought would work hasn't and I'm wondering if perhaps it is not possible to do...

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

player addaction ["action label",{[variable] exec "script.sqs"}];

<span id='postcolor'>

Strangely enough, it passes through the editor without throwing any errors, which originally made me believe it would work. However, when I clicked the action it told me it couldn't find the script named inside the curly braces. Like it thought the scriptname was actually that whole exec string. Goofy. Any idea if this is possible and I'm just using the wrong syntax?

Share this post


Link to post
Share on other sites

I think it's not possible by your way. Command reference shows only : player addAction ["Hello", "hello.sqs"]

And after executing addAction script there are always 3 parameters :

_this select 0 : name of unit with action

_this select 1 : name of unit that activated action

_this select 2 : index of action

If you want use some variable with script you must use public variable and use it in script.

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  

×