setTriggerStatements: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(rewritten description)
(reformatted, to match standard template layout)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| This command provides hooks for conditioning a trigger with custom functions/scripts. Three hooks are provided: controlling (1) when the trigger will be activated, (2) what to do when the trigger activates, and (3) what to do when the trigger deactivates. Two variables are of concern: ''this'' contains the boolean return value of the trigger's condition (e.g. "East Not Present"); ''thisList'' provides an array containing all units which are currently causing activation. |= Description
| Defines a trigger's condition, and executable code for its activation and deactivation events. |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| trigger '''setTriggerStatements''' [condition, activation, deactivation] |= Syntax
| trigger '''setTriggerStatements''' [condition, activation, deactivation] |= Syntax


|p1= trigger: [[Object]] |= Parameter 1
|p1= trigger: [[Object]] - Trigger object |= Parameter 1
|p2= [condition, activation, deactivation]: [[Array]] |= Parameter 2
|p2= condition: [[String]] - Code containing the trigger's condition, which has to return a [[boolean]] value. If ''this'' is used, the result of the trigger's [[http://community.bistudio.com/wiki/setTriggerActivation activation condition]] is interpreted.|= Parameter 2
|p3= condition: [[String]] |= Parameter 3
|p3= activation: [[String]] - Code that is executed when the trigger is activated (The variable [[this|thislist]] contains an array with the units that activated the trigger.)|= Parameter 3
|p4= activation: [[String]] |= Parameter 4
|p4= deactivation: [[String]] - Code that is executed when the trigger is deactivated. |= Parameter 4
|p5= deactivation: [[String]] |= Parameter 5


| [[Nothing]] |= Return value
| [[Nothing]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>_trigger setTriggerStatements ["this", "ok <nowiki>=</nowiki> [[true]]", "ok <nowiki>=</nowiki> [[false]]"]</code> |= Example 1
|x1= <code>_trg setTriggerStatements ["this", "hint 'trigger on'", "hint 'trigger off'"]</code> |= Example 1
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 21:56, 3 November 2009

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Defines a trigger's condition, and executable code for its activation and deactivation events.
Groups:
Uncategorised

Syntax

Syntax:
trigger setTriggerStatements [condition, activation, deactivation]
Parameters:
trigger: Object - Trigger object
condition: String - Code containing the trigger's condition, which has to return a boolean value. If this is used, the result of the trigger's [activation condition] is interpreted.
activation: String - Code that is executed when the trigger is activated (The variable thislist contains an array with the units that activated the trigger.)
deactivation: String - Code that is executed when the trigger is deactivated.
Return Value:
Nothing

Examples

Example 1:
_trg setTriggerStatements ["this", "hint 'trigger on'", "hint 'trigger off'"]

Additional Information

See also:
createTriggersetTriggerActivationsetTriggerAreasetTriggerTextsetTriggerTimeoutsetTriggerTypethis

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section