home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 2
/
FFMCD02.bin
/
new
/
amigalibdisks
/
disk950
/
bbdoors
/
bbdoors65.lha
/
rexxDoors
/
StarTrek.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-08-24
|
36KB
|
1,462 lines
/* STAR TREK - THE FINAL FRONTIER - Online BBS Game
Written By Steve Berry
Rev A - 4/24/87 IBM 370
Rev B - 5/21/88
modified to run on Amiga
Rev C - 10/23/91
modified to run from CLI or BBBBS
also updated enemy from Klingons to Romulans
Mods for Atredes by Bob Hassel and Michael Cox
ANSI version & other enhancements by Michael Cox
BBBBS mods by Richard Lee Stockton
3 bugs fixed August 24,1993 by Charles Johnston
(1) Saved games would not survive a reload - FIXED
(2) After torpedos were used up one could continue firing them - FIXED
(3) After phasers were used up one could continue firing them -FIXED
*/
CALL TIME('R')
SIGNAL ON BREAK_C
bbspath=GETCLIP('BBS_path')
PARSE ARG UName . . . secs .
IF secs='' THEN secs=3600
gamepath=''
IF UName~='' & bbspath~='' THEN gamepath=bbspath'rexxDoors/Data/'
maxtime=5000
justcleared='true'
highest=0
highname=0
HOM='H'
RESET=''
POS='0H'
CLS='H'
CLR=''
CLL=''
WHITEONBLUE='
'
REDONBLUE='
'
YELLOWONBLUE='
'
CYANONBLACK='
'
YELLOWONBLACK='
'
MAGENTAONBLACK='
'
BLUEONBLACK='
'
REDONYELLOW='
'
WHITE='
'
RED='
'
YELLOW='
'
BLACK='
'
GREEN='
'
CYAN='
'
MAGENTA='
'
BLUE='
'
IF ADDRESS()~='BAUD' THEN
DO
BLUE=GREEN
WHITEONBLUE='
'
REDONBLUE='
'
YELLOWONBLUE='
'
END
call time 'R' /* reset timer */
do i=1 to 10
highscore.i=0
highname.i=' '
end
stardate=time('E')
junk=randu(time('S'))
blanks=' '
call old_highest
CALL mess CLS
CALL mess BLUE||' Welcome to STARTREK!'
CALL mess
CALL mess YELLOW||' TOP TEN PLAYERS'
CALL mess WHITE
do i=1 to 10
if highscore.i=0 then iterate
CALL mess substr(blanks,1,20) highname.i substr(blanks,1,30-length(highname.i)) RIGHT(highscore.i,6)
end
CALL mess CYAN
CALL mess ' (You need an ANSI-compatible terminal to play this game.)'
CALL mess
OPTIONS PROMPT ' Do you need instructions (y/N)? '
PULL res
if res='Y' then
call instructions
else
do /* Anyone ever heard of BRACKETS? */
CALL mess
CALL mess 'You can get the instructions at any time by entering the word HELP.'
OPTIONS PROMPT 'Hit [RETURN] to continue: '
PULL res
end
CALL mess CLS
CALL mess
CALL mess
OPTIONS PROMPT 'Load and play an old game (y/N)? '
PULL fn
CALL mess CLS
mission=1
/* Are we playing an OLD Game? */
if fn='Y' then
call load_old_game fn
else
newmission:
CALL mess 'Please stand by... universe under construction'
select
when mission=1 then call init_variables_1
when mission=2 then call init_variables_2
when mission=3 then call init_variables_3
when mission=4 then call init_variables_4
when mission=5 then call init_variables_5
when mission=6 then call init_variables_6
when mission=7 then call init_variables_7
when mission=8 then call init_variables_8
when mission=9 then call init_variables_9
when mission=10 then call init_variables_10
/* otherwise */
end
/* ********** */
/* Main do loop */
/* ************ */
main: /* added this function name so 'load_old_game:' could signal to it*/
starttime=stardate
CALL mess CLS
do until energy=0
CALL checkBBS()
CALL mess HOM
call print_quadrent x,y,ex,ey
t0=time('R')
/* get user input and parse the commands */
if stardate - starttime > maxtime then call toolong
OPTIONS PROMPT 'Your command, Captain? '
PULL instring
rc=parse_command(instring)
/* process the commands */
if rc=0 then do
do loop=1 to 3
if arg1.loop='' then leave
call process_command arg1.loop,arg2.loop
if alive='no' | energy <= 0 then leave
end
end
else CALL mess "Command not understood. Enter HELP for reminder."
/* Check for illegal input */
if missstat='completed' then do
CALL mess CLS
CALL mess
CALL mess ' CONGRATULATIONS !!! You have completed the mission!'
CALL mess
exit 0
end
/* Did player kill himself? */
If alive='no' | energy <= 0 then do
CALL mess CLS
CALL mess
CALL mess
CALL mess
CALL mess
CALL mess ' Suicide is not in the BEST interests of the FEDERATION.'
CALL mess
CALL mess ' But you did get 'points' points.'
CALL mess
CALL mess
CALL mess
CALL mess 'Game over.'
CALL mess
CALL mess
exit
end
/* Time for a little wear and tear on the enterprize */
call wear_and_tear
/* Is the Enterprize DEAD in Space? */
If alive='no' then do
CALL mess CLS
CALL mess
CALL mess
CALL mess
CALL mess
CALL mess ' Sorry but you let the Enterprise deteriorate into '
CALL mess ' into a rusting hunk of space debris.'
CALL mess
CALL mess ' But you did get 'points' points.'
CALL mess
CALL mess
CALL mess
CALL mess 'Game over.'
CALL mess
CALL mess
exit
end
/* Ok. now it's the Bad guy's turn */
/* now call mission specific routine */
/* for bad guy routine and points awarded */
select
when mission=1 then call mission1
when mission=2 then call mission2
when mission=3 then call mission3
when mission=4 then call mission4
when mission=5 then call mission5
when mission=6 then call mission6
when mission=7 then call mission7
when mission=8 then call mission8
when mission=9 then call mission9
when mission=10 then call mission10
end
/* Is the Enterprize KILLED? KRUSHED? DESTROYED? */
If alive='no' then do
CALL mess
CALL mess
CALL mess
CALL mess
CALL mess ' Sorry but you let your crew and the Federation down.'
CALL mess ' Perhaps you should consider another career.'
CALL mess
CALL mess ' But you did get 'points' points.'
CALL mess
CALL mess
CALL mess
CALL mess 'Game over.'
CALL mess
CALL mess
exit
end
/* end of the loop - now go print the screen */
end
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE SECTION */
/* ********************************************** */
/* ********************************************** */
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE LOAD_OLD_GAME */
/* PASSED VALUES - fn */
/* ********************************************** */
/* ********************************************** */
load_old_game:
bstr=' |o| * <->(B))\_ # '
missstat='not yet'
CALL mess 'Loading your previously saved game...'
/* get variables */
if ~Open(fnn,gamepath||UName,'R') then
do
CALL mess "Can't find a saved game for you! Exiting STARTREK."
exit
end
inn=Readln(fnn)
parse var inn stardate mission energy points x y ex ey shields klshields docked kltot
inn=Readln(fnn)
parse var inn status.0 status.1 status.2 status.3 status.4 status.5
/* start interval timer */
stardate=stardate + time('E')
/* Load galactic map */
do l=0 to 9
inn1=Readln(fnn)
parse var inn1 map.l.0 map.l.1 map.l.2 map.l.3 map.l.4 map.l.5 map.l.6 map.l.7 map.l.8 map.l.9
end
do l=0 to 9
inn1=Readln(fnn)
parse var inn1 quad.l.0 quad.l.1 quad.l.2 quad.l.3 quad.l.4 quad.l.5 quad.l.6 quad.l.7 quad.l.8 quad.l.9
end
alive='yes'
junk=Close(fnn)
signal main /* bug fix so old game is loaded properly and not overwritten as fresh game*/
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE INIT_VARIABLES_1 */
/* PASSED VALUES - none */
/* ********************************************** */
/* ********************************************** */
init_variables_1:
bstr=' |o| * <->(B))\_ # '
alive='yes'
energy=1000000
x=0
y=0
points=0
mission=1
shields='down'
kltot=0
missstat='not yet'
do a=0 to 9
do b=0 to 9
map.a.b=random(0,1) * 100 + random(0,1)*10 + random(0,9)
if map.a.b > 99 then kltot=kltot + 1
end
end
klshields=5000
status.0=0
status.1=0
status.2=0
status.3=0
status.4=0
status.5=0
ex=5
ey=4
newscreen:
/* initialize quadr