Jump to content
Sign in to follow this  
quantum69

Proper usage of addeventhandler

Recommended Posts

?(!searchresults):ask big boys

addEventHandler is not explained very well in any docs I've read.  Search for it gives 0 results.  In using the BAS addon it says to use a line including this command, ok, it works, but what is the exact nature of this new command?

The syntax is given in the comref, but can anyone elaborate clearly what the parameters are and especially how the second parameter can be used?

The first parameter in the comref shows an action (type) that occurs and the second parameter is what to do when it happens.  Ok, that's simple enough (if anyone knows where to find a complete list of actions old and new I would appreciate a link/list).  The line from BAS says to put it in the init.sqs, done, it performs as expected.  The question arose because in the init.sqs it's listed as

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

this addEventHandler ["GetIn", {_this select 2 animate ["Goggles", 1]}]

<span id='postcolor'>

Q1) if it's listed as "this" in init.sqs, is it refering to the whole map?  So if ANY unit performs the "GETIN" action this would run?

Q2) the second param, {_this select 2 ....  , I presume that _this is set equal to the object performing the action, but why the "select 2" then?  What parameters does an object contain?

Q3) anyone have solid, clear answers to these questions and suppositions that would make understanding this apparently cool function less of a headache?

Any help from the gallery is appreciated.

Thanks

Quantum69

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  

×