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

  1. .TOPIC:                                            
  2. Script Examples & Explanations
  3.  
  4.                                             VBBS 6.12 Documentation -- 10-J-1
  5.  
  6.  
  7.          ╔════════════════════════════════════════════════════════════════╗
  8.          ║  CHAPTER TEN ANNEX J     SCRIPT EXAMPLES & EXPLANATIONS        ║
  9.          ╚════════════════════════════════════════════════════════════════╝
  10.  
  11.          ╔════════════════════════════════════════════════════════════════╗
  12.          ║ Note:  While all the following scripts were written by other   ║
  13.          ║        authors they have all undergone modification to improve ║
  14.          ║        their clarity and/or add in new features found in 6.12. ║
  15.          ║        The first few scripts are general examples, while the   ║
  16.          ║        later group of scripts are specific examples of some of ║
  17.          ║        the more complex scripting command sequences.           ║
  18.          ╚════════════════════════════════════════════════════════════════╝
  19.  
  20.           Question: How do I figure out if it is a user's birthday?
  21.           Answer: Place this section of code into the script that you
  22.                   wish to have show the birthday greeting.
  23.  
  24.            !=============================================================
  25.            !                       Unknown Author
  26.            !=============================================================
  27.            $bmonth = $birthdate LEFT 2
  28.            $month = $date LEFT 2
  29.            $bday = $birthdate MID 4 LEFT 2
  30.            $day = $date MID 4 LEFT 2
  31.            TESTVAL $bmonth <> $month NOTNOW
  32.            IFVAL $bday = $day THEN
  33.               <place your birthday message here>
  34.            ENDIF
  35.            # NOTNOW
  36.            !=============================================================
  37.  
  38.           Question: I would like to know when I have new messages to be
  39.                     validated for my networked subs when I log on.
  40.           Answer: Place this section of code into your START.V file
  41.                   anywhere before you exit.
  42.  
  43.            !=============================================================
  44.            !          Originally written by Ken 1@8051 VirtualNET
  45.            !=============================================================
  46.            testval $security < 254 nothere
  47.            $found = "VALIDATE.0"
  48.            findfirst $validmsg "c:\vbbs\data\validate.0"
  49.            test $validmsg <> $found nothere
  50.            # again
  51.            tr
  52.            getny $choice " 5New messages to VALIDATE. 6 Validate Now? "
  53.            if $choice = "Y" then
  54.               validate
  55.            endif
  56.            # NOTHERE
  57.            !=============================================================
  58.            !    Note:  This ONLY works for VirtualNET message bases.
  59.            !=============================================================
  60.  
  61.  
  62.                                             VBBS 6.12 Documentation -- 10-J-2
  63.  
  64.  
  65.           Question: How do I set up a simple downloads area for special
  66.                     files like virus scanners and compression utilities?
  67.           Answer: Just edit the following script to show the correct paths
  68.                   and filenames for the files, add in the command to run
  69.                   the script from a function block (ex: G 001 2 SHOPPING).
  70.                   Then all you need to do is create a .MNU file (or a .ANS
  71.                   and .ASC pair) listing the user's choices and place it
  72.                   into your \TXT directory and away you go.
  73.  
  74.            !=============================================================
  75.            !        Originally written by O. F. 1@2056 VirtualNET
  76.            !=============================================================
  77.            Example SHOP.MNU file:
  78.  
  79.                         Available files for quick download are:
  80.                A> ARJ230.EXE    - Newest ARJ Compression Utility
  81.                C> CLEAN102.ZIP  - McAfee Virus Cleaning Utility
  82.                F> FRIES.GIF     - GIF of the lovable '-fries'
  83.                G> GREMLIN.GIF   - GIF of 'The (verbose tagline) Gremlin'
  84.                P> PKZIP204G.EXE - Newest PKZip Compression Utility
  85.                S> SCAN102.ZIP   - McAfee Virus Scanning Utility
  86.  
  87.            !=============================================================
  88.            tr $crlf
  89.            menu shop
  90.            tr $crlf
  91.            rr $selection acfgpsq "Which file would you like ? <Q to quit>"
  92.            IF $selection = a THEN
  93.               DOWNLOAD d:\dloads\compress\arj230.exe
  94.            ELSE
  95.            IF $selection = c THEN
  96.               DOWNLOAD d:\dloads\virus\clean102.zip
  97.            ELSE
  98.            IF $selection = f THEN
  99.               DOWNLOAD d:\dloads\gifs\fries.gif
  100.            ELSE
  101.            IF $selection = g THEN
  102.               DOWNLOAD d:\dloads\gifs\gremlin.gif
  103.            ELSE
  104.            IF $selection = p THEN
  105.               DOWNLOAD d:\dloads\compress\pkz204g.exe
  106.            ELSE
  107.            IF $selection = s THEN
  108.               DOWNLOAD d:\dloads\virus\scan102.zip
  109.            ENDIF
  110.            tr $crlf
  111.            exit start
  112.            ! Make sure the EXIT command above is to a .FB you have !!
  113.            !=============================================================
  114.  
  115.  
  116.                                             VBBS 6.12 Documentation -- 10-J-3
  117.  
  118.  
  119.           Question: How can I enhance the chat call from my users?  I like
  120.                     to know WHY they chatted me, even if I am not around.
  121.           Answer: All you have to do is compile the following script as
  122.                   CHAT.V and then and change the line in your START.FB from
  123.                   'l 001 1 ^pagesysop' to 'l 001 2 chat'.
  124.  
  125.            !=============================================================
  126.            !     Originally written by B. B. Woof 1@5096 VirtualNET
  127.            !=============================================================
  128.            tr "Why do you wish to page " $sysop
  129.            tr
  130.            tr "   >----------------------------------------------------<"
  131.            rs $reason "=> "
  132.            tr "   >----------------------------------------------------<"
  133.            test $reason = "" end
  134.            $tst = $reason LEFT 5
  135.            test $tst = "     " end
  136.            test $available = Y imhere
  137.            tr
  138.            tr $sysop " is not currently available, "
  139.            go feed
  140.            # imhere
  141.            tr
  142.            tr "Paging " $sysop
  143.            do $count = 1 10
  144.                ts " 2< 6< 2< 6* 2> 6> 2> " $bell
  145.            loop
  146.            tr
  147.            tr " Please wait 10 seconds for " $sysop " to respond, "
  148.            tr
  149.            drawwaitbar 10
  150.            do $a = 1 10
  151.               ts "*"
  152.               delay 1
  153.            loop
  154.            tr
  155.            tr $sysop " doesn't seem to be answering..."
  156.            # feed
  157.            getyn $yn "Would you like to leave feedback? (Y/N/enter=yes)"
  158.            tr
  159.            if $yn = Y then
  160.               $s = "     and left feedback as well!"
  161.               feedback
  162.            else
  163.               $s = "     and did not leave feedback!"
  164.            endif
  165.            log $handle ", paged you at " $time " on " $date
  166.            log "Chat reason: " $reason
  167.            log $s
  168.            tr
  169.            # end
  170.            exit start
  171.            ! Make sure the EXIT command above is to a .FB you have !!
  172.            !=============================================================
  173.  
  174.  
  175.                                             VBBS 6.12 Documentation -- 10-J-4
  176.  
  177.  
  178.            !==============================================================
  179.            !     Buffer Example (see Section 5 for command descriptions)
  180.            !==============================================================
  181.            ! EMAIL.V   This sends an E-mail to the Sysop.  To do this we
  182.            !           create a form letter in the buffer and then write
  183.            !           the buffer contents to an E-mail addressed to the
  184.            !           Sysop #1 account.  Note the '!' are comment lines.
  185.            !
  186.            !                     Create the form letter
  187.            $Line1 = $Sysop & ","
  188.            $Line2 = "  I'm a new user and would really appreciate it"
  189.            $Line3 = "if you would validate my account."
  190.            $Line4 = "  Thanks!"
  191.            $Line5 = "     " & $Handle
  192.            !                     Clear out any existing buffer contents
  193.            Buffer Clear
  194.            !                     Write the text lines to the Buffer
  195.            Buffer Append $Line1
  196.            Buffer Append $Line2
  197.            Buffer Append $Line3
  198.            Buffer Append $Line4
  199.            Buffer Append $Line5
  200.            !                     Position to the E-mail database
  201.            SetEmail
  202.            !                     Save the buffer as E-mail to the sysop #1
  203.            Save 1 $Node "Validation Request" 0 "" 1
  204.            !                     Clear out the buffer again
  205.            Buffer Clear
  206.            !==============================================================
  207.  
  208.  
  209.                                             VBBS 6.12 Documentation -- 10-J-5
  210.  
  211.  
  212.            !==============================================================
  213.            !     File Editing Example (see Section 6 for command desc.)
  214.            !==============================================================
  215.            !  READ.V - Some examples of writing and reading from the
  216.            !           buffer file.
  217.            !
  218.            $Where = $port                        ! this selects the buffer
  219.            $File = "c:\vbbs\b" & $where & ".tmp" ! for the node you're on
  220.            !
  221.            !  Check to see if the file is there; if so, delete it.
  222.            CHECKFILE $Len $File
  223.            IFVAL $Len > 0 Then
  224.               KILL $File
  225.            ENDIF
  226.            !  Build an new one, add one line, then close it.
  227.            OPEN $File OUTPUT
  228.               WRITE "Your Handle : " $handle
  229.            CLOSE
  230.            !  Now open it, add data to the end of it, then close it again.
  231.            OPEN $File APPEND
  232.               WRITE "The BBSName : " $bbsname
  233.               WRITE "Your Baud Rate : " $baud
  234.               WRITE "The Sysop's Name : " $sysop "  and the time : " $time
  235.            CLOSE
  236.            !  Now re-open it, read the data back, print it, and close it.
  237.            OPEN $File INPUT
  238.            # Tag
  239.               READ $Line
  240.               TEST $Line = "!EOF!" End
  241.               TR $Line
  242.               GO Tag
  243.            # End
  244.            !  Now close and remove the file
  245.            CLOSE
  246.            KILL $File
  247.            !==============================================================
  248.  
  249.                 With very little work you could actually write an editor
  250.            using the combination of the BUFFER commands and the commands
  251.            above.  The options are limitless once you set your mind to it.
  252.  
  253.  
  254.                                             VBBS 6.12 Documentation -- 10-J-6
  255.  
  256.  
  257.            !=============================================================
  258.            !     Control Example (see Section 7 for command descriptions)
  259.            !=============================================================
  260.            !  Waiting.V - This is a small script to force the user to
  261.            !              do nothing for 30 seconds.  It is also an
  262.            !              example of how to use the various control
  263.            !              structures to accomplish the same goals.
  264.            $x = 1
  265.            $y = 0
  266.            CALL drawit                      !----------------------------
  267.            DO $a = 1 10                     !  These
  268.               CALL slowit                   !    three
  269.            LOOP                             !      lines
  270.            CALL drawit                      !----------------------------
  271.            # again                          !  And
  272.            IFVAL $x < 11 THEN               !    \
  273.               CALL slowit                   !    all
  274.               $x = $x + 1                   !      \
  275.               GO again                      !      nine
  276.            ELSE                             !        \
  277.               GO notagain                   !         of
  278.            ENDIF                            !          \
  279.            # notagain                       !           these
  280.            CALL drawit                      !----------------------------
  281.            # lastone                        !  And
  282.               CALL slowit                   !    \
  283.               $y = $y + 1                   !    these
  284.               TESTVAL $y = 10 alldone       !       \
  285.               go lastone                    !        five
  286.            # alldone                        !----------------------------
  287.               exit start                    !  do the same thing
  288.            # drawit                         !----------------------------
  289.               TR
  290.               DRAWWAITBAR 10
  291.            RET
  292.            # slowit
  293.               DELAY 1
  294.               TS "*"
  295.            RET
  296.            !=============================================================
  297.  
  298.  
  299.