Changes between Version 32 and Version 33 of Triggers


Ignore:
Timestamp:
Nov 6, 2016 12:26:32 AM (5 months ago)
Author:
elexis
Comment:

Warn about out of sync issue when using cmpTrigger out of scope: #4310

Legend:

Unmodified
Added
Removed
Modified
  • Triggers

    v32 v33  
    8585{{{ 
    8686#!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} 
    9394}}} 
    9495 
     
    9798The 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. 
    9899 
    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` simply with `this`. 
     100When 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`. 
    100101 
    101102{{{