1 REM CASTLE ADVENTURE
5 MODE 2 10 DIM DD$(50),OP(18),OD$(18),STUNT(50) 20 DIM ROUTE(50,6) 30 PLOC=1 40 PF=0 90 GOSUB 9000 95 GOSUB 5000 100 GOSUB 7600 110 GOSUB 3000:IF VERB=0 THEN PRINT"I don't understand you":GOTO 100 115 GOSUB 4000 120 ON VERB GOSUB 7000,7000,7000,7000,7000,7000,8000,6000,6500,5000,7500,7400,7300,7700,7800,7900 130 GOTO 100 999 END 1000 REM RETURN VERB NUMBER IN I/P STRING 1010 RESTORE 10000:T=0 1020 READ T$ 1030 IF T$="*" THEN RETURN 1040 IF LEFT$(T$,1)="!" THEN T$=RIGHT$(T$,LEN(T$)-1):T=T+1 1050 IF T$=V$ THEN VERB=T:RETURN 1060 GOTO 1020 2000 REM RETURN NOUN NUMBER IN I/P STRING 2010 RESTORE 11000:T=0 2020 READ T$ 2030 IF T$="*" THEN RETURN 2040 IF LEFT$(T$,1)="!" THEN T$=RIGHT$(T$,LEN(T$)-1):T=T+1 2050 IF T$=N$ THEN NOUN=T:RETURN 2060 GOTO 2020 3000 REM PARSE THEN INPUT AND ANALYSE 3010 VERB=0:NOUN=0:IF I$="" THEN RETURN 3020 P=0:FOR L=LEN(I$) TO 1 STEP -1 3030 IF MID$(I$,L,1)=" " THEN P=L 3040 NEXT L 3050 IF P=0 THEN V$=I$:GOSUB 1000:RETURN 3060 V$=MID$(I$,1,P-1):N$=MID$(I$,P+1,40) 3070 GOSUB 1000:GOSUB 2000 3099 RETURN 4000 ON STUNT(PLOC)+1 GOTO 4010,4100,4200,4300,4400,4500,4600,4700,4800,4900 4010 RETURN 4100 IF PF<>1 AND OP(3)=0 THEN OP(3)=-1:PRINT "The princess dies of hunger":GOTO 4010 4110 RETURN 4200 PRINT "You fall out of the tree and break your neck":GOTO 8990 4300 PRINT "The tree is wobbling very dangerously":STUNT(PLOC)=2:GOTO 4010 4400 PRINT "The tree is swaying in the wind":STUNT(PLOC)=3:GOTO 4010 4500 PRINT "'That looks nice', says the guard, eyeing your gold":GOTO 4010 4700 IF OP(12)<>0 THEN PRINT "The floor drags you back, faster than you can move":PLOC=46:GOTO 4010 4710 PRINT "Your ring of speed glows and you rush down the corridor past the sliding floor":PLOC=50:GOTO 4010 4800 PRINT "A portcullis drops down hard behind you, barring the castle entrance":STUNT(PLOC)=0:GOTO 4010 4900 IF OP(3)<>0 THEN PRINT "The elven king sees that you have failed in your rescue attempt, and he swiftly kills you":GOTO 8990 4910 PRINT "The elven king greets you with fair words and offers you all the gold and silver of his kingdom as reward for the safe return of his daughter" 4920 GOTO 8990 5000 REM describe (ploc) 5010 PRINT "You are "; 5020 L=0 5030 L=L+1:IF L>LEN(DD$(PLOC)) THEN GOTO 5099 5040 IF MID$(DD$(PLOC),L,1)="!" OR MID$(DD$(PLOC),L,1)="$" OR MID$(DD$(PLOC),L,1)="" THEN GOTO 5099 5050 PRINT MID$(DD$(PLOC),L,1); 5060 GOTO 5030 5099 PRINT:GOSUB 5200:RETURN 5100 REM DESCRIBE OBJECT NUMBER (N) 5110 PRINT 5120 L=0 5130 L=L+1:IF L>LEN(OD$(N)) THEN GOTO 5199 5140 IF MID$(OD$(NOUN),L,1)="" OR MID$(OD$(NOUN),L,1)="!" THEN GOTO 5199 5150 PRINT MID$(OD$(N),L,1); 5160 GOTO 5130 5199 PRINT:RETURN 5200 REM DESCRIBE ALL (PLOC) OBJECTS 5205 F=0:PRINT "There is "; 5210 FOR N=1 TO 18 5220 IF OP(N)=PLOC THEN NOUN=N:F=1:GOSUB 5100 5230 NEXT N:PRINT:IF F=0 THEN PRINT "nothing here" ELSE PRINT "here" 5299 RETURN 6000 REM TAKE COMMAND 6010 IF NOUN=0 THEN PRINT "Take what ?":RETURN 6015 IF OP(NOUN)<>PLOC OR OP(NOUN)=-1 THEN PRINT "Take what ?":RETURN 6020 IF OP(NOUN)=0 THEN PRINT "You've already got it, dumbo":RETURN 6025 IF NOUN>13 THEN PRINT "You can't take that":RETURN 6030 PRINT "O.K. You've got it now" 6040 OP(NOUN)=0:RETURN 6500 REM DROP COMMAND 6510 IF NOUN=0 THEN PRINT "Drop what ?":RETURN 6515 IF OP(NOUN)<>0 THEN PRINT "Drop what ?":RETURN 6520 PRINT "O.K. It's dropped" 6530 OP(NOUN)=PLOC:RETURN 6700 FOR L=1 TO LEN(OD$(NOUN)) 6710 IF MID$(OD$(NOUN),L,1)="!" THEN OD$(NOUN)=LEFT$(OD$(NOUN),L-1)+" "+MID$(OD$(NOUN),L+1) 6720 NEXT L:RETURN 6800 FOR L=1 TO LEN(DD$(PLOC)) 6810 IF MID$(DD$(PLOC),L,1)="!" THEN DD$(PLOC)=LEFT$(DD$(PLOC),L-1)+" "+MID$(DD$(PLOC),L+1) 6820 NEXT L:RETURN 6900 FOR L=1 TO LEN(DD$(PLOC)) 6910 IF MID$(DD$(PLOC),L,1)="$" THEN DD$(PLOC)=LEFT$(DD$(PLOC),L-1)+" "+MID$(DD$(PLOC),L+1) 6920 NEXT L:RETURN 7000 NLOC=ROUTE(PLOC,VERB):IF NLOC<>-1 AND NLOC<>0 THEN PRINT "O.K.":PRINT:PLOC=NLOC:GOSUB 5000:GOSUB 4000:RETURN 7010 IF NLOC=-1 THEN GOTO 7030 7020 IF VERB=5 THEN PRINT "There's nothing that you can climb here":RETURN 7025 PRINT "You can't move in that direction":RETURN 7030 PRINT "A door blocks your way":RETURN 7300 IF NOUN<>0 THEN PRINT "try EXAMINE":RETURN 7310 GOSUB 6800:GOSUB 5000:RETURN 7400 IF NOUN=0 THEN PRINT "examine what ?":RETURN 7405 IF OP(NOUN)<>0 AND OP(NOUN)<>PLOC THEN PRINT "examine what ?":RETURN 7410 GOSUB 6700:N=NOUN:GOSUB 5100:RETURN 7500 REM INVENTORY 7510 F=0:PRINT "You are holding :":FOR N=1 TO 18 7520 IF OP(N)=0 THEN F=1:NOUN=N:GOSUB 5100 7530 NEXT N:PRINT:IF F=0 THEN PRINT "nothing" 7599 RETURN 7600 I$="":PRINT:PRINT " : "; 7610 A$=INKEY$:IF A$<>"" THEN GOTO 7610 7620 A$=INKEY$:IF A$="" THEN GOTO 7620 7625 IF A$>="a" AND A$<="z" THEN A$=CHR$(ASC(A$)-32) 7630 IF ASC(A$)=13 AND LEN(I$)>0 THEN PRINT:RETURN 7640 IF ASC(A$)<>127 AND LEN(I$)<30 THEN I$=I$+A$:PRINT A$;:GOTO 7610 7650 IF ASC(A$)<>127 THEN GOTO 7610 7660 IF LEN(I$)=0 THEN GOTO 7600 7670 I$=LEFT$(I$,LEN(I$)-1):PRINT CHR$(8);" ";CHR$(8);:GOTO 7610 7700 IF NOUN=0 THEN PRINT "Give what ?":RETURN 7710 IF NOUN<>2 AND NOUN<>7 AND NOUN<>9 AND NOUN<>4 AND NOUN<>12 THEN PRINT "It's returned to you":RETURN 7720 IF PLOC<>17 THEN GOTO 7750 7730 IF NOUN<>7 AND NOUN<>12 THEN PRINT "The guard recognises the stolen goods and promptly kills you.":GOTO 8990 7740 PRINT "The guard snatches your bribe and opens the gate":OP(NOUN)=-1:ROUTE(17,2)=18:STUNT(17)=0:RETURN 7750 IF PLOC<11 OR PLOC>14 THEN PRINT "There is nobody here who wants anything":RETURN 7760 IF NOUN=4 THEN PRINT "The princess thanks you kindly for the food and looks much better":OD$(4)="a beautiful, healthy looking princess":PF=1 7770 OP(NOUN)=-1:RETURN 7800 IF NOUN=0 THEN PRINT "but who ?":RETURN 7810 IF NOUN<>15 AND NOUN<>16 THEN PRINT "You can't.":RETURN 7820 IF OP(NOUN)<>PLOC THEN PRINT "You can't.":RETURN 7830 IF NOUN=15 THEN PRINT "The kings escort instantly rises from his light slumber and despatches you with one blow of his sword":GOTO 8990 7840 IF OP(5)=0 THEN PRINT "The guard swings his mace and your knife breaks":OP(5)=-1:RETURN 7850 PRINT "The guard hits you over the head and knocks you out. He takes the princess back to the tower" 7860 OP(3)=14:OD$(3)="A very distressed princess":RETURN 7900 IF NOUN<>0 THEN PRINT "O.K. '";OD$(NOUN);"'":RETURN 7910 IF N$="CPC" AND PLOC=6 THEN ROUTE(6,3)=7:GOSUB 6900:RETURN 7920 IF N$="464" AND PLOC=3 THEN ROUTE(3,2)=4:GOSUB 6900:RETURN 7930 PRINT "O.K. '";N$;"'":RETURN 8000 IF NOUN=0 THEN PRINT "Use what ?":RETURN 8005 IF OP(NOUN)<>PLOC AND OP(NOUN)<>0 THEN PRINT "Use what ?":RETURN 8010 IF NOUN=1 THEN GOTO 8100 8011 IF NOUN=4 THEN GOTO 8200 8012 IF NOUN=8 THEN GOTO 8300 8013 IF NOUN=13 THEN GOTO 8400 8014 IF NOUN=18 THEN GOTO 8800 8019 GOTO 8750 8100 IF PLOC<>15 THEN PRINT "The ground is too hard here":RETURN 8110 PRINT "You dig in the soft earth and reveal something":ROUTE(15,6)=48:GOSUB 6900:RETURN 8200 PRINT "Someone, somewhere, needed that food more than you did":OP(4)=-1:RETURN 8300 PRINT "You'll need to use some rope":RETURN 8400 IF PLOC=2 THEN PRINT "The door to the south is now open":ROUTE(PLOC,2)=16:RETURN 8410 IF PLOC=3 THEN PRINT "A combination is needed to get into the garden shed":RETURN 8420 IF PLOC=6 THEN PRINT "You'll need the password to get in here":RETURN 8430 IF PLOC=18 THEN PRINT "There's no way you can unlock a portcullis":RETURN 8440 PRINT "There's nothing to unlock here":RETURN 8750 PRINT "You can't use that !":RETURN 8800 PRINT "You carefully tie the bucket to the rope and lower it down the well":FOR L=1 TO 800:NEXT L 8810 PRINT "Your draw the bucket up again":FOR L=1 TO 800:NEXT L:PRINT "There is something at the bottom of it":OP(7)=PLOC 8820 PRINT "You let go of the rope and the bucket falls back down the well":OP(8)=-1:OP(18)=-1:PRINT "The object you found lies glittering on the ground" 8830 RETURN 8990 PRINT:PRINT:PRINT:PRINT:PRINT:END 9000 REM SETUP ALL THE ARRAYS 9010 FOR L=1 TO 50:STUNT(L)=0:NEXT L 9020 STUNT(7)=1:STUNT(22)=9:STUNT(28)=4:STUNT(31)=4 9030 STUNT(17)=5: STUNT(49)=7:STUNT(18)=8 9050 RESTORE 12000:FOR L=1 TO 50 9060 FOR N=1 TO 6:READ ROUTE(L,N) 9070 NEXT N:NEXT L 9080 RESTORE 13000 9090 FOR L=1 TO 18:READ OP(L):NEXT L 9100 OD$(1)="A shovel!ready to dig the earth":OD$(2)="A pile of treasure!gathered in the days of great empires" 9110 OD$(3)="A princess!as beautiful as any elven king's daughter could be":OD$(4)="Some food!lovingly prepared and fit for royalty" 9120 OD$(5)="A knife!razor sharp, cursed by many, loved by few":OD$(6)="A large book!telling of the prowess of the kings escort" 9130 OD$(7)="A gold coin":OD$(8)="A bucket!of untold riches":OD$(9)="many Silver Plates!inscribed with the mystical runes E.P.N.S." 9140 OD$(10)="Notepaper!bearing the legend CPC":OD$(11)="An ancient scroll!reading 'find my daughter and be richly rewarded'" 9150 OD$(12)="A shining ring!of speed":OD$(13)="A key":OD$(14)="A tree!branches hang down low and the trunk reaches for the sky" 9160 OD$(15)="The kings escort!sleeping lightly":OD$(16)="A castle guard!who looks very bored" 9170 OD$(17)="A well!radiating magice":OD$(18)="A long well made rope" 9210 DD$(1)="in the centre of the castle courtyard":DD$(2)="at the south end of the courtyard!an opening leads further south" 9220 DD$(3)="by the entrance to the west tower the garden shed is south$the shed door is open":DD$(4)="inside a garden shed" 9230 DD$(5)="at the bottom of a winding stairway":DD$(6)="by the entrance to the east tower":DD$(7)="at the bottom of a staircase" 9240 DD$(8)="on a winding stairway":DD$(9)=DD$(8):DD$(10)="at the top of a stairway!'464' is scrawled on the wall" 9250 DD$(11)="on a steep staircase":DD$(12)=DD$(11):DD$(13)=DD$(11):DD$(14)="at the very top of the east tower" 9260 DD$(15)="beside a soft patch of earth in the courtyard$a hole leads down":DD$(16)="at the northern end of a guarded passage" 9270 DD$(17)="in a tunnel. An aging guard blocks your way south":DD$(18)="on the main East/West road of middle earth" 9280 DD$(19)="on the road, a forest lies to the south":DD$(20)="on the road.A large sign reads : Adventure in need of extension : ROAD AHEAD CLOSED :" 9290 DD$(21)="on top of a large unclimable cliff overlooking a vast panorama of places to adventure":DD$(22)="in a small clearing in the forest" 9300 DD$(23)="on the edge of a vast forest":DD$(24)="lost deep in a forest":DD$(25)="lost in a forest":DD$(26)="lost within a forest" 9310 DD$(27)="halfway up a large tree!the tree extends upwards":DD$(28)="at the top of the tree, a small clearing is visible below" 9320 DD$(29)="in the courtyard":DD$(30)="in the shade in the courtyard":DD$(31)="at the top of a tree in the courtyard there is a princess in the east tower" 9330 DD$(32)="In the north-west corner of the courtyard":DD$(33)="on stairs leading down into the dungeon":DD$(34)="in the guard room" 9340 DD$(35)="In the banqueting hall":DD$(36)="At the east end of the banqueting hall!a door leads north to the kitchen" 9350 DD$(37)="In the castle kitchen":DD$(38)="At the north end of a north-south corridor":DD$(39)="in the servants quarters" 9360 DD$(40)="in the royal bedroom!there is a door to the west":DD$(41)="in the castle library":DD$(42)="in the grand throne room" 9370 DD$(43)="in a north-south corridor!cells lead east and west":DD$(44)="in an empty cell":DD$(45)=DD$(44) 9380 DD$(46)="in a north-south corridor":DD$(47)="in a cell" 9390 DD$(48)="in a locked dungeon cell":DD$(49)="At the south end of a corridor":DD$(50)=DD$(49) 9999 RETURN 10000 DATA !NORTH,N,!SOUTH,S,!EAST,E,!WEST,W 10010 DATA !UP,U,CLIMB,!DOWN,D 10020 DATA !USE 10030 DATA !TAKE,GET 10040 DATA !DROP,PUT 10050 DATA !LOOK 10060 DATA !INVENTORY,INV 10070 DATA !EXAMINE,!SEARCH 10080 DATA !GIVE,BRIBE,!FIGHT,KILL,ATTACK 10090 DATA !SAY,SHOUT 10999 DATA* 11000 DATA !SHOVEL,SPADE,!TREASURE,!PRINCESS,!FOOD 11010 DATA !KNIFE,WEAPON,!BOOK,!GOLD,COIN,!BUCKET,!SILVER,PLATES 11020 DATA !NOTEPAPER,PAPER,NOTE,!SCROLL,!RING,SPEED,!KEY 11030 DATA !TREE,TRUNK,!ESCORT,!GUARD,SOLDIER,BORED,!WELL,!ROPE 11999 DATA* 12000 DATA 29,2,6,3,0,0,1,-1,30,0,0,0,32,-1,1,5,0,0 12010 DATA 3,0,0,0,0,0,0,0,3,0,8,0,15,30,-1,1,0,0 12020 DATA 0,0,0,6,11,0,0,0,0,0,9,5,0,0,0,0,10,8,0,0,0,0,0,9,0,0,0,0,12,7,0,0,0,0,13,11 12030 DATA 0,0,0,0,14,12,0,0,0,0,0,13,35,6,0,29,0,0,2,17,0,0,0,0,16,0,0,0,0,0,-1,23,19,21,0,0 12040 DATA 0,23,20,18,0,0,0,23,0,19,0,0,0,23,18,0,0,0 12050 DATA 25,26,24,26,0,0,18,24,26,25,0,0,25,26,24,25,27,0,26,24,25,26,27,0,25,24,26,25,27,0,0,0,0,0,28,22 12060 DATA 0,0,0,0,0,27,0,1,15,32,0,0,6,0,0,2,31,0,0,0,0,0,0,30,34,3,29,0,0,0,0,0,35,40,0,38 12070 DATA 42,32,0,0,0,0,39,15,36,33,0,0,37,0,0,35,0,0,0,36,0,39,0,0,0,43,-1,-1,33,0,0,35,37,0,0,0 12080 DATA 41,0,-1,-1,0,0,0,40,0,42,0,0,0,34,41,0,0,0,38,46,44,45,0,0,0,0,0,43,0,0,0,0,43,0,0,0 12090 DATA 43,49,47,-1,0,0,0,0,0,46,0,0,0,0,-1,0,15,0,0,0,0,0,0,0,46,0,0,0,0,0 13000 DATA 4,42,14,37,39,41,-1,29,35,50,0,48,47,30,34,17,29,29 |