Jump to content
Sign in to follow this  
ArMaTeC

BIKIBIS fnc addStackedEventHandler

Recommended Posts

description updated, irrelevant notes removed

← Older revision Revision as of 10:57, 15 July 2017
Line 7: Line 7:
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
   
| Stack an event handler. Possible event handlers are:
+
| Stacks an event handler. All event handlers accept user arguments, which are passed to the EH code in <tt>_this</tt> variable. If the EH has own params returned in <tt>_this</tt> variable as well, use arguments are appended to the end of <tt>_this</tt> array.
* "[[onEachFrame]]"
+
<br><br>
* "[[onPlayerConnected]]"
+
<u>Supported event handlers</u>
* "[[onPlayerDisconnected]]"
+
<br><br>
* "[[onMapSingleClick]]"
+
* <tt>"[[onEachFrame]]"</tt> - no EH params
* "[[onPreloadStarted]]"
+
* <tt>"[[onPlayerConnected]]"</tt> - EH params are passed as array in <tt>_this</tt> (<tt>[<id>,<uid>,<name>,<jip>,<owner>]</tt>) and in special variables <tt>_id</tt>, <tt>_uid</tt>, <tt>_name</tt>, <tt>_jip</tt>, <tt>_owner</tt>
* "[[onPreloadFinished]]" |= Description
+
* <tt>"[[onPlayerDisconnected]]"</tt> - EH params are passed as array in <tt>_this</tt> (<tt>[<id>,<uid>,<name>,<jip>,<owner>]</tt>) and in special variables <tt>_id</tt>, <tt>_uid</tt>, <tt>_name</tt>, <tt>_jip</tt>, <tt>_owner</tt>
  +
* <tt>"[[onMapSingleClick]]"</tt> - EH params are passed as array in <tt>_this</tt> (<tt>[<id>,<uid>,<name>,<jip>,<owner>]</tt>) and in special variables <tt>_id</tt>, <tt>_uid</tt>, <tt>_name</tt>, <tt>_jip</tt>, <tt>_owner</tt>
  +
* <tt>"[[onPreloadStarted]]"</tt> - no EH params
  +
* <tt>"[[onPreloadFinished]]"</tt> - no EH params|= Description
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
   
| [key, event, code, arguments] call [[BIS_fnc_addStackedEventHandler]]; |= Syntax
+
| [id, event, code, arguments] call [[BIS_fnc_addStackedEventHandler]]; |= Syntax
   
|p1= key: [[String]] - unique identifier|= Parameter 1
+
|p1= id: [[String]] - custom id, a unique identifier. Adding same type of EH with the same id will overwrite existing|= Parameter 1
   
|p2= event: [[String]] - event handler type, see Description|= Parameter 2
+
|p2= event: [[String]] - event handler name, see description for supported EHs|= Parameter 2
   
|p3= code: [[String]] or [[Code]] |= Parameter 3
+
|p3= code: [[Code]] or [[String]]. The [[String]] is treated as function name |= Parameter 3
   
|p4= arguments: [[Anything]] - arguments to make available in code|= Parameter 4
+
|p4= arguments: [[Array]] of [[Anything]] - arguments to make available in code in <tt>_this</tt> array|= Parameter 4
   
 
| [[String]] |= Return value
 
| [[String]] |= Return value
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
 
   
 
   
|x1= <code>["someId", "onEachFrame", {
+
|x1= <code>["someId", "onEachFrame", {[[hintSilent]] [[str]] [[time]]}] [[call]] [[BIS_fnc_addStackedEventHandler]];</code> |=  
[[hintSilent]] [[str]] [[time]];
+
}] [[call]] [[BIS_fnc_addStackedEventHandler]];</code> |=  
+
   
|x2= <code>["someId", "onEachFrame", {
+
|x2= <code>["someId", "onEachFrame", {[[hintSilent]] [[str]] [[position]] (_this [[select]] 0)}, <nowiki>[</nowiki>[[player]]]] [[call]] [[BIS_fnc_addStackedEventHandler]];</code> |=  
[[hintSilent]] [[str]] [[Magic Variables|_this]];
+
}, "Hello world!"] [[call]] [[BIS_fnc_addStackedEventHandler]];</code> |=  
+
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
   
Line 45: Line 44:
 
<dl class="command_description">
 
<dl class="command_description">
 
<!-- Note Section BEGIN -->
 
<!-- Note Section BEGIN -->
 
<dd class="notedate">Posted on November 1, 2013
 
<dt class="note">[[User:neokika|neokika]]<dd class="note">
 
More info at: http://forums.bistudio.com/showthread.php?167822-Stacked-event-handlers-OnEachFrame-OnPlayerConnected-etc
 
 
<dd class="notedate">Posted on February 11, 2014
 
   
 
<dd class="notedate">Posted on 25 Jun, 2014
 
<dd class="notedate">Posted on 25 Jun, 2014
Line 72: Line 65:
 
[[Category:Functions|{{uc:addStackedEventHandler}}]]
 
[[Category:Functions|{{uc:addStackedEventHandler}}]]
 
[[Category:{{Name|arma3}}: Functions|{{uc:addStackedEventHandler}}]]
 
[[Category:{{Name|arma3}}: Functions|{{uc:addStackedEventHandler}}]]
 
<!-- CONTINUE Notes -->
 
<dl class="command_description">
 
<dd class="notedate">Posted on December 8, 2014 - 08:21 (UTC)</dd>
 
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt>
 
<dd class="note">
 
It is not possible to override default engine behavior with stacked event handlers. This is because [[BIS_fnc_executeStackedEventHandler]], a function that is called inside [[BIS_fnc_addStackedEventHandler]], '''always''' returns false.
 
</dd>
 
</dl>
 
<!-- DISCONTINUE Notes -->
 
 
<!-- CONTINUE Notes -->
 
<dl class="command_description">
 
<dd class="notedate">Posted on December 8, 2014 - 20:56 (UTC)</dd>
 
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt>
 
<dd class="note">
 
You cannot use stacked EH's and non-stacked EH's (just the normal commands, [[onEachFrame]]/[[onMapSingleClick]]/etc.) of the same event together because [[BIS_fnc_addStackedEventHandler]] utilizes these commands in it's code, overwriting a non-stacked EH. Redefining a non-stacked EH will also overwrite all stacked EH's (in that particular event).
 
 
Stacked Event Handlers are saved to [[missionNamespace]] whenever a new one is added, to view them use:
 
<code>[[hint]] [[str]] ([[missionNamespace]] [[getVariable]] ["BIS_stackedEventHandlers_XXX",[]]);
 
where "XXX" is each event name ("[[onEachFrame]]", "[[onPreloadStarted]]", "[[onPreloadFinished]]", "[[onMapSingleClick]]", "[[onPlayerConnected]]", "[[onPlayerDisconnected]]")</code>
 
</dd>
 
</dl>
 
<!-- DISCONTINUE Notes -->
 

View the full article

Share this post


Link to post
Share on other sites
Sign in to follow this  

×

Important Information

City Life RPG mod for ARMA 3
Copyright © 2017 City Life RPG. All rights reserved.
Registered with the UK Copyright Service. Registration No: 284659128

Positive SSL on a transparent background ipv6 ready DMCA.com Protection Status