{e} %externalroutine rats(%string (255) s) !d! %begin %externallongrealfnspec cputime %externalrealfnspec random(%integername i, %integer n) %externalstring (255) %fnspec time %externalroutinespec terminate %routinespec engage random(%integer n) %routinespec pepos(%integer x, y) %%integer %fn %spec test door %externalroutinespec prompt(%string (17) s) %ownbyteintegerarray door(10:66) = 0, 2, 3, 4, 1, 1, 1, 0, 0, 0, 0, 2, 3, 4, 5, 1, 1, 0, 0, 0, 0, 6, 3, 7, 1, 1, 1, 0, 0, 0, 0, 6, 3, 8, 1, 1, 1, 0, 0, 0, 0, 6, 3, 1, 1, 1, 1, 0, 0, 0, 0, 7, 3, 1, 1, 1, 1 ! 0 - error, 1 - door is open ! 2 - electrified, ! 3 - locked ! 4 - monofilament criss-cross - take alertness check ! 5 - anti - decompression door ! 6 - gas spurts from jamb ! 7 - on c-deck door is open, otherwise 4 ! 8 - drenching with water %conststring (11) %array room desc(1:6) = %c "Industrial", "Service", "Corridor", "living", "Accessway", "Computer" %constbyteintegerarray room d(0:6) = %c ' ', 'I', 'S', 'C', 'L', 'A', 'M' %constinteger smgn=4, smgunln = 8, smgammo = 11 %constinteger narts = 20 %ownstring (19) %array articles(-1:narts) = %c "box", "", "lockpick", "gloves", "cutter", "smg", "laser rifle", "laser pistol", "expl gren", "smg (unl)", "laser rif(unl)", "laser p(unl)", "smg ammo", "laser r power", "laser p power", "bot slaver", "pep pills", "bottle of scotch", "reflective suit", "vacuum suit", "armoured suit", "mono solvent" %ownbyteintegerarray cost(1:narts) = %c 1, 1, 4, 5, 5, 3, 2, 2, 2, 1, 2, 2, 1, 3, 2, 1, 7, 2, 7, 1 %ownbyteintegerarray goodies(1:31) = %c 1, 2, 3, 7, 1, 11, 12, 13, 14, 15, 16, 18, 20, 11(6), 12(6), 13(6) %constinteger cmin = -6, cmax = 6 %ownstring (15) %array character(cmin:cmax) = %c "maid", "garcon", "bouncer", "guardian", "securibot", "hired gun", "me", "rina", "putz", "stark", "trina", "woloski", "corona" %ownbyteintegerarray h to ha(cmin:cmax) = %c 2, 3, 9, 0, 8, 9, 4, 2, 3, 3, 4, 2, 4 %ownbyteintegerarray h to hd(2:12) = %c 0(5), 1, 1, 1, 2, 2, 2 %ownintegerarray weapon(cmin:cmax) = 0, 0, 0, 6, 5, 5, 0, 5(*) %ownintegerarray suitf(0:15) = 0(*) %ownintegerarray dead(0:cmax) = 1(*) %constinteger comms = 17 %conststring (11) %array comm(1:comms) = %c "l", "r", "u", "d", "left", "right", "up", "down", "picture", "use", "i", "inventory", "get", "drop", "open", "take", "give" %constbyteintegerarray n weapa(0:narts) = %c 0, 0, 0, 0, 1, 2, 3, 4, 0(6), 5, 0(*) %owninteger nenemy %ownintegerarray enemy(1:10) = 0(*) %owninteger friend = 0 %ownintegerarray frienda(0:15) %ownintegerarray invent(1:10) = 0(*) %owninteger around = 0 %ownintegerarray around item(1:10) %switch sw(1:comms) %constintegerarray gas gren(2:12) = %c 0, 1(6), 2, 1, 2(*) %constintegerarray slug(2:12) = %c 0(5), 1(2), 2(*) %constintegerarray expl gren(2:12) = %c 0(4), 2, 0, 2, 1, 2(*) %constintegerarray laser pistol(2:12) = %c 0(6), 1, 2(*) %constintegerarray elect prod(2:12) = %c 0(3), 1(3), 2(*) %constintegerarray gas gun(2:12) = %c 0(5), 1, 0, 1, 2(*) %constintegerarray laser(2:12) = %c 0(4), 2, 1, 2(3), 1, 2(*) %constintegerarray smg(2:12) = %c 0, 1(4), 2, 1, 2(*) %ownbyteintegerarray side(0:596) = 0(*) %ownbyteintegerarray desc(0:596) = 0(*) %ownbyteintegerarray dd(0:6) = %c 'd', ' ', '-', 'l', 'e', 's', 'm' %integer deck, sqx, sqy, posx, posy, refx, top, sqv %owninteger lastx, lasty, bugout %owninteger me = 0, life = 75, to hand = 0 %owninteger my posx = -1, my posy = -1 %owninteger current room = 0 %owninteger disbelief = 75, alertness = 9, suit ok = 0 %owninteger n control bot = 0 %string (255) t, u !D! %string (255) s %constinteger esc = 27 %owninteger term type = 'L' %integer %fn %spec laser cutter %routinespec war(%integer whoi, pos) %integer i, j, alert %ownintegerarray test ran(0:6) = 0(7) %routine delay(%integer secs) %integer i {e} %externalintegerfnspec ddelay(%integer s) {e} i = ddelay(secs) !d! alarm(secs*60) !d! p_ser=0; poff(p) %end %routine psym(%integer x) printch(x) %end %routine pepos(%integer x,y) ! nb: in this one, x is accross and y is vertical %if term type = 'P' %start psym(esc); psym('Y'); psym(x+31) psym(esc); psym('X'); psym(y+31) %finish %else %start %if term type = 'N' %start psym(x'16'); psym(x+' '-1); psym(y+' '-1) %finishelsestart psym(24) %IF y # 11 %THENSTART psym(y-1); psym(x-1) %FINISHELSESTART psym(9); psym(x-1); psym(11) %FINISH %finish %finish %end %routine pecline(%integer y) %if term type = 'P' %start pepos(1,y) psym(esc); psym('I') %finish %else %start %if term type = 'L' %start pepos(1, y-1); newline %finish %else %start pepos(1, y) psym(25) %finish %finish %end %routine peclear %integer i %if term type = 'P' %start psym(esc); psym('K') %finish %else %start %if term type = 'N' %start psym(x'1d'); psym(x'1f') %finishelsestart psym(1); terminate psym(127) %for i = 1, 1, 10; terminate %finish %finish terminate %end %integerfn randomize(%integer range) %integer i, j %string (23) ti %owninteger init = 0 %owninteger start = 123457 %longreal res,last %if init = 0 %start init = 1 ti = time i = charno(ti,8)-'0'+1 start = start*i*2+1 %finish res = random(start, 1) %result = intpt(res * range + 1) %end %integer %fn roll %integer i %result = randomize(6) %end %integer %fn double roll %integer x, y x = roll; y = roll %result = x*10+y %end %routine skip to end %integer i %cycle readsymbol(i); %return %if i = nl %repeat %end %integer %fn get sym %integer i, j readsymbol(i) %if 'A' <= i <= 'Z' %then i = i-'A'+'a' %result = i %end %integer %fn get yn %integer i, j, k prompt("y/n:") %cycle i = get sym %if i = 'y' %or i = 'n' %start skip to end %result = i %finish %result = 'n' %if i = nl %repeat %end %routine read line(%string (*) %name s) %integer i s = "" %cycle i = get sym %return %if i = nl s = s.tostring(i) %repeat %end %integerfn test item(%string (*) %name s) %integer i %if s = "" %start printstring("Please specify an object ") %result = 0 %finish %cycle i = 1, 1, narts %if s = articles(i) %then %result = i %repeat printstring("What is a "); printstring(s); newline %result = 0 %end %routine do invent printstring("on body:") %cycle i = 1, 1, 10 %if invent(i) # 0 %start printstring(articles(invent(i))); printstring(", ") %finish %repeat newline %end %routine start %integer i, x, q peclear printstring("You may take 9 of the following items (or say stop) item cost item cost ") %cycle i = 1, 1, narts printstring(articles(i)); spaces(25-length(articles(i))) write(cost(i), 4) %if i&1 = 1 %then newline %else spaces(10) %repeat q = 1 %cycle pecline(21); pepos(1, 21) prompt("item?") read line(s); %exit %if s = "stop" newline x = test item(s) %if x = 0 %then %continue %if 17 <= x <= 19 %and suit ok = 0 %start suit ok = x printstring("you wear that one ") %finishelsestart invent(q) = x; q = q+1 %exit %if q = 10 %finish do invent life = life-cost(x) printstring("life points remaining =") write(life, 1); newline %repeat %end %integer %fn pick room type %integer n, p n = randomize(100) %result = 1 %if n < 44 %result = 2 %if n < 71 %result = 3 %if n < 83 %result = 4 %if n < 95 %result = 5 %end %integer %fn left(%integer sqx, sqy) %result = side(sqx+sqy*64+deck*192)&15 %end %integer %fn right(%integer sqx, sqy) %result = side((sqx+1)&63+sqy*64+deck*192)&15 %end %integer %fn up(%integer sqx, sqy) %result = 2 %if sqy = 0; ! wall at top %result = (side(sqx+sqy*64+deck*192))>>4 %end %integer %fn down(%integer sqx, sqy) %if sqy = 2 %then %result = 2; ! wall %result = side(sqx+(sqy+1)*64+deck*192)>>4 %end %routine nleft(%integer x, y, n) %integer k k = x+y*64+deck*192 side(k) = (side(k)&x'f0')+n %end %routine nright(%integer x, y, n) %integer k, p k = (x+1)&63+y*64+deck*192 side(k) = (side(k)&x'f0')+n %end %routine nup(%integer x, y, n) %integer k k = sqx+sqy*64+deck*192 side(k) = (side(k)&x'0f')+n<<4 %end %routine ndown(%integer x, y, n) %integer k %return %if sqy = 2 k = sqx+(sqy+1)*64+deck*192 side(k) = (side(k)&x'0f')+n<<4 %end %routine draw sq(%integer sqx, sqy) %integer i, j, k, sqv, posx, posy sqv = sqx+sqy*64+deck*192 %if desc(sqv) # 0 %start; ! already disclosed k = sqx-refx; k = k+64 %if k < 0 posx = 1+(k)*6; posy = 3+sqy*4 pepos(posx, posy) printstring("+--") printsymbol(dd(up(sqx, sqy))) printstring("--+") pepos(posx, posy+1) psym('|'); psym(room d(desc(sqv)&7)) printstring(" |") pepos(posx, posy+2) printsymbol(dd(left(sqx, sqy))) spaces(2) %if desc(sqv)&x'10' # 0 %then printsymbol('0') %else space spaces(2) printsymbol(dd(right(sqx, sqy))) pepos(posx, posy+3); printstring("| |") pepos(posx, posy+4); printstring("+--") printsymbol(dd(down(sqx, sqy))); printstring("--+") my posx = posx+3; my posy = posy+2 %finish terminate %end %routine draw me draw sq(sqx, sqy) pepos(my posx, my posy); psym('x'); terminate %end %routine pict(%integer sqx, sqy) %integer i, j, k pecline(i) %for i = 3, 1, 16 refx <- (sqx-5)&63 %cycle i = 0, 1, 10 %cycle j = 0, 1, 2 draw sq((refx+i)&63, j) %repeat %repeat draw me %end %routine show room pepos(60, 20) printstring("Room type:"); printstring(room desc(current room)) pepos(60, 21) printstring("life points:"); write(life, 2); spaces(2) pepos(60, 22) printstring("to hand:"); printstring(articles(to hand)); spaces(5) terminate %if sqx = refx %or sqx = (refx+11)&63 %then pict(sqx, sqy) %else %c draw me pepos(1,1) printstring("You are on Deck ") printsymbol(deck+'A'); printsymbol('3'-sqy) printstring(" room"); write(sqx, 2); terminate pepos(1, 17) %end %integerfn search invent(%integer n) %integer i %cycle i = 1, 1, 10 %result = i %if invent(i) = n %repeat %result = 0 %end %routine swap(%integer n) %integer q q = to hand to hand = invent(n) invent(n) = q %end %string (255) %fn penalty(%integer n) %string (255) s %integer i %conststring (13) %array pen(-1:3) = %c "too far away", "unharmed", "stunned", "destroyed", "dead" %result = pen(-1) %if n = 3 i = n %if n = 2 %start %if me > 0 %then i = 3 %finish %if me # 0 %start s = character(me)." is " %result = s.pen(i) %finish %else %start %if n = 0 %start s ="You are ok" %finish %else %if n = 1 %start s ="You lose 2 life points" life = life-2 %finish %else %start s ="You lose 5 life points" life = life-5 %finish %if life < 0 %start printstring("********** you are dead ************** ") %stop %finish %finish %result = s %end %integer %fn try door(%integer res) %integer a, b, c %if res = 0 %then %result = test door %result = 2 %if res = 2; ! 'real' wall %if to hand = 20 %and res = 6 %start printstring("The solvent has done it ") to hand = 0; %result = 1 %finish %if to hand = 1 %and res = 3 %start printstring(" the lockpick opens the door ") %result = 1 %finish %if to hand = 2 %and res = 4 %start printstring(" you open the door with your gloves ") %result = 1 %finish %if to hand = 3 %and res # 1 %start a = laser cutter %result = 1 %if a = 0 %finish %result = res %end %integer %fn test alertness %integer i i = roll+roll %if alertness >= i %start %result = 0 %finish %result = 1 %end %integer %fn try room %integer i, j, k %result = 0 %end %integer %fn laser cutter %switch sw(2:12) %integer i, j, num -> sw(roll+roll) sw(2): printstring("Laser overheats and interior components melt down ") -> fail sw(3): printstring("You have dropped the laser and something went crunch ") -> fail sw(4): printstring("While cutting, the laser cuts into a water vent, the ") printstring("laser is short-circuited. ") num = n control bot i = 0 -> fail %if num = 0 %cycle j = 1, 1, num %if roll = 1 %then i = i+1 %repeat %if i = 0 %start printstring("No further damage has occured ") %finish %else %start printstring("You have lost"); write(i, 1); printstring(" robots ") %finish -> fail sw(5): sw(6): sw(7): sw(8): sw(9): printstring("You have succeeded in cutting through ") %result = 0 sw(10): printstring("You have been splashed by molten metal") newline %if suit ok = 1 %start printstring("The suit now malfunctions! ") suit ok = 0 %finish %else %start printstring(penalty(2)); newline %finish -> sw(5) sw(11): printstring("The warranty on the laser ran out today! It has") printstring(" just failed ") -> fail sw(12): printstring("Who forgot to replace the power pack? ") fail: printstring("You failed to cut through - discard the laser ") to hand = 0 %result = 1 %end %routine accessway %conststring (15) %array type(1:3) = %c "Staircase", "Elevator", "Null grav tube" %constbyteintegerarray rd(1:6) = 1, 1, 2, 2, 3, 3 %Integer n, bad, i, ndeck pepos(1, 17) n = roll n = rd(n) printstring("The accessway is a "); printstring(type(n)) printstring(" ..... Do you wish to enter?") newline i = get yn %if i = 'n' %then %return bad = roll again: printstring("Which Deck do you wish to go to?") newline prompt("a/b/c?") i = get sym -> again %unless 'a' <= i <= 'c' skip to end ndeck = i-'a' %if bad >= 3 %start pepos(1, 16) printstring("you made it ") deck = ndeck desc(sqx+sqy*64+deck*192) = 5 pict(sqx, sqy) %return %finish bad = roll %if bad < 3 %start pepos(1, 16) printstring("You failed to make it ") %if test alertness # 0 %then i = 2 %else i = 0 printstring(penalty(i)) desc(sqx+sqy*64+deck*192) = x'15'; ! no entry %finishelsestart engage random(0) %finish %end %routine service %integer r, i, j pepos(1, 17) r = roll %if r < 3 %then engage random(r) %if r >= 5 %start printstring("The room is empty ") %return %finish r = roll %if r < 5 %start printstring("There is a box here ") around = 1; around item(1) = -1 %finish %end %routine living %integer r, i, k r = roll %if r = 1 %start printstring("you are in a dingy hotel suite, a MAID") printstring(" approaches you! ") k = -6 en: n enemy = 1 enemy(1) = k delay(3) war(1, 3) %return %finish %if r = 2 %start printstring("You are in a sauna, through the stream you ") printstring("see a GARCON ") k = -5 -> en %finish r = roll %if dead(r) = 0 %then %return; ! already met him dead(r) = 0 printstring("In the room is ") printstring(character(r)); printstring(" armed with a smg ") weapon(r) = smgn printstring("Do you want to fight? ") i = getyn k = r %if i = 'y' %then -> en printstring("Ok, he will join you ") friend = friend+1 %unless friend = 15 frienda(friend) = r %end %routine corridor %integer r, i r = roll %if r = 1 %then engage random(1) printstring(" the room is empty ") %end %routine vacuum %integer i, x %return %if friend = 0 %cycle i = 1, 1, friend x = frienda(i) %if x > 0 %start %if suitf(i) = 0 %start printstring(character(x)) printstring(" hasn't got a suit - and is now dead ") frienda(i) = 0 %if friend = 1 %then friend = 0 %finish %finish %repeat %end %routine industrial %integer i, k, r r = roll %if r <= 2 %start printstring("The room is in vacuum! ") %if r = 1 %start printstring("Do you wish to enter? ") i = getyn bug out = 1 %and %return %if i = 'n' %finish vacuum %if suit ok = 0 %start printstring(penalty(2)); newline printstring("clear out! ") bug out = 1 %return %finish %return %finish %return %if r = 4 %if r = 3 %then r = 5 %and engage random(1) %if r = 5 %start printstring("There is a crate here, would you like to open it? ") i = getyn %if i = 'n' %then %return r = goodies(randomize(31)) printstring("In the crate is "); printstring(articles(r)) around = 3; around item(i) = r %for i = 1, 1, 3 %return %finish printstring("There is a box here, but there is also a rumbling") printstring(" sound, do you wish to stay? ") i = getyn %if i = 'n' %start; bug out = 1; %return; %finish k = randomize(narts) printstring("There is a "); printstring(articles(r)) printstring(" here ") r = roll %if r <= 4 %start printstring("...... before you can escape, a stream of molten liquid hits you - your suit is wrecked, and ....") printstring(penalty(2)); newline suit ok = 0 %finish around = 1; around item(1) = k %end %routine open(%string (*) %name s) %integer i, r %if s # "box" %start printstring("I can't open a "); printstring(s); newline %return %finish %if around # 1 %and around item(1) # -1 %start printstring("What box? ") %return %finish r = roll %if r <= 2 %start printstring("you shoudn't have done that ") engage random(1) around = 0 %return %finish r = randomize(14) printstring("There is a "); printstring(articles(r)) printstring(" in the box ") around item(1) = r %end %integerfn reload(%integer n, %integername to hand) %if smgammo <= n <=smgammo+2 %and %c smgunln <= to hand <= smgunln+2 %start to hand = to hand-smgunln+smgn printstring(articles(to hand)); printstring(" reloaded ") %result = 0 %finish %result = 1 %end %routine give(%string (*) %name q) %integer x, i, j %unless q -> s.(" to ").t %start printstring("Give something to someone ") %return %finish x = test item(s) %return %if x = 0 %if to hand # x %start printstring(s." is not to hand ") %return %finish %cycle i = 1, 1, cmax %if t = character(i) %then -> out %repeat rej: printstring("to whom? ") %return out: -> rej %if friend = 0 %cycle j = 1, 1, friend -> out2 %if frienda(j) = i %repeat -> rej out2: %if 17 <= x <= 19 %start; ! suit suitf(i) = x to hand = 0; %return %finish %if reload(x, weapon(j)) = 0 %then to hand = 0 %and %return weapon(j) = x; to hand = 0 %end %routine use(%string (*) %name s) %integer i, n, q n = test item(s); %return %if n = 0 q = search invent(n) %if q # 0 %start %if n = 16 %or n = 15 %start; ! pep pills alertness = alertness+2 printstring("alertness is now "); write(alertness, 1) newline invent(q) = 0 %return %finish %if smgammo <= n <=smgammo+2 %and %c smgunln <= to hand <= smgunln+2 %start to hand = to hand-smgunln+smgn printstring(articles(to hand)); printstring(" reloaded ") invent(q) = 0 %return %finish swap(q) printstring(s); printstring(" ready ") %return %finish printstring("use "); printstring(s); printstring(" ? ") %return %end %routine get(%string (*) %name s) %integer i, n, q i = test item(s); %return %if i = 0 %if around # 0 %start %cycle q = 1, 1, around %if around item(q) = i %start %cycle n = 1, 1, 10 %if invent(n) = 0 %start invent(n) = i printstring("Got "); printstring(s); newline around item(q) = 0 %return %finish %repeat printstring("you can't carry any more ") %finish %repeat %finish %end %routine drop(%string (*) %name s) %end %routine order bots(%integer whoi) %integer i, j, m, x %return %if whoi = 1 %cycle j = whoi, -1, 2 m = 1 %cycle i = 1, 1, j %if enemy(i) < enemy(m) %then m = i %repeat x = enemy(j); enemy(j) = enemy(m) enemy(m) = x %repeat %end !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! w a r ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %routine war(%integer whoi, pos) %ownbytearray stun(0:10) %integer i, k, w, r, qi, z, zz, fxx %integerfn attack(%integer who, weap, suit ok) %integer r, h to h %switch sw(0:5) r = roll+roll -> sw(weap) sw(0): ! hand to hand %result = 3 %unless pos = 0 h to h = h to ha(enemy(qi))-h to ha(0) %if who # 0 %then h to h = - h to h r = r+h to h r = 2 %if r < 2; r = 12 %if r > 12 %result = h to hd(r) sw(1): r = r-3 %if suit ok = 19; r = 2 %if r < 2 %result = smg(r) sw(2): r = r-3 %if suit ok = 17; r = 2 %if r < 2 %result = laser(r) sw(3): r = r-3 %if suit ok = 17; r = 2 %if r < 2 %result = laser pistol(r) sw(4): %result = expl gren(r) sw(5): ! bot slaver %result = 3 %if pos # 0 %result = 2 %unless r = 1 %result = 0 %end %integerfn attack enemy(%integer ind, %integername to hand) me = enemy(ind) k = attack(ind, w, 0) %unless k = 2 %and to hand = 14 %then %c printstring(penalty(k)) %and newline %if 1 <= w <= 3 %start %if roll <=2 %and frienda(fxx)>= 0 %start printstring("weapon is unloaded ") %if fxx = 0 %then %c to hand = tohand+smgunln-smgn %else %c weapon(frienda(fxx))=weapon(frienda(fxx))+smgunln-smgn %finish %finish %if k = 2 %start qi = qi+1 %if to hand = 14 %start; ! bot slaver printstring("bot is enslaved ") friend = friend+1 %unless friend = 15 frienda(friend) = enemy(qi-1) %finish %finish %if k = 1 %then stun(qi) = 2 %if qi > whoi %start printstring("All dealt with ") me = 0 %result = 0 %finish %result = 1 %end %integer %fn single out(%integername to hand) %integer i, z %if w = 4 %start %cycle i = qi, 1, whoi z = attack enemy(i, to hand) %if z = 0 %then to hand = 0 %and %result = 0 %repeat to hand = 0 %result = 1 %finish z = 1 %cycle i = whoi, -1, qi %if stun(i) = 0 %then z = i %repeat %result = attack enemy(z, to hand) %end ! body of war order bots(whoi) pepos(1, 17) printstring("you are faced by a ") %cycle i = 1, 1, whoi printstring(character(enemy(i))) printstring(" and a ") %unless i = whoi %repeat newline qi = 1 %cycle %cycle i = 1, 1, 10 %if stun(i) # 0 %then stun(i) = stun(i)-1 %repeat pepos(1, 19) w = nweapa(to hand) fxx = 0 printstring("you are armed with a ") %if to hand = 0 %then printstring("fist") %else %c printstring(articles(to hand)) newline prompt("use something?") %return %if single out(to hand) = 0 read line(s) pecline(i) %for i = 17, 1, 23 %unless s = "" %or s = "n" %start %if s -> t.("use ").s %then i = i use(s) %finish ! now the attack %cycle z = qi, 1, whoi %continue %if stun(z) # 0 delay(2) pecline(22); pecline(21) printstring("You are attacked by the ") printstring(character(enemy(z))) w = weapon(enemy(z)) %if w = 0 %then printstring(%c " hand-to-hand ") %else %start printstring(" with a "); printstring(%c articles(w)); spaces(15); newline %finish w = nweapa(w) me = 0 k = attack(0, w, suit ok); ! my weapon !!!! printstring(penalty(k)); newline %repeat delay(2) %if friend # 0 %start %if term type = 'P' %start pecline(22); pecline(21) %finish printstring("Would you like support? ") i = getyn %if i = 'n' %then ->nosupp %cycle fxx = 1, 1, friend %continue %if frienda(fxx) = 0 delay(2) pecline(22); pecline(21) printstring(character(frienda(fxx))); printstring(" attacks ") w = n weapa(weapon(frienda(fxx))) z = single out(weapon(frienda(fxx))) %return %if z = 0 %repeat nosupp: %finish pos = pos-1 %unless pos = 0 %repeat %end %routine engage random(%integer n) %integer i, j, r %ownintegerarray ne(2:12) = 5, 4, 3, 2, 1, 1, 1, 2, 3, 4, 5 %if n = 0 %start r = roll+roll n = ne(r) %finish n enemy = n %cycle i = 1, 1, n enemy enemy(i) = -roll %repeat war(nenemy, 3) %end %integerfn test door %integer i, j, k %switch sw(0:8) k = double roll j = door(k) -> sw(j) sw(0): printstring("program error ") %stop sw(1): ! ok printstring("The door opens ") sw1: %result = 1 sw(2): ! electrified printstring("The door is electrified ") %if to hand = 2 %start printstring(" you're gloves save you ") -> sw1 %finish printstring(penalty(elect prod(roll+roll))); newline failed: printstring("You have failed to pass through ") %result = 4 sw(3): ! locked printstring("The door is locked ") %if to hand = 1 %start printstring(" you're lockpick opens it ") -> sw1 %finish %result = 3 sw(4): ! monofilament i = test alertness %if i = 0 %start printstring("You spotted a monofilament criss-cross over the door") printstring(" in time ") %result = 6 %finish printstring("You walked into a monofilament criss-cross over the door") printstring(" and ..... ") printstring(penalty(2)); newline %result = 6 sw(5): ! anti-decompression door printstring("As you attempt to open the door a steel anti-decompression seal slams accross the doorway ") i = test alertness %if i = 1 %start %if to hand = 1 %start printstring("The lockpick is destroyed ") %finish %else %start printstring(penalty(2)) %finish %finish %result = 5 sw(6): ! gas printstring("As you open the door, GAS spurts out from the jamb ") %if suit ok # 0 %start printstring("Your suit protects you ") -> sw1 %finish printstring(penalty(gas gun(roll+roll))) -> sw1 sw(7): ! ok on c-deck, otherwise 4 -> sw1 %if deck = 2 -> sw(4) sw(8): ! water printstring("Some juvenile nitwit has left a bucket of water balanced over the door, the bucket falls on you, drenching you with water. ") %if to hand = 3 %start printstring("Your laser cutter is destroyed ") to hand = 0 %finish -> sw1 %end printstring(" Welcome to 'The Return of the Stainless Steel Rat' ") %cycle printstring("Are you on a Perkin Elmer (p), Newbury (n) or") printstring(" Lynwood (l)?"); terminate prompt("") i = get sym %if i = 'p' %then term type = 'P' %and %exit %if i = 'n' %then term type = 'N' %and %exit %if i = 'l' %then term type = 'L' %and %exit %repeat skip to end sqx = 0; sqy = 0; refx = 0 deck = 2 peclear; newline desc(2*192) = 1; current room = 1 start peclear pict(sqx, sqy) pepos(40, 1) printstring("ps..The computer is on Deck B2, room 16 ") desc(16+2*64+1*192) = 6 x: pecline(18) pepos(1, 17);newline lastx = sqx; lasty = sqy; bug out = 0 prompt("Go?") read line(s) pecline(i) %for i = 17, 1, 23 pepos(1, 19) %unless s-> s.(" ").t %then t = "" sqv = sqx+sqy*64+deck*192 %cycle i = 1, 1, comms %if comm(i) = s %start -> sw(i) %finish %repeat printstring("eh? ") -> x sw(1):sw(5): ! move left j = try door(left(sqx, sqy)) nleft(sqx, sqy, j) -> fail it %if j # 1 sqx = (sqx-1)&63 -> test it sw(2):sw(6): ! move right j = try door(right(sqx, sqy)) nright(sqx, sqy, j) -> fail it %if j # 1 sqx = (sqx+1)&63 -> test it sw(3):sw(7): ! move 'up' %if sqy = 0 %then -> fail it j = try door(up(sqx, sqy)) nup(sqx, sqy, j) -> fail it %if j # 1 sqy = sqy-1 -> test it sw(4):sw(8): ! move 'down' %if sqy = 3 %then->fail it j = try door(down(sqx, sqy)) ndown(sqx, sqy, j) -> fail it %unless j = 1 sqy = sqy+1 test it: pepos(my posx, myposy); psym(' ') pepos(1, 17) sqv = sqx+sqy*64+deck*192 current room = desc(sqv)&7 %if desc(sqv)&x'10'#0 %start retreat: printstring("That room is blocked to you ") desc(sqv) = desc(sqv)!x'10'; ! for the sake of bug out sqx = lastx; sqy = lasty -> test it %finish %if desc(sqv) = 0 %start; ! what will it be? current room = pick room type desc(sqv) = current room show room %if current room = 2 %then service %if current room = 3 %then corridor %if current room = 1 %then industrial %if current room = 4 %then living %if bug out # 0 %then bug out = 0 %and -> retreat %finish report: show room %if current room = 5 %then accessway %if current room = 6 %start engage random(5) peclear; pepos(40,18) printstring("congratulations - you win ") %stop %finish -> x fail it: pepos(1, 17) printstring("sorry, can't go that way ") -> report sw(9): ! pict peclear pict(sqx, sqy) -> x sw(10): ! use use(t) -> x sw(11): sw(12): ! inventory do invent -> x sw(13): ! get sw(16): ! take get(t) -> x sw(14): ! drop drop(t) -> x sw(15): ! open open(t) -> x sw(17): ! give x to y give(t) -> x %end %endoffile