home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / BBS_GAME / TWTERM21.ZIP / SCRIPT.DOC < prev    next >
Text File  |  1994-02-15  |  13KB  |  286 lines

  1. Instructions on using TWTERM's script language for creating macros.
  2. ====================================================================
  3.                    !!!!!!!!  ABORT MACRO  !!!!!!!!
  4.  
  5. There are going to be times you miscode a macro. Or perhaps line noise
  6. came in and interrupted the macro. Maybe you started the macro from the
  7. wrong place in your game. In any case, if you find yourself stuck in a
  8. macro, use the <ESC> key to get out of it.
  9.  
  10. How will you know when you are stuck? The screen will sit there and
  11. not end where it should. The keyboard won't respond to your keypresses.
  12. Hit <ESC> anytime you're stuck or just want to end a macro.
  13.  
  14. NOTE: Sometimes hitting <ESC> won't work the first time. Just keep hitting
  15. <ESC> until you exit.
  16.  
  17. ===================================================================
  18.                              VARIABLES
  19.  
  20. There are 23 variables numbered %0 thru %22 that are available for use.
  21. Use these variables for storing of data. Useful when using loops and to
  22. save time typing. 
  23.  
  24. Some of the above variables are used for special purposes. However you can
  25. still access them and even overwrite them. Here is the complete list:
  26.  
  27. %1 - %8     Available for your use when writing your own macros.
  28.      %0     Contains TW's Main prompt. Use this variable to find out
  29.                when you have returned to TW's main prompt
  30.      %9     Contains TW's Computer prompt. Use this to find out when
  31.                you have reached/returned to the Computer prompt
  32. %10-%13     Used by the Built-In macros when being executed. You can use
  33.                these for your macros, but when a Built-In macro is run
  34.                it will erase anything you have stored here.
  35.     %14     Password for the Underground stored here. Once you set a new
  36.               password using the UNLOCK macro, you can then send this
  37.               variable to access the underground without having to run the
  38.               UNLOCK macro again.   
  39.     %15     Current path is stored here
  40.     %16     Contains location of Stardock if found in .DAT file. If found
  41.               use this in a macro to take you to Stardock.
  42.     %17     Used for storing offer when price haggling via the HAGGLE command
  43.     %18     Contains the current sector you are in. Can copy the contents
  44.               of this variable to another variable. Then use the other
  45.               variable to return back to this sector.
  46.     %19     Contains the current sectors Class Type if a port exists.
  47.               If not contains Class Type of last port visited.
  48.     %20     Contains ships password. Use this variable in a macro when
  49.               you need to send a password for one of your ships.
  50.     %21     Used by built-in macros to determine whether your ship is
  51.               equipped with a Trans-Warp Drive. The colonize macro uses
  52.               this variable.
  53.     %22     Used by the planet macros to determine/handle the prompts
  54.               you will encounter when trying to land on a planet.
  55.  
  56. When TWTERM encounters one of these variables in your macro, it will check
  57. to see if the macro contains anything. If blank, you will be prompted for
  58. input, if the variable contains something, it will use that instead of
  59. prompting for input. (See the SET command on how to manipulate variables).
  60. ==========================================================================
  61.                              OPERATORS
  62.      Operators perform mathmatical or logical operations on variables.
  63.  
  64. =   Use to put a numeric value or text string into a variable.
  65.     Syntax:  {Variable = Number/TextString}
  66.  
  67. *   Multiplies a variable by a number you specify
  68.     Syntax:  {Variable * Number}
  69.  
  70. /   Divides a variable by a number you specify
  71.     Syntax:  {Variable / Number}
  72.  
  73. +   Adds to a variable a number you specify
  74.     Syntax:  {Variable + Number}
  75.  
  76. -   Subtracts from a variable a number you specify
  77.     Syntax:  {Variable - Number}
  78.  
  79.     Examples: {%10 = 889}               Puts "889" into variable 10
  80.               {%4 = Hello Commander}    Puts "Hello Commander" into 4
  81.               {%3 * 2}                  Multiplies variable 3 by two, then
  82.                                         stores the answer back in var 3
  83.  
  84. ==========================================================================
  85.                               LABELS
  86.  
  87. Labels are used to branch back to a previous part of your macro. These
  88. are extremely helpful when coding a loop for your macro.
  89.  
  90. The label can be any string of text you want, as long as you add a ":"
  91. to the beginning of your labels name. The following are all valid labels:
  92.  
  93. {:again}  or  {:Do Again}  or {:A}
  94.  
  95. As you can see, your label must be enclosed within a set of "{}" brackets.
  96. You can use upper or lowercase characters. You can have as many labels as
  97. you want in your macro as long as each label has it's own unique name.
  98.  
  99. ==========================================================================
  100.                           AVAILABLE COMMANDS
  101.  
  102. 1)  All commands must be enclosed within the {} characters.
  103.         EX:   {Command}
  104.  
  105. 2)  Commands must be entered with no spaces between the brackets.
  106.         EX:   {Command}{Command}    This is valid
  107.               {Command} {Command}   This is not valid
  108.  
  109. 3)  Commands can be entered in Upper or Lower case.
  110.  
  111. ------------------------------------------------------------------------
  112. BEEP     Makes a Beep sound.
  113.  
  114.   Syntax:   {BEEP}
  115.  
  116. ------------------------------------------------------------------------
  117. CHKBUST     If you have coded a macro that does a rob or steal loop, then
  118.             you will want to use this command to check if you were busted.
  119.             If so the macro will end, if not it will continue with the loop.
  120.  
  121.   Syntax:   {CHKBUST}
  122.  
  123.   Example:   {:loop}
  124.              {your rob/steal code goes here}
  125.              {chkbust}
  126.              {goto loop}
  127.  
  128. ------------------------------------------------------------------------
  129. GOTO     Branches to another part of your macro. Excellent for creating
  130.          loops in your macros
  131.  
  132.   Syntax:   {GOTO LabelName}
  133.  
  134.   Parameters:   LabelName
  135.  
  136.                   where LabelName is the name of the label you want the
  137.                   macro to branch to. The macro then executes all of the
  138.                   commands following that label.
  139.  
  140. SPECIAL NOTE:  LabelName MUST NOT be preceded with a ":". Only the name
  141. of the label. Also, LabelName is not case sensitive. Captalization doesn't
  142. matter as long as the name is spelled correctly.
  143.  
  144.   Example:   {:loop}{beep}{goto loop}
  145.              {:again}{set}{goto AGAIN}
  146.              {send d}{%0}{:HERE}{SEND D}{%0}{GOTO here}
  147.  
  148.              the above are all valid
  149.  
  150. ------------------------------------------------------------------------
  151. HAGGLE     Calculates best price to offer when trading, then stores
  152.            the amount in variable %17. Also turns on "Haggle Mode".
  153.          
  154.   Syntax:   {HAGGLE -}{EndWhere} or {HAGGLE +}{EndWhere}
  155.  
  156.   Parameters:   - or + 
  157.  
  158.                 "-" tells the macro you want to buy. Thus the price
  159.                     calculated will be 4 1/2% less then what the port
  160.                     is offering.
  161.  
  162.                 "+" tells the macro you are selling. Thus the price
  163.                     calculated will be 5 1/2% more then what the port is
  164.                     willing to pay.
  165.                 
  166.                 EndWhere
  167.  
  168.                   This tells TW where to end this command. Enter here
  169.                   the last few letters of the line to end this command on.
  170.  
  171.  
  172.     Example:   {haggle +}{%0}
  173.  
  174.                The above macro works at a CLASS 8 port and provided you have
  175.                only 1 type of product on your ship. After you port and
  176.                specify you want to trade, the port will make you an offer.
  177.                Run the above macro. It will findout what that offer is,
  178.                calculate your offer, then send it back to TW. The macro will
  179.                haggle until your offer is accepted, then return you to the
  180.                main prompt (%0).
  181.  
  182.                If you are at a port that has something to sell you, then you 
  183.                would run HAGGLE again this time specifying "-" to haggle for
  184.                that one.
  185.  
  186.     Example:   {haggle +}{}
  187.  
  188.                When asked to make an offer, run the above macro. It haggles
  189.                the best price then returns control to you when done.
  190.  
  191. ------------------------------------------------------------------------
  192. SEND     Sends the TW command you want to execute to the modem
  193.          
  194.   Syntax:   {SEND CharacterToSend}{EndWhere}
  195.  
  196.   Parameters:   CharacterToSend 
  197.  
  198.                   is the TW command to execute, or user variable you want
  199.                   executed. If you want a carriage return added put a ";"
  200.                   on the end.
  201.  
  202.                 EndWhere
  203.  
  204.                   This tells TW where to end this command. Enter here
  205.                   the last few letters of the line to end this command on.
  206.  
  207.    Example:   {send 4;}{%0}
  208.  
  209.               Unlike other commands in TW, when you move sectors you need
  210.               to press <ENTER> to execute the command. By adding ";" to the
  211.               end of string to execute, you send an <ENTER> key with it.
  212.  
  213.               The above example sends to TW a "4" and an "ENTER" key. Thus
  214.               telling it to move to sector 4. The {%0} says to return 
  215.               control back to TWTERM when the Main Menu prompt is
  216.               encountered.
  217.   
  218.    Example:   {SEND %1}{%0}
  219.  
  220.               Here you are sending whatever you have stored in variable one
  221.               If you have stored nothing there, you will be prompted to
  222.               enter a string of text for execution and storage. Most useful
  223.               when wanting to run the same macro over and over, thus you
  224.               only have to enter the data once.
  225.  
  226.   Examples:     {Send c}{p)?}{send n}{p)?}{SEND Q}{p) ?}
  227.               
  228.               This macro is started from the main prompt. The first set
  229.               of brackets tells TWTERM to send the "C" command (enter the
  230.               computer), the second set of brackets tell it to wait until
  231.               it gets to the computers prompt "p)?". This prompt to search
  232.               for is also stored in variable %9. So this command is just as
  233.               valid: {Send c}{%9}
  234.              
  235.               Once it gets to the computer prompt it starts the next
  236.               command (set of brackets). The next one says to send "N"
  237.               which will toggle the color, and wait again until you get
  238.               back to the computer prompt.
  239.  
  240.               The third SEND command sends "Q" telling TW to exit the
  241.               computer and return to the main menu. At the end of this
  242.               command you see "p) ?" (the last 4 letters of TW's main menu
  243.               prompt), which tells it to wait until it gets back to TW's
  244.               main menu prompt.
  245.  
  246.               With this macro, you can now turn on/off the color in TW
  247.               while at the main prompt instead of just at the computer
  248.               prompt.
  249.  
  250. ------------------------------------------------------------------------
  251. SET    Clears User variables
  252.  
  253.   Syntax:   {SET} or {SET variable}
  254.  
  255.   Parameters:  variable
  256.  
  257.                    is one of the 23 valid variables from %0 thru %22
  258.  
  259. Using SET without a variable, initilizes variables %0 thru %13 to their
  260. original default values and sets all other variables to null.
  261.  
  262. Specifing a variable clears only that variable. All variables are valid
  263. here.
  264.  
  265.   Examples:   {set %8}       clears variable 8
  266.               {set}          clears all variables between 0-13 and sets
  267.                              %0 and %9 to their original default values
  268.  
  269. --------------------------------------------------------------------------
  270. ERROR MESSAGES 
  271. The following are some of the error messages you may encounter.
  272.  
  273. * Incorrect Command
  274.    This occurs when you have issued a command that TWTERM doesn't recognize.
  275.    Perhaps you have spelled it incorrectly, or used the wrong syntax.
  276.  
  277. * Wrong Syntax For Label
  278.    You're label does not have a ":" at the beginning of it, or perhaps
  279.    your forgot to enclose it within the "{}" brackets.
  280.  
  281. * Label Not Found
  282.    You issued a GOTO command and the label you specified cannot be found
  283.    in the macro. Make sure your GOTO statement doesn't have a ":" at the
  284.    beginning of the label name. Also check to see if the label name is
  285.    spelled the same as the one you are using in your GOTO.
  286.