Changes between Version 32 and Version 33 of Triggers
- Timestamp:
- Nov 6, 2016, 1:26:32 AM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Triggers
v32 v33 85 85 {{{ 86 86 #!js 87 // get the cmpTrigger object 88 var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); 89 90 // register the trigger directly 91 var myData = {"enabled": true}; 92 cmpTrigger.RegisterTrigger("OnPlayerCommand", "MyAction", myData); 87 { 88 // Get the cmpTrigger object 89 let cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); 90 91 // Register the trigger directly 92 cmpTrigger.RegisterTrigger("OnPlayerCommand", "MyAction", { "enabled": true }); 93 } 93 94 }}} 94 95 … … 97 98 The combination of event and action name must be unique. This combination can be used to enable and disable triggers. Registering a trigger twice isn't possible, and you will be warned when you do that. 98 99 99 When you have your first triggers registered, they can fire actions, but actions can again register new triggers. As this time, it happens within the `Trigger` prototype, you can access `cmpTrigger` simplywith `this`.100 When you have your first triggers registered, they can fire actions, but actions can again register new triggers. As this time, it happens within the `Trigger` prototype, you have to access `cmpTrigger` with `this`. 100 101 101 102 {{{