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


Contact Me
Xide
Online Scripting Reference

setTextLineTrigger

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

Syntax
setTextLineTrigger {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 block of text that is required to be in the line 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 TextLine 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.

TextLine triggers differ from text triggers in that they will not activate unless a full line of text has been received. This makes them the standard for parsing data from the remote server.

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