User Login
Name
Password
Site Contents
News
About
Download
Scripts
Tutorials
Register
Support
FAQ
Script Reference
New User


Contact Me
Xide
Online Scripting Reference

setTextTrigger

Purpose
Creates a trigger that will activate when a text containing a specific value has been received from the remote server.

Syntax
setTextTrigger {name} {label} [{value}]

{name}: The name of the trigger to create. This name is used for later references to the trigger.

{label}: A label within the script to jump to when the trigger is activated.

[{value}]: A value that is required to be in the block of incoming text for the trigger to activate. If this parameter is not specified, the trigger will activate on any line - even if it is blank.



Notes
Triggers mark the way in which TWX Scripts interact with their environment (Trade Wars).

The Text trigger will automatically jump to a label within the script and begin executing as soon as text is received from the remote server matching a certain requirement. Note that this text is case sensitive.

Because the Text trigger can technically activate when only half a line of text has been received, it is usually bad practice to use it to extract data from the remote server. Use a TextLineTrigger instead.

Note that no triggers will activate unless the script has been paused with a "pause", "waitFor" or "waitOn" command.

Example
# see if we have a planet scanner
setVar $scanner 0
send "i"
setTextLineTrigger 1 :HasScanner "Planet Scanner"
setTextTrigger 2 :DoneTest "Command [TL="
pause

:HasScanner
setVar $scanner 1
killTrigger 2

:DoneTest
killTrigger 1



Return to item listing