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

  1. .TOPIC:                                            
  2. Input & Output Commands
  3.  
  4.                                             VBBS 6.12 Documentation --  10-B-1
  5.  
  6.  
  7.          ╔════════════════════════════════════════════════════════════════╗
  8.          ║  CHAPTER TEN ANNEX B     INPUT AND OUTPUT COMMANDS             ║
  9.          ╚════════════════════════════════════════════════════════════════╝
  10.  
  11.  
  12.          READING INPUT
  13.          ═════════════
  14.  
  15.                One of the most common uses of a script is to get some
  16.            information from a user and the script language contains many
  17.            commands to help implement this task.  All the commands allow
  18.            for a <prompt> string, but this is optional so you do NOT have
  19.            to use it if you do not want to.
  20.  
  21.          GETYN ->  GETYN <variable1> <prompt>
  22.          GETNY ->  GETNY <variable1> <prompt>
  23.  
  24.                These two commands show the user whatever is stored within
  25.            the <prompt> and ask for a response of Y, N, or <enter>.  The
  26.            GETYN command defaults to Y when then user presses <enter> and
  27.            GETNY defaults to N.
  28.            ex: GETYN $yesorno "Do you wish to continue ? "
  29.  
  30.          RS ->  RS <variable1> <prompt>
  31.  
  32.                This command prints the optional <prompt> and then accepts
  33.            a line of input.  The input can be no more than 81 characters
  34.            in length, and input is terminated by pressing <enter>.
  35.            ex: RS $yourname "What is your name ? "
  36.  
  37.          RX ->  RX <variable1> <prompt>
  38.  
  39.                This command works like the RS command but instead of it
  40.            echoing the keys that the user presses it prints X's.  This is
  41.            very useful for password systems.
  42.  
  43.          RW ->  RW <variable1> <prompt>
  44.  
  45.                This command works like the RS command with the only real
  46.            difference being that this command has a word-wrapping feature.
  47.            If a word passes the 80 character point it is word-wrapped over
  48.            to the next input line.  To prevent the extra characters from
  49.            being placed into the next input statement you will need to
  50.            place 'Buffer Clear' after the last RW input line.  See section
  51.            5.x for more info on buffer commands.
  52.  
  53.          RN ->  RN <variable1> <prompt>
  54.  
  55.                This command prints the optional prompt and then accepts
  56.            only numerical input.  It will not take any keys but the #'s
  57.            and input is terminated by pressing <enter>.
  58.            ex: RN $number "Enter your favorite number : "
  59.  
  60.  
  61.                                             VBBS 6.12 Documentation --  10-B-2
  62.  
  63.  
  64.          RC ->  RC <variable1> <prompt>
  65.  
  66.                This command prints the optional <prompt> and then waits
  67.            for a single character to be pressed.  The character is stored
  68.            in <variable1> but it is not shown on the screen.
  69.            ex: RC $onechar "Pick a key, any key : "
  70.  
  71.          RR ->  RR <variable1> <string2> <prompt>
  72.  
  73.                This command operates in the same way as the RC command
  74.            with only one difference.  It will only accept characters that
  75.            are listed in the <string2>, all others will be ignored.
  76.            ex: RR $thisone ARI "A>bort, R>etry, I>gnore ? "
  77.  
  78.          RL ->  RL <variable1> <string2> <value3> <prompt>
  79.  
  80.                This command operates similarly to the RR command.  It will
  81.            accept any character listed in <string2> and also will accept a
  82.            number between 1 and <value3>.  This is the most versatile form
  83.            for getting input, and is most commonly used for creating a
  84.            menu within a script.
  85.            ex: RL $thatone ABC 3 "Choose A, B, C, 1, 2, or 3 : "
  86.  
  87.          RF ->  RF <variable1> <prompt>
  88.  
  89.                This command is used to get a filename as input.  It will
  90.            only accept input in the format 'xxxxxxxx.xxx' with each 'x'
  91.            being a character.  It will only allow legal characters for the
  92.            name and it will not accept globals (* and ?.)  The complete
  93.            list of acceptable characters contains A thru Z (uppercase is
  94.            forced automatically) and the symbols => ! # $ _ - (the => is
  95.            not in the list, it is used only for emphasis.)
  96.            ex: RF $filename "Name of file to be uploaded : "
  97.  
  98.          RI ->  RI <variable1> <prompt>
  99.  
  100.                This command is nearly identical to the RF command.  The
  101.            one difference being that this command accepts the * and ?
  102.            globals in the filename.
  103.            ex: RI $filetoget "Name of file to find (* and ? allowed) : "
  104.  
  105.  
  106.          SHOWING LINE OUTPUT
  107.          ═══════════════════
  108.  
  109.                There are two different ways that you can show output one
  110.            line at a time.  While they are slightly different, both accept
  111.            the same formatting information for their output.
  112.  
  113.          TR ->  TR <token2> <token3> <token4> ... <token7>
  114.          TS ->  TS <token2> <token3> <token4> ... <token7>
  115.  
  116.                These commands can print out up to 6 different tokens using
  117.            a single line.  After the last token on the line is printed the
  118.  
  119.  
  120.                                             VBBS 6.12 Documentation --  10-B-3
  121.  
  122.  
  123.            TR command performs a carriage return/linefeed while the TS
  124.            command does not.
  125.  
  126.            The three formatting statements are listed below.
  127.  
  128.            %s ->  %s<number1> <variable2>
  129.  
  130.                Outputs <variable2> in a field of <number1> spaces and then
  131.            left justifies it.
  132.  
  133.            %i ->  %i<number1> <variable2>
  134.  
  135.                Outputs <variable2> in a field of <number1> spaces and then
  136.            right justifies it.
  137.  
  138.            %d ->  %d<number1>.<number2> <value3>
  139.  
  140.                Outputs <value3> with the format ###.## where <number1> and
  141.            <number2> are the ### and the .## respectively.  The left part
  142.            of the output is padded with spaces and the right is padded
  143.            with 0's.  This format uses the absolute value of <value3>, so
  144.            the output is always a positive number.
  145.  
  146.                You can use any numbers within the statements as long as
  147.            you follow the specified syntax.  If the field selected is too
  148.            small for the variable then the output will be chopped down to
  149.            fit it into the field.
  150.  
  151.            Example:                     Results:
  152.            $a = "Green"
  153.            $b = 16.2312
  154.            tr $b " : " %d3.3 $b         => "16.2312 :  16.231"
  155.            tr %s10 $a ":" %i10 $a       => "Green     :     Green"
  156.            ts $b " : "
  157.            tr $a " : The End"           => "16.2312 : Green : The End"
  158.  
  159.            Note: The quotes are not in the actual output, they are only
  160.                  supplied to emphasize the blank spaces.
  161.  
  162.  
  163.  
  164.          COLORIZATION
  165.          ════════════
  166.  
  167.                 There are three different ways to change color in the
  168.          script language.  All are identical in output, but each has a
  169.          unique form of implementation.  Note: <color code> is the number
  170.          number (0-9) or letter (capital A-Z) code that corresponds to the
  171.          colors as listed in the COLORS.TXT file.  Also, the input commands
  172.          from section 3.1 (RS, RW, RX, etc.) will all change the color to
  173.          to the user's default prompt setting unless the <prompt> has a
  174.          color code within it.
  175.  
  176.  
  177.                                             VBBS 6.12 Documentation --  10-B-4
  178.  
  179.  
  180.          ANSIC ->  ANSIC <color code>
  181.  
  182.                This command is executed on a line by itself and changes
  183.            the effective color to that of the selected <color code>.
  184.  
  185.          $<color> ->  Special
  186.  
  187.                The $color commands are actually individual tokens that
  188.            resemble variable names.  As such, they may be included into
  189.            other strings with the '&' command (section 2.3) or used on
  190.            their own in output statements (TR & TS.)
  191.  
  192.                 $<color>   color code      $<color>   color code
  193.                 --------   ----------      --------   ----------
  194.                 $RED           6           $YELLOW        2
  195.                 $BLUE          7           $MAGENTA       B
  196.                 $GREEN         5           $CYAN          1
  197.                 $WHITE         U           $NORM          0
  198.                 $BLACK        n/a
  199.  
  200.                The command $BLACK makes very dark letters though they may
  201.            be visible, depending on your system configuration.  A common
  202.            use for this is to cover over ANSI music symbols.
  203.  
  204.          Hearts ->  Special
  205.  
  206.                The most frequently used way to change colors is to use
  207.            what has been coined 'Heart-code ANSI.'  The Heart code is the
  208.            ASCII code 3 and can be created in a couple of different ways.
  209.            If your ANSI driver supports the extended ASCII character set
  210.            you can create the 'heart' by pressing the <CTRL> key and the
  211.            <C> key or it can be made by holding down the <ALT> key, then
  212.            press 3 (or 003 or 259) on the number pad and then releasing
  213.            the <ALT> key.  You will have to test this for your particular
  214.            system to see which works for you.  You can also create the
  215.            codes by using the full-screen editor to colorize although this
  216.            can be a bit of work.  Immediately after the 'heart' you place
  217.            the desired <color code> and when the script actually runs,
  218.            VBBS will show the correct color (you will not see the 'heart'
  219.            or the next character after it.)
  220.  
  221.           Example:
  222.              These -----\_______/ANSIC 6
  223.              three      |       \TR "Hello ! " $handle
  224.              pieces     |
  225.              of code    |_______/$stuff = $red & "Hello ! " & $handle
  226.              all do     |       \TR $stuff
  227.              the exact  |
  228.              same thing-/-------<TR "<heart>6Hello ! " & $handle
  229.  
  230.  
  231.                                             VBBS 6.12 Documentation --  10-B-5
  232.  
  233.  
  234.          OTHER DISPLAY COMMANDS
  235.          ══════════════════════
  236.  
  237.          EF ->  EF <pathfile1>
  238.  
  239.                This command displays the contents of the specified file
  240.            in <pathfile1>.  It will pause whenever the users screen fills
  241.            and continue when a key is pressed.
  242.  
  243.          DRAWWAITBAR ->  DRAWWAITBAR <value1>
  244.  
  245.                This command draws a string of green o's surrounded by red
  246.            []'s. The number of o's is equal to <value1>.  The cursor is
  247.            then placed on the first 'o' so you can write over it with
  248.            another character.  See Appendix D for an example.
  249.  
  250.          LOC ->  LOC <value1> <value2>
  251.  
  252.                This command places the cursor at the location equal to the
  253.            (x, y) coordinates that match (<value2>, <value1>).  Legitimate
  254.            values for <value1> are 1-25 and for <value2> are 1-80. This
  255.            only operates for users of ANSI, Enhanced ANSI, and VGIX.
  256.  
  257.          MENU ->  MENU <filename1>
  258.  
  259.                This command displays a menu file stored in your text
  260.            directory (as set in VCONFIG.)  VBBS first checks to see if
  261.            <filename>.MNU exists, and shows it if true.  Otherwise it
  262.            shows <filename>.ANS if the user has ANSI and <filename>.ASC
  263.            otherwise.
  264.  
  265.                The .MNU files are universal text files colorized with
  266.            VBBS' heart-code ANSI colors.  If the user has ANSI then the
  267.            file displays w/ the colors, but if the user does not have
  268.            ANSI then it is displayed without the colors.  You can still
  269.            use .ANS and .ASC menus if you like, however.
  270.  
  271.                If ! is the first character of a line in a menu then VBBS
  272.            will only show the line if the user's security level is greater
  273.            than or equal to the three-digit number that follows the '!'.
  274.  
  275.            Examples:
  276.            !255 S) SysOp Menu  <== Not shown unless the user has SL >= 255.
  277.            !100 F) Forward     <==  "    "     "     "   "    "   " >= 100.
  278.  
  279.          NEWPAGE <---
  280.          SUSPENDPAGEBREAK <---
  281.          RESUMEPAGEBREAK <---
  282.  
  283.                These three commands alter the user's page-break pointer.
  284.            This pointer determines how many lines of text have been viewed
  285.            and the user's screen length (as set in defaults) determines
  286.            when a pause should be used.  NEWPAGE resets the pointer to 0
  287.  
  288.  
  289.                                             VBBS 6.12 Documentation --  10-B-6
  290.  
  291.  
  292.            so the output will scroll for a number of lines equal to the
  293.            value set in the user's defaults.  SUSPENDPAGEBREAK turns the
  294.            use of the pointer off completely (no pauses at all), while
  295.            RESUMEPAGEBREAK turns the pointer back on.
  296.  
  297.          PAUSE ->  PAUSE <prompt>
  298.  
  299.                This displays the optional <prompt> or the default prompt
  300.            as set in VCONFIG.  It then waits for a keypress and erases
  301.            the prompt before continuing.
  302.  
  303.  
  304.