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


Contact Me
Xide
Online Scripting Reference

setTextOutTrigger

Purpose
Creates a trigger that will activate when certain text is received from one of TWX Proxy's telnet clients.

Syntax
setTextOutTrigger {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 must be matched with the outgoing text for the trigger to activate.



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

The TextOut trigger will automatically jump to a label within the script and begin executing as soon as text is received from a client terminal containing the specified value. The outgoing text will be stored within a buffer and can be retrieved using the "getOutText" command. After a TextOut trigger has been activated, the original outgoing text is held and will not be sent until it is passed to a "processOut" command.

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


Example



Xide - 6 April 2004 at 5:53 AM  (EST)
This is a very powerful command that can be used to write everything from script menus to intelligent macros. The TextOutTrigger allows you to easily intercept any text that is typed into a terminal connected to TWX Proxy. Once the text is intercepted, you can choose to continue sending it through to the Trade Wars server (using the ProcessOut command), or you can just capture it and ignore it. If you don't specify the text you want the TextOutTrigger to intercept, it'll trigger off ANYTHING that gets typed into the terminal.

Here is an example of a simple macro script:

:top
setTextOutTrigger macro :macro
pause
:macro
getOutText $text

if ($text = "@")
send "'First macro*"
elseif ($text = "!")
send "'Second macro*"
elseif ($text = "%")
send "'Third macro*"
else
processOut $text
end

goto :top


This TextOutTrigger doesn't have any trigger text specified for it, so it will activate on anything that is typed into the terminal. Once the trigger has activated, we can retrieve the text that has been typed in by using the GetOutText command.

From here we can compare the text to identify what to do with it. In this case, if the user has pressed the keys !, @ or %, the script will send macro text out on the subspace radio in Trade Wars. If the text doesn't match any of these keys, we can continue to process it as normal, eventually passing it to the Trade Wars server as though we hadn't trapped it at all. This is done using the ProcessOut command.

In many cases, the ProcessOut command could be substituted with a Send command. The difference between the two commands is that ProcessOut will first attempt to trigger textOutTrigger in any other scripts that are loaded before sending the text to the Trade Wars server.



Return to item listing