Jump to content
Sign in to follow this  
Chaos

Eventhandlers and ArmA

Recommended Posts

I have big problems with Eventhandlers in OFP. They are´nt flexible enough - the same problem we can find in "addaction" command. We can´t set more than the "_this" parameters. But when you will made a script for mass execution with different parameters for ever group or unit you must have this possiblity. I can´t set thousands of global arrays and fill then with millions of global variables for even unit on the map. Maybe someone don´t understand my issue but only what we need is to comparte the following:

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

[parameter1,parameter2,parameter3,parameter4 etc.] exec "script.sqs"

Eventhandler:

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

unit addEventHandler ["hit",{_this exec "script.sqs"}]

but so you can´t use it with more options for dozents of groups!

Example for better result:

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

unit addEventHandler ["killed",{[option1,option2,option3,option4 etc.] exec "script.sqs"}]

or

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

[unit,option1,option2] addAction [action1,"script.sqs"]

But you can´t set more than one parameter... confused_o.gif

I hope BIS can fix this problem in ArmA. whistle.gif

Share this post


Link to post
Share on other sites

When they released the wiki a few months ago I've noticed that the addaction command was improved. Arguments were these:

Quote[/b] ][action, script,(arguments,priority, showWindow, hideOnUse, shortcut)]

There were no examples or explanations but some of them are obvious, no?

The info is removed from the wiki, but I'm 100% sure the parameters for addaction were improved a lot.

Share this post


Link to post
Share on other sites
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

unit addEventHandler ["killed",{[option1,option2,option3,option4 etc.] exec "script.sqs"}]

Actually, this works. You can use the space inside the {} brackets just like you can an init field. And if you want the eventhandler parameters along with your new ones, you can do this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">unit addeventhandler ["killed",{[_this,option1,option2] exec "script.sqs"}]

Then in the script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_guy = (_this select 0) select 0

_killer = (_this select 0) select 1

_option1 = _this select 1

_option2 = _this select 2

I just tried this too so I know it works.

Share this post


Link to post
Share on other sites

I think it would be more prudent to discuss the scripting commands when ArmA is available and you can see for yourselves what is or isn't possible.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×