Jump to content
Sign in to follow this  
Ex-RoNiN

Custom action menu thingys

Recommended Posts

You know, the little thingy in the box to the bottom right. How do I implement one of those? How do I name them? How do I specify what they are supposed to do?

Share this post


Link to post
Share on other sites

AddAction

(im not near my OFP installation nor the reference manual, so out of my memory)

this AddAction ["Custom word", exec "domystuff.sqs"]

I think it is,

Share this post


Link to post
Share on other sites
Guest

Almost, but no exec.

unit addAction ["Descriptive Text", "script.sqs"]

Share this post


Link to post
Share on other sites

And no, you can not pass in any parameters that I know of. You can however access some variables like who called the action, what the action is attached to, and the index of the action in the called script by using

x= _this select 0;

y= _this select 1;

z= _this select 2;

That's how I remember it.

confused.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (bn880 @ Feb. 12 2003,20:13)</td></tr><tr><td id="QUOTE">And no, you can not pass in any parameters that I know of.  You can however access some variables like who called the action, what the action is attached to, and the index of the action in the called script by using

x= _this select 0;

y= _this select 1;

z= _this select 2;

That's how I remember it.

confused.gif<span id='postcolor'>

Bingo. Except for that the first parameter is the object the action is attached to and the second one is the unit calling the action.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Spitfire @ Feb. 12 2003,21:23)</td></tr><tr><td id="QUOTE">Bingo. Except for that the first parameter is the object the action is attached to and the second one is the unit calling the action.<span id='postcolor'>

ah!

this was very informative.

object,unit,actionindex

is action index, the same as ActionID?

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (The_Taurus @ Feb. 12 2003,22:29)</td></tr><tr><td id="QUOTE">is action index, the same as ActionID?<span id='postcolor'>

Yes, the one you use to remove the action.

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

EDIT: Using the action index parameter makes it possible to remove the action from the action script itself. However, if you wish to remove the action from the same script that you created it in (without using a global variable to save the action index) you can use this:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_myActionIndex = unitName addAction ["My Action","action.sqs"]<span id='postcolor'>

Then you can remove the created action from the same script by using that _myActionIndex in removeAction.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Spitfire @ Feb. 12 2003,21:23)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (bn880 @ Feb. 12 2003,20:13)</td></tr><tr><td id="QUOTE">And no, you can not pass in any parameters that I know of.  You can however access some variables like who called the action, what the action is attached to, and the index of the action in the called script by using

x= _this select 0;

y= _this select 1;

z= _this select 2;

That's how I remember it.

confused.gif<span id='postcolor'>

Bingo. Except for that the first parameter is the object the action is attached to and the second one is the unit calling the action.<span id='postcolor'>

That's great information, *bows* thanks to you guys smile.gif

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  

×