MIST addEventHandler
From DCS World Wiki - Hoggitworld.com
mist.addEventHandler
Added with: Mist 1.0 |
Description |
This is a simplified version of the simulator scripting engine’s world.addEventHandler function. handler must be a function that expects a single variable of a world simulator event. It also returns a number id for this event handler (for use with mist.removeEventHandler). For more information on world events, see the Simulator Scripting Engine documentation for world events. |
Syntax |
number mist.addEventHandler(function f ) |
Valid Input Values: |
function f: any function accessible to the scripting engine |
Return value: |
number |
Return example: |
5 |
Usage Examples: |
Adds an event handler that, every time a weapon is fired, it adds that weapon to a global table that
holds all weapon objects
activeWeapons = {} local function addWeapon(event) if event.id == world.event.S_EVENT_SHOT and event.weapon then activeWeapons[#activeWeapons + 1] = event.weapon end end mist.addEventHandler(addWeapon) end |
Notes: |
Related Functions |
scheduleFunction, removeFunction, addEventHandler, removeEventHandler |