pocal 1/3

 BBS: Inland Empire Archive
Date: 04-01-93 (00:05)             Number: 259
From: SCOTT BAILEY                 Refer#: NONE
  To: PAUL CRUTCHFIELD              Recvd: NO  
Subj: pocal 1/3                      Conf: (2) Quik_Bas
In a message dated 28 Mar 93  14:48:21, Paul Crutchfield wrote:

 PC> What is your name? (Then they enter their name..(both sides see it)
 PC>                     (I can backspace a letter if they type it in right
 PC> after they type it in)
 PC> then it does:
 PC>   Hello, (red) <name>!

     Here are a couple SUBs from one of my first doors.  I don't use the
command parser, but I thought I'd write a quick one just to
see how hard it would be, so it may be a little rough.  I
prefer using the COL sub myself.
     Anyway, here goes...
'----Start of pocal.bas----
'ANSI.SYS must be installed
'colour commands must be in lowercase
'for bright colours and blink use col
DECLARE SUB col (A%, f%, b%)
DECLARE SUB pocal (text$, y%, Z%)
DECLARE SUB getkeys (hm%, A$)
DIM SHARED A$, modem, display, baud&, plaintext
'A$ holds answer after a call to getkeys
plaintext = 1   '0=no ANSI
modem = 1
display = 2
baud& = 0 'not online
LOCATE , , 1 'turn cursor on
OPEN "com2:2400" FOR RANDOM AS #modem
OPEN "cons:" FOR OUTPUT AS #display
pocal "@cyanEnter your name:>@magenta", 0, 1
CALL getkeys(32, "")
pocal "", 1, 1 'CR+LF
pocal "@cyanHello @red" + A$ + "@cyan!", 1, 1
col 1, 33, 40'bright yellow on black
pocal "", 1, 1
pocal "Good bye!", 1, 1
'simple menu
'pocal "@greenEnter <@cyanM@green>enu,", 0, 1
'pocal "<@cyanL@green>ook,<@cyanS@green>earch@magenta>", 0, 1
'CALL getkeys(1, "MLS")
'pocal "", 1, 1
'IF A$ = "M" THEN pocal "@blueYou chose Menu", 1, 1
'IF A$ = "L" THEN pocal "@whiteYou chose Look", 1, 1
'IF A$ = "S" THEN pocal "@cyanYou chose Search", 1, 1

SUB col (A, f, b)
'a=attribute:    0=all attributes off
'                1=bold on
'                5=blink on
'                7=reverse video
'f=foreground:   30=black
'                31=red
'                32=green
'                33=yellow
'                34=blue
'                35=magenta
'                36=cyan
'                37=white
'b=background    40=black
'                41=red
'                42=green
'                43=yellow
'                44=blue
'                45=magenta
'                46=cyan
'                47=white
IF plaintext = 0 THEN EXIT SUB
change$ = CHR$(27) + "[" + LTRIM$(STR$(A)) + ";"
change$ = change$ + LTRIM$(STR$(f)) + ";" + LTRIM$(STR$(b)) + "m"
IF baud& THEN                     'if online then
        CALL pocal(change$, 0, 1) 'print to modem and locally
        CALL pocal(change$, 0, 0) 'just print locally
'Continued next message

--- DLG Pro v0.995/DLGMail
 * Origin: Computer Answers, Prince Albert, Sask., Canada (1:140/601)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET