Scripting:TWBaseTrigger

All the scripts with "Trigger" in their name inherit from this base trigger script and they send messages - usually TurnOn or TurnOff - in response to some kind event in the level. All TWTrigger...whatever... scripts support the following arguments in the Editor -> Design Note. [ScriptName] here is the name of the script as you entered it into the S->Scripts property.

Messages

[ScriptName]TOn
Type: string
Default: TurnOn
Use this parameter to specify which script message the trigger should send when activated.
[ScriptName]TOff
Type: string
Default: TurnOff
Use this parameter to specify which script message the trigger should send when deactivated.

The value specified for [ScriptName]TOn and [ScriptName]TOff can either be a message name, or a stimulus. To have the script send a stimulus instead of a message, specify the intensity of the stim in square brackets followed by the stimulus name. For example: [ScriptName]TOn="[5.00]WaterStim". You may also specify minimum and maximum intensities for the stimulus by including the two values separated by a |. For example: [ScriptName]TOn="[5.00|10.00]WaterStim" will send a WaterStim with a random intensity between 5.00 and 10.00.

[ScriptName]TDest
Type: target
Default: &ControlDevice
Specify the targets that messages should be sent to when the script is activated or deactivated. The default targets all objects linked to the host object by ControlDevice links. The full capabilities of this parameter are discussed on the Targetting page.

Use limiting

[ScriptName]TCount
Type: integer
Default: 0 (infinite)
Use this parameter to specify the maximum number of times that the script will work. You can use [ScriptName]TCount=1 to emulate the Once Trap Control Flag. Sending the trigger a ResetTriggerCount message will reset the counter.
[ScriptName]TCountFalloff
Type: time
Default: 0 (no falloff)
Specify a time, in milliseconds, that it takes for the count to decrease by one. This defaults to 0, which means that no falloff happens and the script will stop working when the count is reached until a ResetTriggerCount message is sent to it. If you set a falloff, the count of the number of times the script has worked is decreased over time, eventually dropping back down to zero if no further activations have happened. Note that, unless [ScriptName]TCountLimit is true, activations will increase the count of number of times the trap has worked, even if it has had no effect.
[ScriptName]TCountLimit
Type: boolean
Default: false
If set to true, the count of number of times the script has worked will be limited to the maximum. Otherwise, every attempted activation will be counted, even if it didn't work.
[ScriptName]CountOnly
Type: integer/string
Default: Both
Valid values: 1, 2, 3, On, Off, Both
Sending both TurnOn and TurnOff are counted against the [ScriptName]TCount by default. You can use [ScriptName]TCountOnly=1 or [ScriptName]TCountOnly=On to ignore TurnOff, and [ScriptName]TCountOnly=2 or [ScriptName]TCountOnly=Off to ignore TurnOn.

Other

[ScriptName]FailChance
Type: integer
Default: 0 (always succeeds)
Use this parameter to specify a % chance that the trigger will fail (do nothing) when it is activated. For example: [ScriptName]FailChance=35 will give the trigger a 35% chance to fail when activated.


Authors

  • gravatar The Watcher [userbureaucratsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+]

Looking for something?

Use the form below to search the wiki:

 

Still not finding what you are looking for? Contact us so we can take care of it!