home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / vdocs.zip / VC10 < prev    next >
Text File  |  1993-12-16  |  14KB  |  276 lines

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