home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 17
/
CD_ASCQ_17_101194.iso
/
vrac
/
twterm30.zip
/
SCRIPT.DOC
< prev
next >
Wrap
Text File
|
1994-07-07
|
20KB
|
412 lines
Instructions on using TWTERM's script language for creating macros.
====================================================================
OK before I show you whats available in this script language, lets
take a little lesson on how to write a macro.
A macro can send keypresses to the modem. By using a macro, you don't
have to punch the keys in. Thus a macro can do things in TW that you
normally doing by pushing keys on the keyboard.
Heres an example... You want to create a capture file that lists all
your assets in a game. The first thing you need to do is to display
your assets to the screen so they can be saved in the capture file.
Your assets consist of.. fighters, planets, ships, mines. So what are the
TW commands for displaying those? Hitting "T" then "L" lists your Corporate
planets, "C" then "Y" lists your personal planets. Hitting "G" displays
your fighters, etc...
As you can see, you'll be having to press a lot of keystrokes to display
all your assets. Instead you could push just one key and let a macro run
it all for you. To code the above example, you would have the macro send
the keystrokes for you. To do this you use the SEND command.
For example, let's display your Personal planets. If you're at TW's main
prompt then you'll need to enter the computer by pressing "C". Then list
the planets by sending "Y". So you need to send "C" then "Y". Would help
to send "Q" also which will return you to TW's main prompt.
Now that you have determined to send "C", "Y", "Q", you need to know when
to send them. Thus you must tell TWTERM the next prompt to look for so it
can send the next keystroke. In our example, you want to start the macro
from TW's Main prompt then go to the computer prompt by sending "C". So after
sending "C" you must look for the computer prompt. TWTERM by default has the
Computer prompt stored in a variable (that way you dont have to remember what
it is). The prompt for this is stored in variable %9 (more on variables later)
So you want to send "C" then look for Computer prompt. to code this
you would type (commands must be enclosed within {} brackets)...
{send C}{%9}
After sending "C" and reaching the Computer prompt, your macro will check
to see if there is another keystroke. If so it continues.. if not, control
is returned to you.
that's basically all there is to macros. But to finish our example.. here is
the rest of the code needed to display your Personal planets...
{send C}{%9}{send Y}{%9}{send Q}{%0}
%0 is the variable that contains the Main prompt. So you send "C", look
for Computer prompt. Send Y, look for Computer prompt. Send Q and look
for when you return to the Main TW prompt.
Easy, huh? Now you can finish the rest of the macro yourself. Have Fun
====================================================================
!!!!!!!! ABORT MACRO !!!!!!!!
There are going to be times you miscode a macro. Or perhaps line noise
came in and interrupted the macro. Maybe you started the macro from the
wrong place in your game. In any case, if you find yourself stuck in a
macro, use the <ESC> key to get out of it.
How will you know when you are stuck? The screen will sit there and
not end where it should. The keyboard won't respond to your keypresses.
Hit <ESC> anytime you're stuck or just want to end a macro.
NOTE: Sometimes hitting < ESC > won't work the first time. Just keep hitting
<ESC> until you exit.
===================================================================
variables
There are 33 variables numbered %0 thru %34 that are available for use.
Use these variables for storing of data. Useful when using loops and to
save time typing.
Some of the variables are used for special purposes. However you can
still access them and even overwrite them. Here is the complete list:
%1 - %8 Available for your use when writing your own macros.
%0 Contains TW's Main prompt. Use this variable to find out
when you have returned to TW's main prompt
%9 Contains TW's Computer prompt. Use this to find out when
you have reached/returned to the Computer prompt
%10-%13 Used by the Built-In macros when being executed. You can use
these for your macros, but when a Built-In macro is run
it will erase anything you have stored here.
%14 Password for the Underground stored here. When you run TWTERM's
LOCK/UNLOCK UNDERGROUND macro, TWTERM saves the password in
this variable. Should you wish to return to the Underground,
you can do so easily with your own script macro: {SEND %14}{}
No need to run the LOCK/UNLOCK macro again (saves credits)
%15 Current path is stored here
%16 Contains location of Stardock if found in .DAT file. If found
use this in a macro to take you to Stardock.
%17 Used for storing offer when price haggling via the HAGGLE command
%18 Contains the current sector you are in. Can copy the contents
of this variable to another variable. Example: {%1 = %18}
Now whenever you want to go back to the sector you started in,
you just send variable 1. Example {SEND %1;}{%0}
%19 Contains the current sectors Class Type if a port exists.
If not, contains Class Type of last port visited.
%20 Contains ships password. Use this variable in a macro when
you need to send a password for one of your ships.
Example: {SEND %20}{}
%21 Used by built-in macros to determine whether your ship is
equipped with a Trans-Warp Drive. The colonize macro uses
This variable.
%22 Used by the planet macros to determine/handle the prompts
you will encounter when trying to land on a planet.
%23 When writing macros for shooting Disruptors, the prompt
that asks if you want to fire one changes between
the different versions of TW. Thus if you play in these
different version, you may want to use this variable so
your macro is compatible with all versions of TW 2.0.
Example: {send w}{%23}
%24 Port prompt (first prompt you get after "P"ort). Useful when
writing macros for trading, since this prompt is different
between the MajorBBS version of TW and the dorr version.
Use this variable and your macro will work in both versions.
Example: {send p}{%24}
%25 The prompt stored here is the one you get when leaving/taking
colonists from your planet. The one that asks, which colonists
to take/leave. Useful when writing macros for colonizing,
since the prompt stored here changes between the door TW 2.0
and the MajorBBS version. Use this variable and your macro
will work in both versions.
Example: {send s}{net?}{send n}{[L]}{send L}{%25}
%26 The prompt stored here is the one you get when stealing a product
from a port. The prompt is the one that asks what type of
product you wish to steal. Useful when writing macros for
stealing since the prompt stored here changes between TW 2.0
and the MajorBBS version of 2.0. Use this variable and your
macro will work in both versions.
Example: {send s}{%26}{send 3}{]}{send %1;}{%0}
%27 This prompt appears when taking a product off of your planet.
After you get the "Take or Leave" prompt.. you specify T or
L.. then you get this prompt. Use this variable so you macro
will be compatible with all version of TW 2.0
Example: {send t}{net?}{send n}{[T]}{send t}{%27}
%28 This is the prompt that appears when handling or displaying
mines. It is the one that asks you to select Armid or Limpet
mine. It changes between the different versions of TW 2.0. Use
variable to keep compatibility.
Example: {send K}{%28}{send 1}{%0}
%29 Not in use yet
%30-%33 Trade Percentages used by TWTERM. Not wise to mess with these
But if you must use a macro for changing these values (don't
really need to because you can do it from the F8 menu in
TWTERM) then here isa breif rundown..
%30 = How much HIGHER your initial offer is compared to ports
offer.
%31 = How much LOWER your initial offer is compared to ports
offer.
%32 = How much HIGHER/LOWER to increment your counter offers
in case the port didn't take your initial offer.
offer.
%33 = This is the percentage amount a port needs on hand to
to earn a "*" in the Best Ports Listing.
When TWTERM encounters some of these variables in your macro, it will check
to see if the macro contains anything (applies only to variables %1-%8).
If blank, you will be prompted for input, if the variable contains
something, it will use that instead of prompting for input. (See the SET
command on how to manipulate variables).
Here is a list of prompts that have changed in the Door version
of TW 2.0 and the MBBS version of TW 2.0. If you find your macro works in one
version but not the other, try using a variable instead in your macro. Look
for the following prompt strings and change it to the apprpriate variable.
Variable Prompt String Where you may find
To Use Door MBBS this prompt string
%23 one ? one? When Launching Disruptors
%24 T] ? T]? When Porting
%25 tion? duct? When Leaving/Taking colonists
%26 uit) ? uit)? When Stealing product from port
%27 nt ? nt? When Taking product off of planet
%28 impet? t ? : When choosing mines
If you're not playing in the different formats of TW then you don't need
to worry about these prompts.
==========================================================================
Operators
Operators perform mathmatical or logical operations on variables.
= Use to put a numeric value or text string into a variable.
Syntax: {Variable = Number/TextString}
* Multiplies a variable by a number you specify
Syntax: {Variable * Number}
/ Divides a variable by a number you specify
Syntax: {Variable / Number}
+ Adds to a variable a number you specify
Syntax: {Variable + Number}
- Subtracts from a variable a number you specify
Syntax: {Variable - Number}
Examples: {%10 = 889} Puts "889" into variable 10
{%4 = Hello Commander} Puts "Hello Commander" into 4
{%3 * 2} Multiplies variable 3 by two, then
stores the answer back in var 3
==========================================================================
Labels
Labels are used to branch back to a previous part of your macro. These
are extremely helpful when coding a loop for your macro.
The label can be any string of text you want, as long as you add a ":"
to the beginning of your labels name. The following are all valid labels:
{:again} or {:Do Again} or {:A}
As you can see, your label must be enclosed within a set of "{}" brackets.
You can use upper or lowercase characters. You can have as many labels as
you want in your macro as long as each label has it's own unique name.
==========================================================================
AVAILABLE commands
1) All commands must be enclosed within the {} characters.
EX: {Command}
2) Commands must be entered with no spaces between the brackets.
EX: {Command}{Command} This is valid
{Command} {Command} This is not valid
3) Commands can be entered in Upper or Lower case.
------------------------------------------------------------------------
BEEP Makes a Beep sound.
Syntax: {BEEP}
------------------------------------------------------------------------
CHKBUST If you have coded a macro that does a rob or steal loop, then
you will want to use this command to check if you were busted.
If so the macro will end, if not it will continue with the loop.
Syntax: {CHKBUST}
Example: {:loop}
{your rob/steal code goes here}
{chkbust}
{goto loop}
------------------------------------------------------------------------
GOTO Branches to another part of your macro. Excellent for creating
loops in your macros
Syntax: {GOTO LabelName}
Parameters: LabelName
where LabelName is the name of the label you want the
macro to branch to. The macro then executes all of the
commands following that label.
SPECIAL NOTE: LabelName MUST NOT be preceded with a ":". Only the name
of the label. Also, LabelName is not case sensitive. Captalization doesn't
matter as long as the name is spelled correctly.
Example: {:loop}{beep}{goto loop}
{:again}{set}{goto AGAIN}
{send d}{%0}{:HERE}{SEND D}{%0}{GOTO here}
the above are all valid
------------------------------------------------------------------------
HAGGLE Calculates best price to offer when trading, then stores
the amount in variable %17. Also turns on "Haggle Mode".
Syntax: {HAGGLE -}{EndWhere} or {HAGGLE +}{EndWhere}
Parameters: - or +
"-" tells the macro you want to buy. Thus your offer will be
calculated less then what the port is offering.
"+" tells the macro you are selling. Thus your offer will be
calculated more then what the port is willing to pay.
EndWhere
This tells TW where to end this command. Enter here
the last few letters of the next prompt. Usually the next
prompt will be TW's main prompt (if you are done with that
port), or another trade prompt askinf if you want to sell
or buy something else.
Example: {haggle +}{%0}
The above macro works at a CLASS 8 port and provided you have
only 1 type of product on your ship. After you port and
specify you want to trade, the port will make you an offer.
Run the above macro. It will findout what that offer is,
calculate your offer, then send it back to TW. The macro will
haggle until your offer is accepted, then return you to the
main prompt (%0).
------------------------------------------------------------------------
SEND Sends the TW command you want to execute to the modem
Syntax: {SEND CharacterToSend}{EndWhere}
Parameters: CharacterToSend
is the TW command to execute, or user variable you want
executed. If you want a carriage return added put a ";"
on the end.
EndWhere
This tells TW where to end this command. Enter here
the last few letters of the next expected prompt.
Example: {send 4;}{%0}
Unlike other commands in TW, when you move sectors you need
to press <ENTER> to execute the command. By adding ";" to the
end of string to execute, you send an <ENTER> key with it.
The above example sends to TW a "4" and an "ENTER" key. Thus
telling it to move to sector 4. The {%0} says to return
control back to TWTERM when the Main Menu prompt is
encountered.
Example: {SEND %1}{%0}
Here you are sending whatever you have stored in variable one
If you have stored nothing there, you will be prompted to
enter a string of text for execution and storage. Most useful
when wanting to run the same macro over and over, thus you
only have to enter the data once.
Examples: {Send c}{p)?}{send n}{p)?}{SEND Q}{p) ?}
This macro is started from the main prompt. The first set
of brackets tells TWTERM to send the "C" command (enter the
computer), the second set of brackets tell it to wait until
it gets to the computers prompt "p)?". This prompt to search
for is also stored in variable %9. So this command is just as
valid: {Send c}{%9}
Once it gets to the computer prompt it starts the next
command (set of brackets). The next one says to send "N"
which will toggle the color, and wait again until you get
back to the computer prompt.
The third SEND command sends "Q" telling TW to exit the
computer and return to the main menu. At the end of this
command you see "p) ?" (the last 4 letters of TW's main menu
prompt), which tells it to wait until it gets back to TW's
main menu prompt.
With this macro, you can now turn on/off the color in TW
while at the main prompt instead of just at the computer
prompt.
This macro works with TW 1.03 versions, not 2.0. Just an
example. You'll need to modify it for 2.0 if you want to
use it.
------------------------------------------------------------------------
SET Clears User variables
Syntax: {SET} or {SET variable}
Parameters: variable
is one of the 23 valid variables from %0 thru %22
Using SET without a variable, initilizes variables %0 and %9 to their
original default values. %1-%8 and %10-%13 are st to null. The other
variables are left unchanged.
Specifing a variable clears only that variable. All variables are valid
here.
Examples: {set %8} clears variable 8
{set} clears all variables between 0-13 and sets
%0 and %9 to their original default values
--------------------------------------------------------------------------
ERROR messages
The following are some of the macro error messages you may encounter.
* Incorrect Command
This occurs when you have issued a command that TWTERM doesn't recognize.
Perhaps you have spelled it incorrectly, or used the wrong syntax.
* Wrong Syntax For Label
You're label does not have a ":" at the beginning of it, or perhaps
your forgot to enclose it within the "{}" brackets.
* Label Not Found
You issued a GOTO command and the label you specified cannot be found
in the macro. Make sure your GOTO statement doesn't have a ":" at the
beginning of the label name. Also check to see if the label name is
spelled the same as the one you are using in your GOTO.