home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / v611docs.zip / VMAIN611.ZIP / VC10 < prev    next >
Text File  |  1993-10-08  |  14KB  |  273 lines

  1.                                             VBBS 6.11 Documentation --  10-1
  2.  
  3.  
  4.          ╔════════════════════════════════════════════════════════════════╗
  5.          ║ CHAPTER TEN        VIRTUAL SCRIPT LANGUAGE <VSCRIPT>           ║
  6.          ╚════════════════════════════════════════════════════════════════╝
  7.  
  8.          SCRIPT LANGUAGE INTRODUCTION
  9.          ════════════════════════════
  10.  
  11.                 One of the features that makes VBBS unique is its script
  12.          language compiler - VCOM.EXE.  Along with the built-in command
  13.          interpreter in VBBS, it allows you to make changes to your BBS
  14.          quickly and easily.  The scripts are nothing more than a series
  15.          of commands listed in a plain ASCII text file, and you don't
  16.          even need to be a programmer to write one.  All you need to cre-
  17.          ate scripts are a text editor or word processor that allows you
  18.          to save in ASCII format (see your word processor documentation
  19.          for more info) and a little patience.  In no time, you will be
  20.          writing up scripts and swapping them with other VBBS sysops like
  21.          a pro. Scripts are generic to both the DOS and OS/2 versions.
  22.  
  23.  
  24.          GENERAL RESTRICTIONS
  25.          ════════════════════
  26.  
  27.                 The VBBS script language has only one major restriction;
  28.          there can only be a total of 7 'tokens' on a line.  A token is
  29.          defined as either a single unspaced series of characters (for
  30.          example, a command or a number) or any group of characters and
  31.          spaces surrounded by single or double quotes (also called a
  32.          "string".)  The script language is NOT case-sensitive; any
  33.          capitalization used in this text is not required and is done
  34.          only for clarity.
  35.  
  36.                 All the scripts that you create should be placed into your
  37.          scripts directory as defined in VCONFIG - PATHS Configuration;
  38.          see Chapter 2 for more information on setting your paths.
  39.  
  40.                 The only other restrictions pertain to names.  All of your
  41.          script files MUST have the extension .V and all of your names
  42.          for variables must begin with a '$', e.g., $variable.
  43.  
  44.  
  45.          SCRIPT COMPILER (VCOM.EXE)
  46.          ══════════════════════════
  47.  
  48.                 The program VCOM.EXE is the compiler that prepares your
  49.          script file for use by VBBS's interpreter.  It takes the script
  50.          file that you have created and builds the two files that VBBS
  51.          actually uses from it.  These two files have the same name as
  52.          the script file but have .LIT and .COD as their extensions.
  53.  
  54.                 Compilation of a script is accomplished by changing to
  55.          your scripts directory and executing the command line:
  56.  
  57.                 VCOM <script name>
  58.  
  59.  
  60.  
  61.                                             VBBS 6.11 Documentation --  10-2
  62.  
  63.  
  64.          You do not need to use the extension to compile the script.
  65.          The compiler can detect some errors in the script file during
  66.          the compilation.  These errors are predominantly related to the
  67.          commands that 'jump' around within a script.  These commands
  68.          are GO, TEST, TESTVAL, CALL, and BREAK.  If an error is found
  69.          the compiler will abort and you will need to go into your
  70.          script to correct the error.
  71.  
  72.  
  73.          COMMAND FORMAT
  74.          ══════════════
  75.  
  76.                 All commands will be listed in the form:
  77.  
  78.                     Command Name ->  Command Syntax.
  79.                              <description of command here>
  80.  
  81.          The following conventions will be used in all command syntax
  82.          in this document:
  83.  
  84.            COMMAND     - All commands will be in capitals and must be
  85.                          typed in the format shown (see the note below.)
  86.            <label>     - A single word, no quotes or spaces.
  87.            <variable#> - Any variable name (only).
  88.            <number#>   - Any numeric value (only).
  89.            <string#>   - A string value ("aBc 123") or any variable name.
  90.            <value#>    - A numeric value or any variable name that is
  91.                          used to store numeric values.
  92.            <pathfile#> - A legal DOS filename including path information.
  93.                          If the path is excluded it will default to the
  94.                          BBS' main directory.  A variable that stores the
  95.                          correct path/filename info may also be used.
  96.            <filename#> - A legal DOS filename excluding path information.
  97.                          Commands that use this have the path info set
  98.                          automatically.  A variable that has the filename
  99.                          stored in it may also be used.
  100.            <prompt>    - Either a text string or a variable name.  Most
  101.                          of these are optional, so use them only if you
  102.                          want them.
  103.            <relation>  - Any of the following, but see the specific com-
  104.                          mand for verification:
  105.  
  106.                            = Equal to         <> Not equal to
  107.                            > Greater than     >= Greater than or equal to
  108.                            < Less than        <= Less than or equal to
  109.  
  110.            <option>    - The value of this item is command-specific.
  111.            <token#>    - Any single item; see section 1.2 for a complete
  112.                          definition of a token.
  113.  
  114.            Note: If the command name is followed by a '<---' then the
  115.                  syntax for the command is just the command name.
  116.  
  117.  
  118.  
  119.                                             VBBS 6.11 Documentation --  10-3
  120.  
  121.  
  122.          SPECIAL VARIABLES/CONSTANTS
  123.          ═══════════════════════════
  124.  
  125.                 The script language contains the following restricted
  126.          variables, which are read-only:
  127.  
  128.            $AGE       - Age of user.
  129.            $ANSI      - Stores the user's current graphics setting.  Set
  130.                         to OFF if using ASCII, ON if using ANSI, and ENH
  131.                         if using PDM's.
  132.            $AVAILABLE - Stores the sysop availability flag. Y if sysop is
  133.                         available, N if not.
  134.            $BAUD      - Stores the user's connect speed.
  135.                         Returns "" if logged into node 0 (or other local
  136.                         node) and returns "CONSOLE" if logged in locally
  137.                         from the WFC screen.
  138.            $BBSNAME   - Stores the BBS' name, as shown in VCONFIG.
  139.            $BELL      - Stores ASCII code 7, causes a beep when printed.
  140.            $BIRTHDATE - User birthdate in same format as $DATE.
  141.            $BS        - Stores ASCII code 8, causes the cursor to back up
  142.                         1 space on current line when printed.  It is not
  143.                         a destructive backspace.
  144.            $CLEAR     - Stores <CTRL>-<L> for ASCII users, stores the ANSI
  145.                         clear screen code for others when printed.
  146.            $<color>   - These nine variables are reserved as color codes:
  147.                         $RED, $BLUE, $CYAN, $GREEN, $YELLOW, $MAGENTA,
  148.                         $WHITE, $BLACK, and $NORM.  See section 3.3 for
  149.                         more information.
  150.            $CR        - Stores ASCII code 13, causes a carriage return
  151.                         when printed (moves to column 1, current line.)
  152.            $CREDITS   - Number of credits user has.
  153.            $CRLF      - Causes both a $CR & $LF when printed (moves to
  154.                         column 1 of the next line.)
  155.            $DATE      - Stores the current system date as MM-DD-YYYY.
  156.            $EXTRAx    - The users extra variables values are stored in
  157.                         $EXTRA1 thru $EXTRA8.  They can be changed with
  158.                         the SETEXTRA command.  See section 8.2 for info.
  159.            $FLAGS     - This contains the list of all active general
  160.                         flags of the current user.  Use the INSTR command
  161.                         with $FLAG and you will know if a particular flag
  162.                         is on if the result is non-zero.  You can change
  163.                         the value of a flag with the SETFLAG command.  See
  164.                         section 8.2 for info.
  165.            $HANDLE    - User's handle.
  166.            $LF        - Stores ASCII code 10, causes a linefeed when it's
  167.                         printed (same column position, next line.)
  168.            $MAXTIME   - Maximum minutes per day.
  169.            $NAME      - User's real name.
  170.            $NODE      - Stores your VirtualNET node # as set in VCONFIG.
  171.                         Default is 0 if you are not in VirtualNET.
  172.            $PAGE      - Number of lines to print before pause.
  173.            $PORT      - Returns present channel # of user (not COM port!)
  174.            $SECURITY  - User's security level, 250 and up is considered
  175.                         Co-sysop/Sysop access.  Use TESTVAL and this
  176.                         variable to implement your own security.
  177.  
  178.  
  179.                                             VBBS 6.11 Documentation --  10-4
  180.  
  181.  
  182.            $SYSOP     - Stores the sysop's name as set in VCONFIG.
  183.            $TEXTPATH  - Stores the path to your TXT directory.
  184.            $TIME      - Stores the current system time.
  185.            $TIMELEFT  - Number of minutes left for this session.
  186.            $TIMEON    - Number of minutes on for this session.
  187.            $TIMESON   - Total number of logons for the user.
  188.            $TOTALMIN  - Total number of minutes on since first logon.
  189.            $USER      - User's account number.
  190.            $VIDEOMODE - This stores values similar to $ANSI, only they are
  191.                         #'s instead of words.  Set to 0 if using ASCII, 1
  192.                         if using ANSI, 2 if using PDM's, and 3 if using
  193.                         VGIX.
  194.  
  195.  
  196.          INTERFACING WITH VBBS
  197.          ═════════════════════
  198.  
  199.                There are only two ways that you can run a script. You can
  200.          either run the script from a function block or LINK to it from
  201.          another script.  The former is covered here and the latter is
  202.          covered in section 7.3 - Passing Control.
  203.  
  204.                 Go into the function block you wish to have run the script
  205.          and add the following line on any but the first two lines in the
  206.          .FB file:
  207.  
  208.            Z 001 2 Scripter
  209.            |  |  |   ^------This is the script name, NO extension.
  210.            |  |  ^----------This is the code to tell VBBS it is running a
  211.            |  |             script
  212.            |  ^-------------This is the SL to be able to use the key (and
  213.            |                run the script.)
  214.            ^----------------This is the key to press at the menu to load
  215.                             and run the script.
  216.  
  217.  
  218.          PREPACKAGED SCRIPTS
  219.          ═══════════════════
  220.  
  221.          --> IMPORTANT NOTE:  This section is best read after reading
  222.                               through the entire file but is included here
  223.                               to maintain the structure of this document.
  224.                               Do not let the unknown terms interfere with
  225.                               your reading, as they will all be explained
  226.                               elsewhere.
  227.  
  228.                 There are many script authors out in the BBSing community
  229.          that have written all sorts of scripted programs to perform prac-
  230.          tically everything you could ever want.  The most difficult part
  231.          of using a script is knowing how to install it.  What you should
  232.          do first is pull up the script and look for comments that explain
  233.          the script.  Some will contain complete sets of instructions,
  234.          while others will contain no comments at all.  If the script con-
  235.          tains few or no comments, then what you will need to do is:
  236.  
  237.  
  238.                                             VBBS 6.11 Documentation --  10-5
  239.  
  240.                 1> Make sure that all EXIT and LINK statements point to
  241.                    FB's or scripts that you actually have. If all else
  242.                    fails you can set all of these statements to EXIT
  243.                    to your main FB file (see VBBS.DOC for information.)
  244.                 2> Look for any statements that use file commands.  Be
  245.                    sure to change these to valid paths on your system.
  246.                 3> See if the script has any RET lines.  If it does,
  247.                    try to find the CALL statements to the labels that
  248.                    appear a few lines before the RET.
  249.  
  250.          After you have done these steps you will then have the info you
  251.          need to determine how the script should be used.  If the script
  252.          has no EXIT or LINK statements, or the script has a RET line with
  253.          no CALL statement, then you must make the script part of an exis-
  254.          ting one.  The easiest way to do this is to just block-copy the
  255.          entire script in before your final EXIT or LINK statement in your
  256.          script if it has no unmatched RET statements.
  257.  
  258.                 If there is an unmatched RET statement, then installing
  259.          the new script is even easier.  Somewhere in your script you need
  260.          to add a CALL <label> statement with <label> being the label at
  261.          the start of the new script.  Then just add as the last line of
  262.          your script the line '& <script name>'.  You should be able to
  263.          compile and run it at this point.  Just remember, 'Nothing is
  264.          Guaranteed!', so if you have a problem with a script and you
  265.          can't get it to work try to either pick the code apart (if you
  266.          can) or hop onto any VirtualNet BBS that carries a script dis-
  267.          cussion sub and ask a few questions (or a few hundred, as
  268.          needed.)  One of the script gurus may be able to help you out,
  269.          and you might even be able to get in touch with the author.
  270.  
  271.  
  272.  
  273.