home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
DOOR
/
CONC_003.ZIP
/
TUTOR.ARJ
/
TUTOR5.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-07-15
|
3KB
|
112 lines
{$A+,B-,I-,Q-,R-,S-}
{$F+} { Force Far calls }
{$X+} { Extended Syntax }
USES
DoorKit, IO, IO_FX, Scripts, Types, xStrings,
{ Color systems }
_ANSI, { . . . . . . . . . . . . . . . . . . . ANSI support }
_ATCodes, { . . . . . . . . . . PCBoard and WildCat at-colors }
_AVATAR, { . . . . . . . . . . . . . . . . . . AVATAR support }
_HexPipe, { . . . . . . . . . . . . . . . . . . HexPipe system }
_LORDCLR, { . . . . . . LORD [Legend of the Red Dragon] colors }
_RACOLOR, { . . . . . . . . . . . . . . RemoteAccess ^K colors }
{ Extra features }
_Chat, { . . . . . . . . . . . . . . . . . . Cool chat-mode }
_Control, { . . . . . . . . . . . . . . . . . . Control codes }
_Errata, { . . . . . . . . . . . . . Run-time error handling }
_IO, { . . . . . . Various I/O script commands (i.e. CLS) }
_Macros, { . . . . . . . . . . . . . . . . . . . Text Macros }
_Params, { . . . . . Sysop-definable command-line parameters }
_Release, { . . . . . . . . . . . . . . . Time-slice releaser }
_SO, { . . . . Allows use of WriteLn via SO virtual file }
_Status, { . . . . . . . . . . . Sysop-definable status lines }
{ I/O drivers }
_FOSSIL, { . . . . . . . . . . . . . . . . . . FOSSIL support }
_CRT; { . . . . . . . . Local I/O using Borland's CRT unit }
CONST
TooBig : STRING[80] = 'Too big, bird brain.';
TooLow : STRING[80] = 'Too low, dog breath.';
Winner : STRING[80] = 'Huh? Must have been a fluke.~p';
Results : STRING[80] = 'It took ya {tries} times.';
{^^^^^}
{ Look at this carefully. }
VAR
Entry : STRING[3];
Number : Byte;
Tries : Byte;
BEGIN
{ Setup door }
ProgName := 'Guess It';
Version := '1.0';
Copyright := '(c) ''81 Billy Bob Gates: I shall crush you.';
Script('Init');
{ Expand the script language with a few variables }
RegisterString('TooBig', @TooBig, SizeOf(TooBig)-1);
RegisterString('TooLow', @TooLow, SizeOf(TooLow)-1);
RegisterString('Winner', @Winner, SizeOf(Winner)-1);
RegisterString('Results', @Results, SizeOf(Results)-1);
{ │ │ │
│ │ └ Maximum length of the string.
│ └───────── Address of the string.
└──────────────────── Name of the script variable (case
does not matter. The name does not
have to be the same as the name of
the associated variable in your
program. }
RegisterByte ('Number', @Number);
RegisterByte ('Tries', @Tries);
SO_ClrScr;
Randomize;
Number:=Random(100)+1;
REPEAT
Write(SO,'Enter your guess: ');
Entry:='';
SI_String(Entry,3,True);
IF StrToInt(Entry)=Number THEN
BEGIN
WriteLn(SO,'{Winner}');
Halt;
END
ELSE
BEGIN
Inc(Tries);
IF StrToInt(Entry)>Number THEN
WriteLn(SO,'{TooBig}')
ELSE
WriteLn(SO,'{TooLow}');
END;
UNTIL False;
END.