10 *FX202,32 120 MODE7 130 PROCINTRO 140 REM HAUNTED HOUSE 150 REM 160 nvbs%=29:nobs%=36:get%=18 170 PROCinit 175 PROCsetupkeys 180 CLS:PRINT"HAUNTED HOUSE" 190 PRINT"_____________" 200 PRINT 210 PRINT"ƒYou are:"' 220 PROCprint(loc$(rm%),130) 230 PRINT 240 PRINT"„There are exits:"; 250 FOR I=1 TO LEN(route$(rm%)) 260 PRINTCHR$129MID$(route$(rm%),I,1);","; 270 NEXTI 280 PRINT' 290 FOR I=1 TO get% 300 IF loc%(I)=rm% AND flag%(I)=0 THEN :FOR I%=1 TO 2:PRINTCHR$131;CHR$141;"You can see";CHR$131;obj$(I);CHR$131"here":NEXTI% 310 NEXTI 320 PRINT'"„==================" 330 PRINT 340 PRINT 350 PROCprint(msge$,129):msge$="Sorry - you cannot do that." 360 PRINT 370 INPUT"‚What will you do now? "in$ 380 vb$="":n$="":vb%=0:ob%=0 390 FOR I=1 TO LEN(in$) 400 IF MID$(in$,I,1)=" " AND vb$="" THEN vb$=LEFT$(in$,I-1) 410 IF MID$(in$,I+1,1)<>" " AND vb$<>"" THEN n$=MID$(in$,I+1,LEN(in$)-1):I=LEN(in$) 420 NEXTI 430 IF n$="" vb$=in$ 440 FOR I=1 TO nvbs% 450 IF vb$=vb$(I) THENvb%=I 460 NEXTI 470 FOR I=1 TO nobs% 480 IF LEFT$(n$,3)=gob$(I) THEN ob%=I 490 NEXTI 500 IF n$>"" AND ob%=0 THENmsge$="That is silly!" 510 IF vb%=0 vb%=vb%+1 520 IF n$="" msge$="?" 530 IF vb%>nvbs% AND ob%>0 msge$="You cannot '"+in$+"'" 540 IF vb%>nvbs% AND ob%=0 msge$="You do not make sense!" 550 IF vb%0 AND cy%(ob%)=0 msge$="You do not have '"+n$+"'" 560 IFflag%(26)=1 AND rm%=13 AND RND(3)<>3 AND vb%<>21 msge$="ˆVAMPIRES …ATTACKING!‡":SOUND2,-15,30,153:GOTO180 570 IF rm%=44 AND RND(2)=1 AND flag%(24)<>1 flag%(27)=1 580 IF vb%=1 PROChelp 590 IF vb%=2 PROCinv 600 IF vb%=3 PROCmove 610 IF vb%=4 PROCmove 620 IF vb%=5 PROCmove 630 IF vb%=6 PROCmove 640 IF vb%=7 PROCmove 650 IF vb%=8 PROCmove 660 IF vb%=9 PROCmove 670 IF vb%=10 PROCtake 680 IF vb%=11 PROCtake 690 IF vb%=12 PROCopen 700 IF vb%=13 PROCexam 710 IF vb%=14 PROCread 720 IF vb%=15 PROCsay 730 IF vb%=16 PROCdig 740 IF vb%=17 PROCswing 750 IF vb%=18 PROCclimb 760 IF vb%=19 PROClight 770 IF vb%=20 PROCsnuff 780 IF vb%=21 PROCspray 790 IF vb%=22 PROCuse 800 IF vb%=23 PROCunlock 810 IF vb%=24 PROCleave 820 IF vb%=25 PROCscore 830 IF vb%=26 PROCsave 840 IF vb%=27 PROCload 850 IF vb%=28 PROCquit 860 IF vb%=29 PROChint 870 GOTO180 880 DEF PROChelp 890 PRINT"Words I know:" 900 FOR I=1 TO nvbs% 910 PRINTvb$(I);","; 920 NEXTI 930 msge$="":PRINT 940 PROCcyon 950 ENDPROC 960 DEF PROCinv 970 PRINT"You are carrying:" 980 FOR I=1 TO get% 990 IF cy%(I)=1 PRINTobj$(I);","; 1000 NEXTI 1010 msge$="":PRINT 1020 PROCcyon 1030 ENDPROC 1040 DEF PROCmove 1050 dir%=0 1060 IF ob%=0 dir%=vb%-3 1070 IF ob%=19 dir%=1 1080 IF ob%=20 dir%=2 1090 IF ob%=21 dir%=3 1100 IF ob%=22 dir%=4 1110 IF ob%=23 dir%=5 1120 IF ob%=24 dir%=6 1130 IF rm%=20 AND dir%=5 dir%=1 1140 IF rm%=20 AND dir%=6 dir%=3 1150 IF rm%=22 AND dir%=6 dir%=2 1160 IF rm%=22 AND dir%=5 dir%=3 1170 IF rm%=36 AND dir%=6 dir%=1 1180 IF rm%=36 AND dir%=5 dir%=2 1190 IF flag%(14)=1 msge$="crash! You fell out of the tree!":flag%(14)=0:ENDPROC 1200 IF flag%(27)=1 AND rm%=52 msge$="Ghosts will not let you move!":ENDPROC 1210 IF rm%=45 AND cy%(1)=1 AND flag%(34)=0 THEN msge$="A magical barrier has appeared":ENDPROC 1220 IF (rm%=18 AND flag%(0)=0) AND (dir%=1 OR dir%=4) msge$="It is too dark to move and you need a light. Have you found the glove and candle?":ENDPROC 1230 IF rm%=54 AND cy%(15)<>1 PRINT"You are stuck!For you the game is over.Better luck next time.":PRINT:PROCcyon:RUN 1240 IF cy%(15)=1 AND NOT(rm%=53 OR rm%=54 OR rm%=55 OR rm%=47) msge$="You cannot carry a boat!":ENDPROC 1250 IF (rm%>26 AND rm%<30) AND flag%(0)=0 msge$="It is too dark to move":ENDPROC 1260 flag%(35)=0:RL=LEN(route$(rm%)) 1270 FOR I=1 TO RL 1280 dir$=MID$(route$(rm%),I,1) 1290 IF (dir$="N" AND dir%=1 AND flag%(35)=0) rm%=rm%-8:flag%(35)=1 1300 IF (dir$="S" AND dir%=2 AND flag%(35)=0) rm%=rm%+8:flag%(35)=1 1310 IF (dir$="W" AND dir%=3 AND flag%(35)=0) rm%=rm%-1:flag%(35)=1 1320 IF (dir$="E" AND dir%=4 AND flag%(35)=0) rm%=rm%+1:flag%(35)=1 1330 NEXTI 1340 msge$="Ready" 1350 IF flag%(35)=0 msge$="You cannot go that way!" 1360 IF dir%<1 msge$="Go where?" 1370 IF rm%=41 AND flag%(23)=1 route$(49)="W":SOUND3,-15,20,90:msge$="The door slams shut behind you!":flag%(23)=0 1380 ENDPROC 1390 DEF PROCtake 1400 IF ob%>get% msge$="You cannot get "+n$:ENDPROC 1410 IF loc%(ob%)<>rm% msge$="It is not here" 1420 IF ob%<>0 msge$="WHAT "+n$+"?" 1430 IF cy%(ob%)=1 msge$="You already have it" 1440 IFob%>0 AND loc%(ob%)=rm% AND flag%(ob%)=0 cy%(ob%)=1:loc%(ob%)=65:msge$="You now have it." 1450 ENDPROC 1460 DEF PROCopen 1470 IF rm%=43 AND (ob%=28 OR ob%=29) flag%(17)=0:msge$="The drawer is now open" 1480 IF rm%=28 AND ob%=25 msge$="It is locked" 1490 IF rm%=38 AND ob%=32 msge$="It is now open":flag%(2)=0 1500 ENDPROC 1510 DEF PROCexam 1520 IF ob%=10 msge$="It needs batteries" 1530 IF ob%=30 flag%(18)=0:msge$="Something falls out of the pocket." 1540 IF ob%=31 msge$="That's disgusting!" 1550 IF (ob%=28 OR ob%=29) msge$="There is a drawer" 1560 IF ob%=33 OR ob%=5 PROCread 1570 IF rm%=43 AND ob%=35 msge$="There is something beyond....." 1580 IF ob%=32 PROCopen 1590 ENDPROC 1600 DEF PROCread 1610 IF rm%=42 AND ob%=33 msge$="They are demonic works" 1620 IF (ob%=3 OR ob%=36) AND cy%(3)=1 AND flag%(34)=0 msge$="It says:'Use this word with care _ JELLYBABIES'" 1630 IF cy%(5)=1 AND ob%=5 msge$="The writing is in a strange language" 1640 ENDPROC 1650 DEF PROCsay 1660 msge$="Ready '"+n$+"'" 1670 IF cy%(3)=1 AND ob%=34 THEN msge$="You suddenly feel very faint and have to close your eyes. When you open them you realize that something magical has happened.":IF rm%<>45 THEN rm%=RND(63) 1680 IF cy%(3)=1 AND ob%=34 AND rm%=45 THEN flag%(34)=1 1690 ENDPROC 1700 DEF PROCdig 1710 IF cy%(12)=1 msge$="You made a lovely little hole!" 1720 IF cy%(12)=1 AND rm%=30 msge$="You have dug the bars out":loc$(rm%)="There is a hole in the wall":route$(rm%)="NSE" 1730 ENDPROC 1740 DEF PROCswing 1750 IF cy%(14)<>1 AND rm%=7 msge$="This is no time to play games!" 1760 IF ob%=14 AND cy%(14)=1 msge$="You swung it" 1770 IF ob%=13 AND cy%(13)=1 msge$="Whoooosshhh!" 1780 IF ob%=13 AND cy%(13)=1 AND rm%=43 route$(rm%)="WN":loc$(rm%)="in a study with a secret room connected":msge$="You have broken the thin wall" 1790 ENDPROC 1800 DEF PROCclimb 1810 IF ob%=14 AND cy%(14)=1 msge$="It is not attached to anything!" 1820 IF ob%=14 AND cy%(14)<>1 AND rm%=7 AND flag%(14)=0 msge$="You see thick forest and a cliff to the south":flag%(14)=1:ENDPROC 1830 IF ob%=14 AND cy%(14)<>1 AND rm%=7 AND flag%(14)=1 msge$="Going down!":flag%(14)=0 1840 ENDPROC 1850 DEF PROClight 1860 IF ob%=17 AND cy%(17)=1 AND cy%(8)=0 msge$="It will burn your hands!" 1870 IF ob%=17 AND cy%(17)=1 AND cy%(9)=0 msge$="You have nothing to light it with!" 1880 IF ob%=17 AND cy%(17)=1 AND cy%(9)=1 AND cy%(8)=1 msge$="It casts a flickering light":flag%(0)=1 1890 ENDPROC 1900 DEF PROCsnuff 1910 IF flag%(0)=1 flag%(0)=0:msge$="Your candle is out" 1920 ENDPROC 1930 DEF PROCspray 1940 IF ob%=26 AND cy%(16)=1 msge$="Hissssss" 1950 IF ob%=26 AND cy%(16)=1 flag%(26)=0:msge$="Pfffft! Got them!" 1960 ENDPROC 1970 DEF PROCuse 1980 IF ob%=10 AND cy%(10)=1 AND cy%(11)=1 msge$="It is switched on":flag%(24)=1 1990 IF flag%(27)=1 AND flag%(24)=1 msge$="Whizzzz! You have vacuumed the ghosts up!":flag%(27)=0 2000 ENDPROC 2010 DEF PROCunlock 2020 IF rm%=43 AND(ob%=27 OR ob%=28) PROCopen 2030 IF rm%=28 AND ob%=25 AND flag%(25)=0 AND cy%(18)=1 flag%(25)=1:route$(rm%)="SEW":loc$(rm%)="by a huge open door":msge$="The key turns!" 2040 ENDPROC 2050 DEF PROCleave 2060 IF cy%(ob%)=1 cy%(ob%)=0:loc%(ob%)=rm%:msge$="Done" 2070 ENDPROC 2080 DEF PROCscore 2090 score%=0 2100 FOR I=1 TO get% 2110 IF cy%(I)=1 score%=score%+1 2120 NEXTI 2130 IF score%=17 AND cy%(15)<>1 AND rm%<>57 PRINT"You have everything":PRINT"Return to the gate for your final score": 2140 IF score%=17 AND rm%=57 PRINT"ˆDOUBLE SCORE FOR REACHING HERE!":score%=score%*2:PRINTscore%:PROCcyon:ENDPROC 2150 PRINT"Your score is ";score%:PROCcyon:IF score%>18 PRINT"Well done! You have finished the game":END 2151 2160 ENDPROC 2170 DEF PROCcyon 2180 INPUT'"Press RETURN to continue"in$ 2190 ENDPROC 2200 DEF PROCinit 2210 DIMroute$(63),loc$(63),obj$(nobs%),vb$(nvbs%),gob$(nobs%) 2220 DIM cy%(nobs%),loc%(get%),flag%(nobs%) 2230 DATA46,38,35,50,13,18,28,42,10,25,26,4,2,7,47,60,43,32 2240 FOR I=1 TO get% 2250 READ loc%(I) 2260 NEXTI 2270 DATAHELP,CARRYING,GO,N,S,W,E,U,D,GET,TAKE,OPEN,EXAMINE,READ,SAY 2280 DATADIG,SWING,CLIMB,LIGHT,OFF,SPRAY,USE,UNLOCK,LEAVE,SCORE,SAVE,LOAD,QUIT,HINT 2290 FOR I=1 TO nvbs% 2300 READ vb$(I) 2310 NEXTI 2320 DATASE,WE,WE,SWE,WE,WE,SWE,WS 2330 DATANS,SE,WE,NW,SE,W,NE,NSW 2340 DATANS,NS,SE,WE,NWUD,SE,WSUD,NS 2350 DATAN,NS,NSE,WE,WE,NSW,NS,NS 2360 DATAS,NSE,NSW,S,NSUD,N,N,NS 2370 DATANE,NW,NE,W,NSE,WE,W,NS 2380 DATASE,NSW,E,WE,NW,S,SW,NW 2390 DATANE,NWE,WE,WE,WE,NWE,NWE,W 2400 FOR I=0 TO 63 2410 READ route$(I) 2420 NEXTI 2430 DATAin a dark corner,in an overgrown garden,by a large woodpile,in a yard by a pile of rubbish 2440 DATAin a weedpatch,in a forest,in a thicker part of the forest,by a blasted tree 2450 DATAby the corner of an old house,at the entrance to the kitchen,in the kitchen _ There is a grimy cooker here,in the scullery 2460 DATAin a room thick with dust,in the rear turret room,in a clearing by an old house,on an old footpath 2470 DATA by the side of an old house,at the back of the hallway,in a dark alcove,in a small dark room 2480 DATA at the bottom of a spiral staircase,in a wide passage,on a set of slippery steps,on a cliff top 2490 DATA near a crumbling wall,in a gloomy passage,in a short corridor,in an impressive hallway 2500 DATA in a hall by a thick wooden door.The door is locked.,in the trophy room,in a cellar with a barred window,on a cliff path 2510 DATA in a cupboard with a coat hanging on the door,in the front hall,in the sitting room,in a secret room 2520 DATA on some steep marble stairs,in the dining room,in a deep cellar.There is a coffin here.It is closed,on a cliff path 2530 DATA in a closet,in the front lobby,in a library full of evil books,in a study.There is a desk here and a weak_looking wall 2540 DATA in a weird cobwebbed room,in an ice_cold chamber,in a very spooky room,on a cliff path.There is a marsh close by 2550 DATA on a rubble_strewn verandah,on the front porch,in the front tower,in a sloping corridoor 2560 DATA in the upper gallery,in a marsh by a wall,in a marsh,on a soggy path 2570 DATA by a twisted railing,on a path through an iron gate,by some old railings,beneath the front tower of an old house 2580 DATAby some debris from a crumbling wall,by some large fallen brickwork,by a rotting stone arch,on a crumbling clifftop 2590 FOR I=0 TO 63 2600 READ loc$(I) 2610 NEXTI 2620 DATA"a painting","a ring","some magic spells","a goblet","an old scroll","some old coins","a small statue","a glove" 2630 DATA"a box of matches","a vacuum cleaner","some batteries","a shovel","an axe","a rope","a small boat","an aerosol spray","a candle","a key" 2640 DATANORTH,SOUTH,WEST,EAST,UP,DOWN 2650 DATADOOR,VAMPIRES,GHOSTS,DRAWER,DESK,COAT,RUBBISH 2660 DATACOFFIN,BOOKS,JELLYBABIES,WALL,SPELLS 2670 DATAPAI,RIN,MAG,GOB,SCR,COI,STA,GLO,MAT,VAC,BAT,SHO,AXE,ROP,BOA,AER,CAN,KEY,NOR,SOU,WES,EAS,UP,DOW,DOO,VAM,GHO,DRA,DES,COA,RUB,COF,BOO,JEL,WAL,SPE 2680 FOR I=1 TO nobs% 2690 READ obj$(I) 2700 NEXTI 2710 FOR I=1 TO nobs% 2720 READ gob$(I) 2730 NEXTI 2740 flag%(18)=1:flag%(17)=1:flag%(2)=1:flag%(26)=1:flag%(28)=1:flag%(23)=1:rm%=57:msge$="Ready" 2750 ENDPROC 2760 DEF PROCsave 2770 INPUT'"IS THE DISC IN THE DRIVE",Y$ 2780 IF LEFT$(Y$,1)<>"Y" THEN2770 2790 INPUT''"What will you call the file",file$ 2800 PRINT''"Saving. Please wait..." 2810 X=OPENOUT file$ 2820 PRINT#X,rm% 2830 FOR I=1 TO get%:PRINT#X,loc%(I):NEXT 2840 FOR I=0 TO 63:PRINT#X,loc$(I):NEXT 2850 FOR I=0 TO 63:PRINT#X,route$(I):NEXT 2860 FOR I=1 TO nobs%:PRINT#X,cy%(I):NEXT 2870 FOR I=1 TO nobs%:PRINT#X,flag%(I):NEXT 2880 CLOSE#X 2890 ENDPROC 2900 DEF PROCload 2910 INPUT'"ARE YOU READY TO LOAD",Y$ 2920 IF LEFT$(Y$,1)<>"Y" THEN2910 2930 INPUT''"What is the name of the file",file$ 2940 PRINT''"Loading. Please wait...." 2950 X=OPENUP file$ 2960 INPUT#X,rm% 2970 FOR I=1 TO get%:INPUT#X,loc%(I):NEXT 2980 FOR I=0TO 63:INPUT#X,loc$(I):NEXT 2990 FOR I=0TO 63:INPUT#X,route$(I):NEXT 3000 FOR I=1 TO nobs%:INPUT#X,cy%(I):NEXT 3010 FOR I=1 TO nobs%:INPUT#X,flag%(I):NEXT 3020 CLOSE#X 3030 3040 ENDPROC 3050 DEF PROCquit 3060 INPUT"ƒARE YOU SURE YOU WANT TO QUIT"in$ 3070 IF in$="N" PRINT"„†GET ON WITH THE ADVENTURE!"'"PRESS A KEY.":REPEATUNTILGET:ENDPROC 3080 INPUT"IF YOU WANT TO SAVE YOUR POSITION, TYPE 'SAVE'"in$ 3090 IF in$<>"SAVE" OSCLI("DESKTOP") 3100 IF in$="SAVE" PROCsave 3110 ENDPROC 3120 DEF PROCINTRO 3130 *FX11,0 3220 PRINT"Welcome to HAUNTED HOUSE adventure." 3230 PRINT''"You have to explore your way around"'"a haunted house." 3240 PRINT"In the house (or perhaps outside) you"'"will have to find seventeen objects" 3250 PRINT"and bring them back to the main gate." 3260 PRINT"You might find yourself in danger so"'"think carefully!" 3270 PRINT'"If you need help, type HELP and" 3280 PRINT"if you want to save the game to continue later, type SAVE." 3290 PRINT'"If you want to know what you are"'"carrying,type CARRYING." 3300 PRINT"If you want to know what your present"'"score is type SCORE.":PRINT 3310 PROCprint("If you want a hint when you are stuck, type HINT",129) 3320 PRINT''"Press any key." 3350 REPEATUNTILGET 3351 key$="To help you, theREDƒkeys have been set up to print some of the most-used words for you, and these will be printed at the bottom of the screen during the game. (But I could only squeeze in the first three letters!)" 3352 PROCprint(key$,131) 3353 PROCcyon 3360 ENDPROC 3370 DEF PROCprint(mess$,colour%) 3380 LOCAL K%,L%,S% 3390 K%=0 3400 PRINTCHR$(colour%); 3410 REPEAT 3420 S%=FNINSTR(mess$," ") 3430 K%=K%+S%:IF K%>38 PRINT'CHR$(colour%);:K%=S% 3440 IF S%>0 THEN PRINT LEFT$(mess$,S%); 3450 mess$=RIGHT$(mess$,LEN(mess$)-S%) 3460 UNTIL S%=0 3470 L%=LEN(mess$):K%=K%+L%:IF K%>38 THEN PRINT'CHR$(colour%); 3480 PRINTmess$ 3490 ENDPROC 3500 DEFFNINSTR(A$,B$) 3510 IF LEN A$