home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / v612docs.zip / VC10F < prev    next >
Text File  |  1993-12-16  |  8KB  |  189 lines

  1. .TOPIC:                                            
  2. Control Commands
  3.  
  4.                                             VBBS 6.12 Documentation -- 10-F-1
  5.  
  6.  
  7.          ╔════════════════════════════════════════════════════════════════╗
  8.          ║ CHAPTER TEN ANNEX F      CONTROL COMMANDS                      ║
  9.          ╚════════════════════════════════════════════════════════════════╝
  10.  
  11.  
  12.          GENERAL REDIRECTION
  13.          ═══════════════════
  14.  
  15.          # ->  # <label>
  16.  
  17.                 This command allows you to set points up within your script
  18.            that the various other control commands can use.
  19.                    ex:  TR "Hello "
  20.                         GO skipit
  21.                         TR "You wont see this text..."
  22.                         # skipit
  23.                         TR "Because you just jumped down to here!!"
  24.  
  25.          CALL ->  CALL <label>
  26.  
  27.                 This forces the script to go to <label> and continue to
  28.            run from there.  When a RET is found the script will go back
  29.            to the line after the CALL command.
  30.  
  31.          GO ->  GO <label>
  32.  
  33.                 This forces the script to go to <label> just like the CALL
  34.            command, with the only difference being that it will not return
  35.            if it encounters an RET statement.
  36.  
  37.          RET <---
  38.  
  39.                 This returns a script from a routine CALLed to the line
  40.            after the CALL statement.  Note: RET is ignored if there was
  41.            no CALL statement used.
  42.  
  43.  
  44.          LOOPS AND COMPARISONS
  45.          ═════════════════════
  46.  
  47.                 VSCRIPT supports some of the more common forms of loops
  48.            and comparison structures.  These are all covered below but
  49.            note that the script language can not generally handle nested
  50.            loops easily, so some testing must be done before you create
  51.            any scripts using such combinations.
  52.  
  53.          DO LOOPS
  54.          ────────
  55.  
  56.          ->  DO <variable1> = <value2> <value3>
  57.                   [body of the loop]
  58.              LOOP
  59.  
  60.                 This type of loop begins with <variable1> equal to
  61.  
  62.  
  63.                                             VBBS 6.12 Documentation -- 10-F-2
  64.  
  65.  
  66.            <value2>.  Each time it reaches the LOOP it adds 1 to it
  67.            and continues until <variable1> is greater than <value3>.
  68.  
  69.          ->  DO WHILE <variable1>   {must store a numeric!}
  70.                   [body of the loop]
  71.              LOOP
  72.  
  73.                 This type continues to loop until <variable1> = 0. You
  74.            must have some way to either exit the loop, or have a place
  75.            where <variable1> is set to 0 or the script will lock into an
  76.            endless loop.
  77.  
  78.  
  79.          IF/IFVAL STRUCTURES
  80.          ───────────────────
  81.  
  82.                 IF structures allow you to compare 2 strings to see if they
  83.            match, valid <relation> operators are = and <> ONLY! The IFVAL
  84.            structures are identical to IF structures, but they are used to
  85.            compare numeric variables.  Valid IFVAL <relations> are =, >,
  86.            >=, <, <= and <>.
  87.  
  88.          ->  IF <variable1> <relation> <variable2> THEN
  89.                   [then-code]
  90.              ENDIF
  91.  
  92.                 This performs the [then-code] if <relation> is true.
  93.  
  94.          ->  IF <variable1> <relation> <variable2> THEN
  95.                   [then-code]
  96.              ELSE
  97.                   [else-code]
  98.              ENDIF
  99.  
  100.                 This performs similar to the IF structure, but if the
  101.            <relation> is false it performs the [else-code].
  102.  
  103.  
  104.          TEST/TESTVAL COMMANDS
  105.          ─────────────────────
  106.  
  107.          ->  TEST <variable1> <relation> <variable2> <label>
  108.          ->  TESTVAL <variable1> <relation> <variable2> <label>
  109.  
  110.                 The two TEST commands allow you to compare two variables,
  111.            and if the comparison is true, to go to a separate part of the
  112.            script (as if a GO <label> had been used).  The only difference
  113.            in the two commands is that TEST performs a non-case-sensitive
  114.            string comparison and TESTVAL performs a mathematic comparison.
  115.            Valid <relations> are =, <, <=, >, >= and <>.
  116.  
  117.  
  118.                                             VBBS 6.12 Documentation -- 10-F-3
  119.  
  120.  
  121.          PASSING CONTROL
  122.          ═══════════════
  123.  
  124.                 There are a total of four ways that you can pass control
  125.            from a script to something else.  These four ways each have
  126.            special uses and are covered below.
  127.  
  128.                Note: These commands will only accept one token following
  129.                      the actual command.  If you wish to have more items
  130.                      on the line then you must place them into a variable
  131.                      and place the variable on the command line.
  132.                      ex: $doscom = "dir " & $pathused & " /w"
  133.                          SHELL $doscom
  134.  
  135.          LINK ->  LINK <filename>
  136.  
  137.                 This command causes the present script to terminate and
  138.             begin running a script called <filename> (do not use any
  139.             extension or globals in the filename.)  All of your
  140.             variables will be cleared before the new script begins
  141.             operation.
  142.  
  143.          EXIT ->  EXIT <filename>
  144.  
  145.                 This command causes the present script to terminate and
  146.             then exits to the function block <filename> (as with LINK,
  147.             do not use extensions or globals.)  If no <filename> is
  148.             specified then the script will exit to the .FB file that
  149.             it was called from UNLESS the script did a shrinkout (see
  150.             DOOR, below) in which case it will always exit to START.FB.
  151.  
  152.          SHELL ->  SHELL <pathfile or DOS command line>
  153.  
  154.                 This will drop to DOS while keeping the BBS in memory.
  155.             It will then execute the command following SHELL and then
  156.             return to the line after the SHELL command.  All of your
  157.             variables are retained because the script is never taken
  158.             from memory.
  159.  
  160.          DOOR ->  DOOR <pathfile or DOS command line>
  161.  
  162.                 This will shrink the BBS out of memory and drop to DOS.
  163.             Implementation of the DOOR command writes the dropfiles
  164.             CHAIN.TXT, DOOR.SYS and DORINFOx.DEF to disk.  If nothing
  165.             else is specified on the command line then the script will
  166.             bring up your list of Doors as set in VCONFIG, otherwise it
  167.             will execute the required command line.  All of the script
  168.             variables will be cleared by the DOOR command.  After the
  169.             DOOR has been exited the user will return to the function
  170.             block that the script was called from unless one of the
  171.             following two commands are used just before the line that
  172.             contains the DOOR command:
  173.  
  174.  
  175.                                             VBBS 6.12 Documentation -- 10-F-4
  176.  
  177.  
  178.          RETURNFB -> RETURNFB <function block name>
  179.          RETURNSCRIPT -> RETURNSCRIPT <script name>
  180.  
  181.                 If either of these two commands precedes the DOOR command
  182.             the user will be returned to the function block selected OR
  183.             the beginning of the selected script.  If an invalid function
  184.             block name or script name is given it will restore the user to
  185.             the START.FB function block. If you do not have a START.FB then
  186.             the BBS will shut down.
  187.  
  188.  
  189.