Home » Archimedes archive » Acorn User » AU 1998-08.adf » Freeware » PD/IntFiction/DavidRPG2/!DavidRPG2/Interp
PD/IntFiction/DavidRPG2/!DavidRPG2/Interp
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1998-08.adf » Freeware |
Filename: | PD/IntFiction/DavidRPG2/!DavidRPG2/Interp |
Read OK: | ✔ |
File size: | 929D bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM Byte-code Interpreter for DavidRPG2 20REM (c) David Spence, 1998. 30 40ver$="2.58" 50 60ONERROR PROCERROR 70 80LIBRARY "<DavidRPG2$Dir>.Library" 90LIBRARY "<DavidRPG2$Dir>.<DavidRPG2$Display>" 100PROCdisplay_initstart("Interpreter") 110 120PROCdisplay_special("Byte-code Interpreter for !DavidRPG2 version "+ver$) 130PROCdisplay_special("David Spence, 1998.") 140REMPROCdisplay_special("The error messages reported will be quite vague, sorry!") 150REMPROCdisplay_special("This is only a test version of the intepreter.") 160REMPROCdisplay_special("Don't be suprised if an error in a file crashes this") 170REMPROCdisplay_special("interpreter!") 180PROCdisplay_special(" ") 190 200err=0 210ingame%=FALSE 220 230O=OPENOUT(FNdisplay_tempdir+".temp") 240IF O=0 THEN PROCreport("Can't find !DavidRPG2 - has it been seen by the filer?"):END 250CLOSE#O 260 270REM Loading: 280REM ======== 290REM 300REM Strings: count strings then put into arrary the right size for all the strings to fit. 310REM Variables: make and array for the start values and one for the current values containing the 320REM start values. 330REM Rooms: put in an array the right size for the data (count first). Put all lists into a 340REM separate block of memory, the right size (not an array). 350REM Objects: See rooms. 360REM People: See rooms. 370REM Player: Same as rooms but with a single player. 380REM Code: Array with pointer to memory blocks with the code in. 390 400REM**************************** 410REM NOTE VERY IMPORTANT 420REM person0 and vars0-3 are defined in this program 430 440PROCdisplay_special("Loading...") 450 460REMPROCdisplay_special("Strings...") 470 480O=OPENIN(FNdisplay_tempdir+".Strings") 490line=1 500REPEAT 510IF BGET#O=10 THEN line+=1 520UNTIL EOF#O 530PTR#O=0 540DIM strings$(line) 550FOR I%=0TOline-1 560strings$(I%)=GET$#O 570NEXT 580CLOSE#O 590 600REMPROCdisplay_special("Variables...") 610 620O=OPENIN(FNdisplay_tempdir+".Vars") 630E=-4 640IF EXT#O>0 THEN 650E=INT((EXT#O)/10) 660IF E<>((EXT#O)/10) THEN PROCreport("Error in variable file."):CLOSE#O:END 670DIM start_vars(E+3):REM 4 vars are defined in this prog. 680FOR I%=1TOE 690INPUT#O,T% 700INPUT#O,U% 710start_vars(T%)=U% 720NEXT 730ENDIF 740CLOSE#O 750IF E=-4 THEN E=0:DIM start_vars(E+3) 760DIM cur_vars(E+3) 770cur_vars()=start_vars() 780 790REMPROCdisplay_special("Rooms...") 800 810O=OPENIN(FNdisplay_tempdir+".Rooms") 820INPUT#O,rooms% 830INPUT#O,start_room% 840IF rooms%=0 THEN PROCreport("No Rooms."):CLOSEE#O:END 850rooms%-=1 860DIM rooms%(rooms%,17,1) 870FOR L%=0 TO rooms%-2 880INPUT#O,I% 890FOR J%=0 TO 14 :REM these donot need blocks 900INPUT#O,rooms%(I%,J%,0) 910INPUT#O,rooms%(I%,J%,1) 920NEXT 930INPUT#O,in1% 940INPUT#O,in2% 950IF in1%=0 AND in2%=0THEN 960rooms%(I%,15,0)=0 970rooms%(I%,15,1)=0 980ELSE 990g=(PTR#O)-10 1000c=1 1010WHILE in1%<>0 OR in2%<>0 1020INPUT#O,in1% 1030INPUT#O,in2% 1040c+=1 1050ENDWHILE 1060DIM temp 4*2*c 1070PTR#O=g 1080FOR J%=0TO c-1 1090INPUT#O,in1% 1100INPUT#O,in2% 1110temp!((4*J%*2)+0)=in1% 1120temp!((4*J%*2)+4)=in2% 1130NEXT 1140IF in1%<>0 OR in2%<>0 THEN STOP 1150rooms%(I%,15,1)=temp 1160ENDIF 1170INPUT#O,in1% 1180INPUT#O,in2% 1190IF in1%=0 AND in2%=0THEN 1200rooms%(I%,16,0)=0 1210rooms%(I%,16,1)=0 1220ELSE 1230g=(PTR#O)-10 1240c=1 1250WHILE in1%<>0 OR in2%<>0 1260INPUT#O,in1% 1270INPUT#O,in2% 1280c+=1 1290ENDWHILE 1300DIM temp 4*2*c 1310PTR#O=g 1320FOR J%=0TO c-1 1330INPUT#O,in1% 1340INPUT#O,in2% 1350temp!((4*J%*2)+0)=in1% 1360temp!((4*J%*2)+4)=in2% 1370NEXT 1380IF in1%<>0 OR in2%<>0 THEN STOP 1390rooms%(I%,16,1)=temp 1400ENDIF 1410INPUT#O,in1% 1420INPUT#O,in2% 1430INPUT#O,in3% 1440INPUT#O,in4% 1450IF in1%=0 AND in2%=0 AND in3%=0 AND in4%=0THEN 1460rooms%(I%,17,0)=0 1470rooms%(I%,17,1)=0 1480ELSE 1490g=(PTR#O)-20 1500c=1 1510WHILE in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0 1520INPUT#O,in1% 1530INPUT#O,in2% 1540INPUT#O,in3% 1550INPUT#O,in4% 1560c+=1 1570ENDWHILE 1580DIM temp 4*4*c 1590PTR#O=g 1600FOR J%=0TO c-1 1610INPUT#O,in1% 1620INPUT#O,in2% 1630INPUT#O,in3% 1640INPUT#O,in4% 1650temp!((4*J%*4)+0)=in1% 1660temp!((4*J%*4)+4)=in2% 1670temp!((4*J%*4)+8)=in3% 1680temp!((4*J%*4)+12)=in4% 1690NEXT 1700IF in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0THEN STOP 1710rooms%(I%,17,1)=temp 1720ENDIF 1730NEXT 1740CLOSE#O 1750 1760REMPROCdisplay_special("Objects...") 1770 1780O=OPENIN(FNdisplay_tempdir+".Object") 1790INPUT#O,objects% 1800objects%-=1 1810DIM objects%(objects%,8,1) 1820FOR L%=0 TO objects% 1830INPUT#O,I% 1840FOR J%=0 TO 6 :REM these donot need blocks 1850INPUT#O,objects%(I%,J%,0) 1860CASE J% OF 1870WHEN 3,4,5: 1880OTHERWISE INPUT#O,objects%(I%,J%,1) 1890ENDCASE 1900NEXT 1910INPUT#O,in1% 1920INPUT#O,in2% 1930INPUT#O,in3% 1940INPUT#O,in4% 1950IF in1%=0 AND in2%=0 AND in3%=0 AND in4%=0THEN 1960objects%(I%,7,0)=0 1970objects%(I%,7,1)=0 1980ELSE 1990g=(PTR#O)-20 2000c=1 2010WHILE in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0 2020INPUT#O,in1% 2030INPUT#O,in2% 2040INPUT#O,in3% 2050INPUT#O,in4% 2060c+=1 2070ENDWHILE 2080DIM temp 4*4*c 2090PTR#O=g 2100FOR J%=0TO c-1 2110INPUT#O,in1% 2120INPUT#O,in2% 2130INPUT#O,in3% 2140INPUT#O,in4% 2150temp!((4*J%*4)+0)=in1% 2160temp!((4*J%*4)+4)=in2% 2170temp!((4*J%*4)+8)=in3% 2180temp!((4*J%*4)+12)=in4% 2190NEXT 2200IF in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0THEN STOP 2210objects%(I%,7,1)=temp 2220ENDIF 2230INPUT#O,in1% 2240INPUT#O,in2% 2250INPUT#O,in3% 2260INPUT#O,in4% 2270IF in1%=0 AND in2%=0 AND in3%=0 AND in4%=0THEN 2280objects%(I%,8,0)=0 2290objects%(I%,8,1)=0 2300ELSE 2310g=(PTR#O)-20 2320c=1 2330WHILE in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0 2340INPUT#O,in1% 2350INPUT#O,in2% 2360INPUT#O,in3% 2370INPUT#O,in4% 2380c+=1 2390ENDWHILE 2400DIM temp 4*4*c 2410PTR#O=g 2420FOR J%=0TO c-1 2430INPUT#O,in1% 2440INPUT#O,in2% 2450INPUT#O,in3% 2460INPUT#O,in4% 2470temp!((4*J%*4)+0)=in1% 2480temp!((4*J%*4)+4)=in2% 2490temp!((4*J%*4)+8)=in3% 2500temp!((4*J%*4)+12)=in4% 2510NEXT 2520IF in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0THEN STOP 2530objects%(I%,8,1)=temp 2540ENDIF 2550NEXT 2560CLOSE#O 2570 2580REMPROCdisplay_special("People...") 2590 2600O=OPENIN(FNdisplay_tempdir+".People") 2610INPUT#O,people% 2620people%-=1 2630DIM people%(people%,11,1) 2640FOR L%=0 TO people% 2650INPUT#O,I% 2660FOR J%=0 TO 8 :REM these donot need blocks 2670INPUT#O,people%(I%,J%,0) 2680CASE J% OF 2690WHEN 3,4,5: 2700OTHERWISE INPUT#O,people%(I%,J%,1) 2710ENDCASE 2720NEXT 2730 2740INPUT#O,in1% 2750INPUT#O,in2% 2760IF in1%=0 AND in2%=0THEN 2770people%(I%,9,0)=0 2780people%(I%,9,1)=0 2790ELSE 2800g=(PTR#O)-10 2810c=1 2820WHILE in1%<>0 OR in2%<>0 2830INPUT#O,in1% 2840INPUT#O,in2% 2850c+=1 2860ENDWHILE 2870DIM temp 4*2*c 2880PTR#O=g 2890FOR J%=0TO c-1 2900INPUT#O,in1% 2910INPUT#O,in2% 2920temp!((4*J%*2)+0)=in1% 2930temp!((4*J%*2)+4)=in2% 2940NEXT 2950IF in1%<>0 OR in2%<>0 THEN STOP 2960people%(I%,9,1)=temp 2970ENDIF 2980INPUT#O,in1% 2990INPUT#O,in2% 3000INPUT#O,in3% 3010INPUT#O,in4% 3020IF in1%=0 AND in2%=0 AND in3%=0 AND in4%=0THEN 3030people%(I%,10,0)=0 3040people%(I%,10,1)=0 3050ELSE 3060g=(PTR#O)-20 3070c=1 3080WHILE in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0 3090INPUT#O,in1% 3100INPUT#O,in2% 3110INPUT#O,in3% 3120INPUT#O,in4% 3130c+=1 3140ENDWHILE 3150DIM temp 4*4*c 3160PTR#O=g 3170FOR J%=0TO c-1 3180INPUT#O,in1% 3190INPUT#O,in2% 3200INPUT#O,in3% 3210INPUT#O,in4% 3220temp!((4*J%*4)+0)=in1% 3230temp!((4*J%*4)+4)=in2% 3240temp!((4*J%*4)+8)=in3% 3250temp!((4*J%*4)+12)=in4% 3260NEXT 3270IF in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0THEN STOP 3280people%(I%,10,1)=temp 3290ENDIF 3300INPUT#O,in1% 3310INPUT#O,in2% 3320INPUT#O,in3% 3330INPUT#O,in4% 3340IF in1%=0 AND in2%=0 AND in3%=0 AND in4%=0THEN 3350people%(I%,11,0)=0 3360people%(I%,11,1)=0 3370ELSE 3380g=(PTR#O)-20 3390c=1 3400WHILE in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0 3410INPUT#O,in1% 3420INPUT#O,in2% 3430INPUT#O,in3% 3440INPUT#O,in4% 3450c+=1 3460ENDWHILE 3470DIM temp 4*4*c 3480PTR#O=g 3490FOR J%=0TO c-1 3500INPUT#O,in1% 3510INPUT#O,in2% 3520INPUT#O,in3% 3530INPUT#O,in4% 3540temp!((4*J%*4)+0)=in1% 3550temp!((4*J%*4)+4)=in2% 3560temp!((4*J%*4)+8)=in3% 3570temp!((4*J%*4)+12)=in4% 3580NEXT 3590IF in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0THEN STOP 3600people%(I%,11,1)=temp 3610ENDIF 3620NEXT 3630CLOSE#O 3640 3650REMPROCdisplay_special("Player...") 3660 3670O=OPENIN(FNdisplay_tempdir+".Player") 3680DIM player%(7,1) 3690FOR J%=0 TO 4 :REM these donot need blocks 3700INPUT#O,player%(J%,0) 3710CASE J% OF 3720WHEN 3: 3730OTHERWISE INPUT#O,player%(J%,1) 3740ENDCASE 3750NEXT 3760INPUT#O,in1% 3770INPUT#O,in2% 3780IF in1%=0 AND in2%=0THEN 3790player%(5,0)=0 3800player%(5,1)=0 3810ELSE 3820g=(PTR#O)-10 3830c=1 3840WHILE in1%<>0 OR in2%<>0 3850INPUT#O,in1% 3860INPUT#O,in2% 3870c+=1 3880ENDWHILE 3890DIM temp 4*2*c 3900PTR#O=g 3910FOR J%=0TO c-1 3920INPUT#O,in1% 3930INPUT#O,in2% 3940temp!((4*J%*2)+0)=in1% 3950temp!((4*J%*2)+4)=in2% 3960NEXT 3970IF in1%<>0 OR in2%<>0 THEN STOP 3980player%(5,1)=temp 3990ENDIF 4000INPUT#O,in1% 4010INPUT#O,in2% 4020INPUT#O,in3% 4030INPUT#O,in4% 4040IF in1%=0 AND in2%=0 AND in3%=0 AND in4%=0THEN 4050player%(6,0)=0 4060player%(6,1)=0 4070ELSE 4080g=(PTR#O)-20 4090c=1 4100WHILE in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0 4110INPUT#O,in1% 4120INPUT#O,in2% 4130INPUT#O,in3% 4140INPUT#O,in4% 4150c+=1 4160ENDWHILE 4170DIM temp 4*4*c 4180PTR#O=g 4190FOR J%=0TO c-1 4200INPUT#O,in1% 4210INPUT#O,in2% 4220INPUT#O,in3% 4230INPUT#O,in4% 4240temp!((4*J%*4)+0)=in1% 4250temp!((4*J%*4)+4)=in2% 4260temp!((4*J%*4)+8)=in3% 4270temp!((4*J%*4)+12)=in4% 4280NEXT 4290IF in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0THEN STOP 4300player%(6,1)=temp 4310ENDIF 4320INPUT#O,in1% 4330INPUT#O,in2% 4340INPUT#O,in3% 4350INPUT#O,in4% 4360IF in1%=0 AND in2%=0 AND in3%=0 AND in4%=0THEN 4370player%(7,0)=0 4380player%(7,1)=0 4390ELSE 4400g=(PTR#O)-20 4410c=1 4420WHILE in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0 4430INPUT#O,in1% 4440INPUT#O,in2% 4450INPUT#O,in3% 4460INPUT#O,in4% 4470c+=1 4480ENDWHILE 4490DIM temp 4*4*c 4500PTR#O=g 4510FOR J%=0TO c-1 4520INPUT#O,in1% 4530INPUT#O,in2% 4540INPUT#O,in3% 4550INPUT#O,in4% 4560temp!((4*J%*4)+0)=in1% 4570temp!((4*J%*4)+4)=in2% 4580temp!((4*J%*4)+8)=in3% 4590temp!((4*J%*4)+12)=in4% 4600NEXT 4610IF in1%<>0 OR in2%<>0 OR in3%<>0 OR in4%<>0THEN STOP 4620player%(7,1)=temp 4630ENDIF 4640CLOSE#O 4650 4660REMPROCdisplay_special("Code...") 4670 4680O=OPENIN(FNdisplay_tempdir+".Code") 4690IF O=0 OR EXT#O=0 THEN 4700IF O<>0 THENCLOSE#O 4710DIM code%(1) 4720ELSE 4730code%=0 4740REPEAT 4750end=FALSE 4760REPEAT 4770INPUT#O,ins% 4780CASE ins% OF 4790WHEN 0:end=TRUE 4800WHEN 5,10: 4810WHEN 1,2,6:INPUT#O,u%:INPUT#O,u% 4820WHEN 3,4,8,7:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:INPUT#O,u% 4830WHEN 9:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:INPUT#O,u% 4840ENDCASE 4850UNTIL end 4860code%+=1 4870UNTIL EOF#O 4880PTR#O=0 4890DIM code%(code%) 4900FOR o%=1 TO code% 4910t=PTR#O 4920end=FALSE 4930word=0 4940REPEAT 4950INPUT#O,ins%:word+=1 4960CASE ins% OF 4970WHEN 0:end=TRUE 4980WHEN 5,10: 4990WHEN 1,2,6:INPUT#O,u%:INPUT#O,u%:word+=2 5000WHEN 3,4,8,7:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:word+=4 5010WHEN 9:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:INPUT#O,u%:word+=6 5020ENDCASE 5030UNTIL end 5040DIM temp (word+1)*4 5050PTR#O=t 5060FOR I%=0TO word-1 5070INPUT#O,j% 5080temp!(I%*4)=j% 5090NEXT 5100IF j%<>0 THEN STOP 5110code%(o%)=temp 5120NEXT 5130CLOSE#O 5140ENDIF 5150 5160DIM object_place(objects%,1) 5170DIM people_place(people%,1) 5180DIM temp(256) 5190 5200PROCdisplay_special("DONE.") 5210PROCdisplay_initend 5220REPEAT 5230PROCdisplay_poll 5240UNTIL 0 5250END 5260 5270DEFPROCrestart_interp 5280PROCJump("go") 5290ENDPROC 5300 5310DEFFNgo 5320REM restart interpreter 5330ingame%=TRUE 5340display$="" 5350disps=0 5360PROCdisplay_special(" ") 5370PROCdisplay_special("New game Started...") 5380FOR I%=0TO2 5390PROCdisplay_special(" ") 5400PROCdisplay_poll 5410NEXT 5420PROCstart_screen 5430PROCdisplay(" ") 5440PROCdisplay_poll 5450cur_vars()=start_vars() 5460c_room%=start_room% 5470o_room=-1 5480PROCrepos_objects 5490PROCrepos_people 5500PROCcallcode(rooms%(c_room%,13,1),1,c_room%) 5510FOR I%=0 TO people% 5520IF people_place(I%,0)=1 AND people_place(I%,1)=c_room% THEN PROCcallcode(people%(I%,7,1),3,I%) 5530NEXT 5540REPEAT 5550IF c_room%<>o_room THEN PROCshow ELSE PROCdisplay(" ") 5560o_room=c_room% 5570PROCdisplay_poll 5580curline$=FNinput 5590PROCdo 5600UNTIL 0 5610=0 5620 5630DEFPROCstart_screen 5640PROCdisplay("You are "+FNgetstring(player%(0,1))+".") 5650fs=player%(1,1) 5660ls=player%(2,1) 5670FOR y%=fs TO ls 5680PROCdisplay(FNgetstring(y%)) 5690NEXT 5700PROCdisplay(" ") 5710PROCdisplay("Press return to continue.") 5720y$=FNinput 5730PROCdisplay(" ") 5740PROCdisplay(" ") 5750ENDPROC 5760 5770DEFPROCdo 5780REM **************first directions.... 5790IF FNfirst(curline$)="GO" THEN curline$=FNnotfirst(curline$) 5800CASE FNfirst(curline$) OF 5810WHEN "U","UP": 5820IF U= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(7) 5830WHEN "D","DOWN": 5840IF D= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(8) 5850WHEN "N","NORTH": 5860IF N= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(6) 5870WHEN "S","SOUTH": 5880IF S= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(5) 5890WHEN "E","EAST": 5900IF E= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(3) 5910WHEN "W","WEST": 5920IF W= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(4) 5930WHEN "NW","NORTHWEST": 5940IF NW= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(12) 5950WHEN "SW","SOUTHWEST": 5960IF SW= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(10) 5970WHEN "NE","NORTHEAST": 5980IF NE= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(11) 5990WHEN "SE","SOUTHEAST": 6000IF SE= FALSE THEN PROCreport("There is no exit in that direction.") ELSE PROCd(9) 6010REM ************....then get, put, talk,.... 6020WHEN "GET":PROCget(FNnotfirst(curline$)) 6030WHEN "PICK":IF FNfirst(FNnotfirst(curline$))="UP" THEN 6040PROCget(FNnotfirst(FNnotfirst(curline$))) 6050ELSE 6060PROCdisplay("I don't Understand.") 6070ENDIF 6080WHEN "PUT":IF FNfirst(FNnotfirst(curline$))="DOWN" THEN 6090PROCdrop(FNnotfirst(FNnotfirst(curline$))) 6100ELSE 6110PROCdisplay("I don't Understand.") 6120ENDIF 6130WHEN "DROP":PROCdrop(FNnotfirst(curline$)) 6140WHEN "SAY":PROCtalk(FNnotfirst(curline$)) 6150WHEN "INV","INVENTORY":PROCinv 6160WHEN "LOOK":PROClook(FNnotfirst(curline$)) 6170WHEN "DESCRIBE":PROClook(FNnotfirst(curline$)) 6180WHEN "HELP","?":PROChelp 6190REM ************....finally any of the form "<verb> <object|person>", "<verb> <object|person> with|using <object>", "Use <object> to <verb> <object|person>" and "<verb>" 6200OTHERWISE: 6210IF INSTR(curline$," WITH ")<>0 OR INSTR(curline$," USING ")<>0 THEN 6220PROCtype_b_verb 6230ELSE 6240IF INSTR(curline$," TO ")<>0 THEN 6250PROCtype_c_verb 6260ELSE 6270IF FNnotfirst(curline$)="" THEN PROCtype_d_verb ELSE PROCtype_a_verb 6280ENDIF 6290ENDIF 6300ENDCASE 6310ENDPROC 6320 6330DEFPROCtype_d_verb 6340REM call room only. 6350l=FALSE 6360li$=FNstrip(FNstrip_end(curline$)) 6370IF rooms%(c_room%,17,1)<>0 THEN 6380 bo=rooms%(c_room%,17,1) 6390 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 6400 fl$=FNgetstring(bo!4) 6410 IF FNkeyword_look(fl$,li$)=TRUE THEN PROCcallcode(bo!12,1,c_room%):l=TRUE 6420 bo+=16 6430 ENDWHILE 6440ENDIF 6450IF player%(7,1)<>0 THEN 6460 bo=player%(7,1) 6470 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 6480 fl$=FNgetstring(bo!4) 6490 IF FNkeyword_look(fl$,li$)=TRUE THEN PROCcallcode(bo!12,3,0):l=TRUE 6500 bo+=16 6510 ENDWHILE 6520ENDIF 6530IF l=FALSE THEN PROCdisplay("You can't "+li$+".") 6540ENDPROC 6550 6560DEFPROCtype_a_verb 6570REM call room, object, person|object|player 6580REM user has to have an object which can <verb> or the player must be able to <verb> and there 6590REM must be an object|person|player in the room with the name. 6600REM this is big. 6610REM right first extract data... 6620verb$= FNstrip(FNstrip_end(FNfirst(curline$))) 6630obpers$= FNstrip(FNstrip_end(FNnotfirst(curline$))) 6640IF FNfirst(obpers$)="THE" THEN obpers$=FNnotfirst(obpers$) 6650REM check we can do this... 6660verb=0:obpers=0 6670IF player%(7,1)<>0 THEN 6680 bo=player%(7,1) 6690 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 6700 fl$=FNgetstring(bo!4) 6710 IF FNkeyword_look(fl$,verb$)=TRUE THEN verb=1 6720 bo+=16 6730 ENDWHILE 6740ENDIF 6750FOR Io%=0 TO objects% 6760 IF object_place(Io%,0)=3 AND object_place(Io%,1)=0 THEN 6770 IF objects%(Io%,8,1)<>0 THEN 6780 bo=objects%(Io%,8,1) 6790 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 6800 fl$=FNgetstring(bo!4) 6810 IF FNkeyword_look(fl$,verb$)=TRUE THEN verb=1 6820 bo+=16 6830 ENDWHILE 6840 ENDIF 6850 ENDIF 6860NEXT 6870FOR Io%=0TO people% 6880IF people_place(Io%,1)=c_room% AND FNtoupper(FNgetstring(people%(Io%,0,1)))=obpers$ THENobpers=1 6890NEXT 6900FOR Io%=0TO objects% 6910IF object_place(Io%,1)=c_room% AND object_place(Io%,0)=1 AND FNtoupper(FNgetstring(objects%(Io%,0,1)))=obpers$ THENobpers=1 6920NEXT 6930IF obpers=0 THEN 6940 IF obpers$="ME" OR obpers$="MYSELF" obpers$=FNtoupper(FNgetstring(player%(0,1))) TEHN obpers=2 6950ENDIF 6960IF verb=0 OR obpers=0 THEN 6970IF verb=0 THEN PROCdisplay("You can't "+verb$+".") 6980IF obpers=0 THEN PROCdisplay("There's not a "+obpers$+".") 6990ELSE 7000REM call room 7010IF rooms%(c_room%,17,1)<>0 THEN 7020 bo=rooms%(c_room%,17,1) 7030 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 7040 fl$=FNgetstring(bo!4) 7050 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,1,c_room%) 7060 bo+=16 7070 ENDWHILE 7080ENDIF 7090REM call objects and player 7100IF player%(7,1)<>0 THEN 7110 bo=player%(7,1) 7120 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 7130 fl$=FNgetstring(bo!4) 7140 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,3,0): 7150 bo+=16 7160 ENDWHILE 7170ENDIF 7180FOR Io%=0 TO objects% 7190 IF object_place(Io%,0)=3 AND object_place(Io%,1)=0 THEN 7200 IF objects%(Io%,8,1)<>0 THEN 7210 bo=objects%(Io%,8,1) 7220 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 7230 fl$=FNgetstring(bo!4) 7240 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,2,Io%) 7250 bo+=16 7260 ENDWHILE 7270 ENDIF 7280 ENDIF 7290NEXT 7300REM call the thing the act is bestowed upon 7310FOR Io%=0TO people% 7320IF people_place(Io%,1)=c_room% AND FNtoupper(FNgetstring(people%(Io%,0,1)))=obpers$ THEN 7330 IF people%(Io%,10,1)<>0 THEN 7340 bo=people%(Io%,10,1) 7350 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 7360 fl$=FNgetstring(bo!4) 7370 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,3,Io%) 7380 bo+=16 7390 ENDWHILE 7400 ENDIF 7410ENDIF 7420NEXT 7430FOR Io%=0TO objects% 7440IF object_place(Io%,1)=c_room% AND object_place(Io%,0)=1 AND FNtoupper(FNgetstring(objects%(Io%,0,1)))=obpers$ THEN 7450 IF objects%(Io%,7,1)<>0 THEN 7460 bo=objects%(Io%,7,1) 7470 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 7480 fl$=FNgetstring(bo!4) 7490 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,2,Io%) 7500 bo+=16 7510 ENDWHILE 7520 ENDIF 7530ENDIF 7540NEXT 7550IF obpers=2 THEN 7560IF player%(6,1)<>0 THEN 7570 bo=player%(6,1) 7580 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 7590 fl$=FNgetstring(bo!4) 7600 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,3,0): 7610 bo+=16 7620 ENDWHILE 7630ENDIF 7640ENDIF 7650ENDIF 7660ENDPROC 7670 7680DEFPROCtype_b_verb 7690REM "<verb> <object|person> with|using <object>" 7700REM call room, object, person|object|player 7710REM user has to have an object with the name and there 7720REM must be an object|person|player in the room with the name. 7730f=FALSE 7740verb$=FNfirst(curline$) 7750curline$=FNnotfirst(curline$) 7760IF curline$="" THEN f=TRUE 7770IF INSTR(curline$," WITH ")<>0 THEN 7780obpers$=MID$(curline$,1,INSTR(curline$," WITH ")-1) 7790curline$=MID$(curline$,INSTR(curline$," WITH ")+6) 7800ELSE 7810IF INSTR(curline$," USING ")<>0 THEN 7820obpers$=MID$(curline$,1,INSTR(curline$," USING ")-1) 7830curline$=MID$(curline$,INSTR(curline$," USING ")+7) 7840ELSE 7850f=TRUE 7860ENDIF 7870ENDIF 7880IF curline$="" THEN f=TRUE 7890object$=curline$ 7900IF FNfirst(object$)="THE" THEN object$=FNnotfirst(object$) 7910IF FNfirst(obpers$)="THE" THEN obpers$=FNnotfirst(obpers$) 7920PROCfull_verb(verb$,obpers$,object$) 7930ENDPROC 7940 7950DEFPROCtype_c_verb 7960REM "Use <object> to <verb> <object|person>" 7970REM call room, object, person|object|player 7980REM user has to have an object with the name and there 7990REM must be an object|person|player in the room with the name. 8000curline$=FNnotfirst(curline$) 8010IF FNfirst(curline$)="THE" THEN curline$=FNnotfirst(curline$) 8020object$=MID$(curline$,1,INSTR(curline$," TO ")-1) 8030curline$=MID$(curline$,INSTR(curline$," TO ")+4) 8040verb$=FNfirst(curline$) 8050curline$=FNnotfirst(curline$) 8060obpers$=curline$ 8070IF FNfirst(obpers$)="THE" THEN obpers$=FNnotfirst(obpers$) 8080PROCfull_verb(verb$,obpers$,object$) 8090ENDPROC 8100 8110DEFPROCfull_verb(verb$,to$,from$) 8120verb=0:to=0:from=0 8130IF player%(7,1)<>0 THEN 8140 bo=player%(7,1) 8150 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 8160 fl$=FNgetstring(bo!4) 8170 IF FNkeyword_look(fl$,verb$)=TRUE THEN verb=1 8180 bo+=16 8190 ENDWHILE 8200ENDIF 8210FOR Io%=0 TO objects% 8220 IF object_place(Io%,0)=3 AND object_place(Io%,1)=0 THEN 8230 IF objects%(Io%,8,1)<>0 THEN 8240 bo=objects%(Io%,8,1) 8250 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 8260 fl$=FNgetstring(bo!4) 8270 IF FNkeyword_look(fl$,verb$)=TRUE THEN verb=1 8280 bo+=16 8290 ENDWHILE 8300 ENDIF 8310 ENDIF 8320NEXT 8330FOR Io%=0TO people% 8340IF people_place(Io%,1)=c_room% AND FNtoupper(FNgetstring(people%(Io%,0,1)))=to$ THEN to=1 8350NEXT 8360FOR Io%=0TO objects% 8370IF object_place(Io%,1)=c_room% AND object_place(Io%,0)=1 AND FNtoupper(FNgetstring(objects%(Io%,0,1)))=to$ THEN to=1 8380IF object_place(Io%,1)=0 AND object_place(Io%,0)=3 AND FNtoupper(FNgetstring(objects%(Io%,0,1)))=from$ THEN from=Io% 8390NEXT 8400IF to=0 THEN 8410 IF to$="ME" OR to$="MYSELF" to$=FNtoupper(FNgetstring(player%(0,1))) TEHN to=2 8420ENDIF 8430IF verb=0 OR to=0 OR from=0 THEN 8440IF verb=0 THEN PROCdisplay("It can't "+verb$+".") 8450IF to=0 THEN PROCdisplay("There's not a "+to$+".") 8460IF from=0 THEN PROCdisplay("You havn't got a "+from$+".") 8470ELSE 8480Io%=from 8490 IF object_place(Io%,0)=3 AND object_place(Io%,1)=0 THEN 8500 IF objects%(Io%,8,1)<>0 THEN 8510 bo=objects%(Io%,8,1) 8520 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 8530 fl$=FNgetstring(bo!4) 8540 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,2,Io%) 8550 bo+=16 8560 ENDWHILE 8570 ENDIF 8580 ENDIF 8590REM call the thing the act is bestowed upon 8600FOR Io%=0 TO people% 8610IF people_place(Io%,1)=c_room% AND FNtoupper(FNgetstring(people%(Io%,0,1)))=to$ THEN 8620 IF people%(Io%,10,1)<>0 THEN 8630 bo=people%(Io%,10,1) 8640 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 8650 fl$=FNgetstring(bo!4) 8660 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,3,Io%) 8670 bo+=16 8680 ENDWHILE 8690 ENDIF 8700ENDIF 8710NEXT 8720FOR Io%=0TO objects% 8730IF object_place(Io%,1)=c_room% AND object_place(Io%,0)=1 AND FNtoupper(FNgetstring(objects%(Io%,0,1)))=to$ THEN 8740 IF objects%(Io%,7,1)<>0 THEN 8750 bo=objects%(Io%,7,1) 8760 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 8770 fl$=FNgetstring(bo!4) 8780 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,2,Io%) 8790 bo+=16 8800 ENDWHILE 8810 ENDIF 8820ENDIF 8830NEXT 8840IF to=2 THEN 8850IF player%(6,1)<>0 THEN 8860 bo=player%(6,1) 8870 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 8880 fl$=FNgetstring(bo!4) 8890 IF FNkeyword_look(fl$,verb$)=TRUE THEN PROCcallcode(bo!12,3,0): 8900 bo+=16 8910 ENDWHILE 8920ENDIF 8930ENDIF 8940ENDIF 8950ENDPROC 8960 8970DEFPROClook(ii$) 8980ii$=FNstrip(FNstrip_end(ii$)) 8990IF ii$="" THEN 9000PROCshow 9010ELSE 9020IF FNfirst(ii$)="AT" THEN ii$=FNnotfirst(ii$) 9030IF FNfirst(ii$)="THE" THEN ii$=FNnotfirst(ii$) 9040ii$=FNstrip(FNstrip_end(ii$)) 9050FOR Io%=0 TO people% 9060IF FNtoupper(FNgetstring(people%(Io%,0,1)))=ii$ THEN 9070PROCdescribe(people%(Io%,0,1),people%(Io%,1,1),people%(Io%,2,1)) 9080ENDIF 9090NEXT 9100FOR Io%=0TOobjects% 9110IF FNtoupper(FNgetstring(objects%(Io%,0,1)))=ii$ THEN 9120PROCdescribe(objects%(Io%,0,1),objects%(Io%,1,1),objects%(Io%,2,1)) 9130ENDIF 9140NEXT 9150ENDIF 9160ENDPROC 9170 9180DEFPROCdescribe(a,b,c) 9190PROCdisplay(" ") 9200PROCdisplay(FNgetstring(a)+":") 9210FOR Iy%=b TO c 9220PROCdisplay(FNgetstring(Iy%)) 9230NEXT 9240ENDPROC 9250 9260DEFPROChelp 9270PROCdisplay(" ") 9280PROCdisplay("-----------------------------------------------------------") 9290PROCdisplay("Help:") 9300PROCdisplay("-----------------------------------------------------------") 9310PROCdisplay(" ") 9320PROCdisplay(" n,s,e,w,u,d,ne,nw,se and sw : Go in a direction.") 9330PROCdisplay(" ") 9340PROCdisplay(" inv : Inventory.") 9350PROCdisplay(" ") 9360PROCdisplay(" get <object> : Get an object.") 9370PROCdisplay(" ") 9380PROCdisplay(" drop <object> : drop and object.") 9390PROCdisplay(" ") 9400PROCdisplay(" say <sentance> : say something.") 9410PROCdisplay(" ") 9420PROCdisplay(" look [<object|person>] : look at something.") 9430PROCdisplay(" ") 9440PROCdisplay("Actions:") 9450PROCdisplay(" <verb> [the] <object|person>") 9460PROCdisplay(" <verb> [the] <object|person> with|using [the] <object>") 9470PROCdisplay(" Use [the] <object> to <verb> [the] <object|person>") 9480PROCdisplay(" <verb>") 9490PROCdisplay(" ") 9500PROCdisplay("-----------------------------------------------------------") 9510PROCdisplay(" ") 9520ENDPROC 9530 9540DEFPROCinv 9550n_o=0 9560FOR I%=0 TO objects% 9570IF object_place(I%,0)=3 AND object_place(I%,1)=0 THEN temp(n_o)=I%:n_o+=1 9580NEXT 9590CASE n_o OF 9600WHEN 0:PROCdisplay("You have no objects.") 9610WHEN 1:PROCdisplay("You have a "+FNgetstring(objects%(temp(0),0,1))+".") 9620WHEN 2:PROCdisplay("You have a "+FNgetstring(objects%(temp(0),0,1))+" and "+FNgetstring(objects%(temp(1),0,1))+".") 9630OTHERWISE 9640l$="You have a " 9650FOR I%=0 TO n_o-3 9660l$+=FNgetstring(objects%(temp(I%),0,1))+", a " 9670NEXT 9680l$+=FNgetstring(objects%(temp(n_o-2),0,1))+" and a "+FNgetstring(objects%(temp(n_o-1),0,1))+"." 9690PROCdisplay(l$) 9700ENDCASE 9710ENDPROC 9720 9730DEFPROCtalk(lo$) 9740li$=FNstrip(FNstrip_end(lo$)) 9750FOR Io%=0 TO people% 9760IF people_place(Io%,1)=c_room% THEN 9770IF people%(Io%,11,1)<>0 THEN 9780 bo=people%(Io%,11,1) 9790 WHILE !bo<>0 OR bo!4<>0 OR bo!8<>0 OR bo!12<>0 9800 fl$=FNgetstring(bo!4) 9810 IF FNkeyword_look(fl$,li$)=TRUE THENPROCcallcode(bo!12,3,Io%) 9820 bo+=16 9830 ENDWHILE 9840ENDIF 9850ENDIF 9860NEXT 9870ENDPROC 9880 9890DEFPROCget(lo$) 9900IF FNfirst(lo$)="THE" THEN lo$=FNnotfirst(lo$) 9910li$=FNstrip(FNstrip_end(lo$)) 9920p=FALSE 9930FOR I%=0 TO objects% 9940IF object_place(I%,0)=1 AND object_place(I%,1)=c_room% THEN 9950 IF FNtoupper(FNgetstring(objects%(I%,0,1)))=li$ THEN 9960 p=TRUE 9970 IF objects%(I%,4,0)<>-1 THEN 9980 PROCdisplay("You try to move the "+FNgetstring(objects%(I%,0,1))+" but it won't move.") 9990 ELSE 10000 object_place(I%,0)=3 10010 object_place(I%,1)=0 10020 PROCdisplay("You get the "+FNgetstring(objects%(I%,0,1))+".") 10030 ENDIF 10040 ENDIF 10050ENDIF 10060NEXT 10070IF p=FALSE THEN PROCdisplay("You cannot see the "+lo$) 10080ENDPROC 10090 10100DEFPROCdrop(lo$) 10110IF FNfirst(lo$)="THE" THEN lo$=FNnotfirst(lo$) 10120li$=FNstrip(FNstrip_end(lo$)) 10130p=FALSE 10140FOR I%=0 TO objects% 10150IF object_place(I%,0)=3 AND object_place(I%,1)=0 THEN 10160 IF FNtoupper(FNgetstring(objects%(I%,0,1)))=li$ THEN 10170 p=TRUE 10180 IF objects%(I%,4,0)<>-1 THEN 10190 PROCdisplay("You try to drop the "+FNgetstring(objects%(I%,0,1))+" but you can't.") 10200 ELSE 10210 object_place(I%,0)=1 10220 object_place(I%,1)=c_room% 10230 PROCdisplay("You drop the "+FNgetstring(objects%(I%,0,1))+".") 10240 ENDIF 10250 ENDIF 10260ENDIF 10270NEXT 10280IF p=FALSE THEN PROCdisplay("You cannot see the "+lo$) 10290ENDPROC 10300 10310DEFPROCd(o) 10320REM directions: call direction code: leaving, entering, see and unsee code is called by the code. 10330PROCcallcode(rooms%(c_room%,o,1),01,c_room%) 10340ENDPROC 10350 10360DEFPROCcallcode(i,c,d) 10370LOCAL block,code_caller_type,code_caller_number,endcode 10380IF i<>0 THEN 10390code_caller_type=c 10400code_caller_number=d 10410disps+=1 10420block=code%(i) 10430endcode=FALSE 10440REPEAT 10450CASE !block OF 10460WHEN 0:endcode=TRUE:block+=4 10470WHEN 1:PROCcode_print(block):block+=12 :REM Y 10480WHEN 2:PROCcode_goto(block,code_caller_type,code_caller_number):block+=12 :REM Y 10490WHEN 3:PROCcode_give(block):block+=20 :REM Y 10500WHEN 4:PROCcode_move(block):block+=20 :REM Y 10510WHEN 5:PROCcode_end:block+=4 :REM Y 10520WHEN 6:PROCcode_error:block+=12 :REM Y 10530WHEN 7:PROCcode_set(block,code_caller_type,code_caller_number):block+=20 :REM Y 10540WHEN 8:PROCcode_change(block,code_caller_type,code_caller_number):block+=20 :REM Y 10550WHEN 9:block=FNcode_if(block,code_caller_type,code_caller_number) :REM Y 10560OTHERWISE PROCreport("Corrupt code file found.") 10570ENDCASE 10580UNTIL endcode=TRUE 10590disps-=1 10600IF disps=0 THEN 10610 PROCdisplay(display$) 10620 display$="" 10630ENDIF 10640ENDIF 10650ENDPROC 10660 10670DEFPROCcallcode_x(i,c,d) 10680LOCAL block,code_caller_type,code_caller_number,endcode 10690IF i<>0 THEN 10700code_caller_type=c 10710code_caller_number=d 10720disps+=1 10730block=i 10740endcode=FALSE 10750REPEAT 10760CASE !block OF 10770WHEN 0,10:endcode=TRUE:block+=4 10780WHEN 1:PROCcode_print(block):block+=12 :REM Y 10790WHEN 2:PROCcode_goto(block,code_caller_type,code_caller_number):block+=12 :REM Y 10800WHEN 3:PROCcode_give(block):block+=20 :REM Y 10810WHEN 4:PROCcode_move(block):block+=20 :REM Y 10820WHEN 5:PROCcode_end:block+=4 :REM Y 10830WHEN 6:PROCcode_error:block+=12 :REM Y 10840WHEN 7:PROCcode_set(block,code_caller_type,code_caller_number):block+=20 :REM Y 10850WHEN 8:PROCcode_change(block,code_caller_type,code_caller_number):block+=20 :REM Y 10860WHEN 9:block=FNcode_if(block,code_caller_type,code_caller_number) :REM Y 10870OTHERWISE PROCreport("Corrupt code file found.") 10880ENDCASE 10890UNTIL endcode=TRUE 10900disps-=1 10910IF disps=0 THEN 10920 PROCdisplay(display$) 10930 display$="" 10940ENDIF 10950ENDIF 10960ENDPROC 10970 10980DEFFNcode_if(b,y,u) 10990LOCAL var,num,block,code_caller_number,code_caller_type,ppp,co,e,v$,y$,op,p 11000block=b 11010code_caller_number=u 11020code_caller_type=y 11030block+=8 11040var=!block 11050block+=8 11060op=!block 11070block+=8 11080num=!block 11090block+=4 11100v$=FNgetvar(var) 11110y$=FNgetstring(num) 11120IF op<0 OR op>3 THEN 11130PROCdisplay("Unknown conditional operation.") 11140ELSE 11150CASE var OF 11160WHEN 1,0: 11170CASE op OF 11180 WHEN 0:IF INSTR(v$,y$)<>0 THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11190 WHEN 1:IF INSTR(v$,y$)=0 THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11200OTHERWISE PROCdisplay("Bad conditional operation with ob_got.") 11210ENDCASE 11220OTHERWISE 11230CASE op OF 11240 WHEN 0:IF VAL(y$)=VAL(v$) THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11250 WHEN 1:IF VAL(y$)<>VAL(v$) THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11260 WHEN 2:IF VAL(y$)>VAL(v$) THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11270 WHEN 3:IF VAL(y$)<VAL(v$) THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11280ENDCASE 11290ENDCASE 11300ENDIF 11310e=FALSE 11320p=0 11330REPEAT 11340ins%=!block 11350block+=4 11360CASE ins% OF 11370WHEN 0:e=TRUE 11380WHEN 10:IF p=0 THEN 11390e=TRUE 11400ELSE 11410p-=1 11420ENDIF 11430WHEN 5: 11440WHEN 1,2,6:block+=8 11450WHEN 3,4,8,7:block+=16 11460WHEN 9:block+=16:p+=1 11470ENDCASE 11480UNTIL e 11490=block 11500 11510DEFFNcode_ifold(b,y,u) 11520LOCAL var,num,block,code_caller_number,code_caller_type,ppp,co,e,v$,y$,op,p 11530block=b 11540code_caller_number=u 11550code_caller_type=y 11560block+=8 11570var=!block 11580block+=8 11590num=!block 11600block+=4 11610v$=FNgetvar(var) 11620y$=FNgetstring(num) 11630op=-1 11640CASE MID$(y$,1,1) OF 11650WHEN "=":op=0:y$=FNstrip(MID$(y$,2)) 11660WHEN "<":CASE MID$(y$,2,1) OF 11670WHEN ">":op=1:y$=FNstrip(MID$(y$,3)) 11680OTHERWISE op=2:y$=FNstrip(MID$(y$,2)) 11690ENDCASE 11700WHEN ">":op=3:y$=FNstrip(MID$(y$,2)) 11710ENDCASE 11720IF op=-1 THEN 11730PROCdisplay("Unknown conditional operation.") 11740ELSE 11750CASE var OF 11760WHEN 1: 11770CASE op OF 11780 WHEN 0:IF INSTR(v$,y$)<>0 THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11790 WHEN 1:IF INSTR(v$,y$)=0 THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11800OTHERWISE PROCdisplay("Bad conditional operation with ob_got.") 11810ENDCASE 11820OTHERWISE 11830CASE op OF 11840 WHEN 0:IF y$=v$ THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11850 WHEN 1:IF y$<>v$ THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11860 WHEN 2:IF y$<v$ THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11870 WHEN 3:IF y$>v$ THEN PROCcallcode_x(block,code_caller_type,code_caller_number) 11880ENDCASE 11890ENDCASE 11900ENDIF 11910e=FALSE 11920p=0 11930REPEAT 11940ins%=!block 11950block+=4 11960CASE ins% OF 11970WHEN 0:e=TRUE 11980WHEN 10:IF p=0 THEN 11990e=TRUE 12000ELSE 12010p-=1 12020ENDIF 12030WHEN 5: 12040WHEN 1,2,6:block+=8 12050WHEN 3,4,8,7:block+=16 12060WHEN 9:block+=16:p+=1 12070ENDCASE 12080UNTIL e 12090=block 12100 12110DEFPROCcode_give(b) 12120LOCAL per,ob,block 12130block=b 12140block+=4 12150pert=!block 12160block+=4 12170per=!block 12180block+=4 12190obt=!block 12200block+=4 12210ob=!block 12220block+=4 12230object_place(ob,0)=pert 12240object_place(ob,1)=per 12250ENDPROC 12260 12270DEFPROCcode_move(b) 12280LOCAL per,ob,block 12290block=b 12300block+=4 12310pert=!block 12320block+=4 12330per=!block 12340block+=4 12350obt=!block 12360block+=4 12370ob=!block 12380block+=4 12390IF obt=1 AND ob=1 THEN ob=c_room% 12400CASE pert OF 12410WHEN 2:REM object 12420object_place(per,0)=obt 12430object_place(per,1)=ob 12440WHEN 3:REM person 12450IF per=0 THEN 12460PROCreport("player vannot be moved by P_move().") 12470ELSE 12480people_place(per,0)=obt 12490people_place(per,1)=ob 12500ENDIF 12510ENDCASE 12520ENDPROC 12530 12540DEFPROCcode_goto(b,y,u) 12550LOCAL var,num,block,code_caller_number,code_caller_type,ppp 12560block=b 12570code_caller_number=u 12580code_caller_type=y 12590block+=8 12600var=!block 12610IF var=1 THEN var=c_room% 12620block+=4 12630REM 1) Call all unsee: of people in room. 12640REM 2) Call leave: of room 12650REM 3) Move to new room 12660REM 4) Call enter: of room 12670REM 5) Call all see: of people in room. 12680FOR I%=0 TO people% 12690IF people_place(I%,0)=1 AND people_place(I%,1)=c_room% THEN PROCcallcode(people%(I%,8,1),3,I%) 12700NEXT 12710PROCcallcode(rooms%(c_room%,14,1),1,c_room%) 12720c_room%=var 12730PROCcallcode(rooms%(c_room%,13,1),1,c_room%) 12740FOR I%=0 TO people% 12750IF people_place(I%,0)=1 AND people_place(I%,1)=c_room% THEN PROCcallcode(people%(I%,7,1),3,I%) 12760NEXT 12770ENDPROC 12780 12790DEFPROCcode_change(b,y,u) 12800LOCAL var,num,block,code_caller_number,code_caller_type 12810block=b 12820code_caller_number=u 12830code_caller_type=y 12840block+=8 12850var=!block 12860block+=8 12870num=!block 12880block+=4 12890IF var<2 THEN PROCreport("Can't alter variable.") 12900IF var=3 THEN 12910 IF SGN(player%(3,0))=1 AND SGN(player%(3,0)+num)<1 THEN 12920 PROCcallcode(player%(4,1),code_caller_type,code_caller_number) 12930 ENDIF 12940 player%(3,0)+=num 12950ELSE 12960 IF var=2 THEN 12970 CASE code_caller_type OF 12980 WHEN 2: 12990 IF SGN(objects%(code_caller_number,5,0))=1 AND SGN(objects%(code_caller_number,5,0)+num)<1 THEN 13000 PROCcallcode(objects%(code_caller_number,6,1),code_caller_type,code_caller_number) 13010 ENDIF 13020 objects%(code_caller_number,5,0)+=num 13030 WHEN 3: 13040 IF code_caller_number=0 THEN 13050 IF SGN(player%(3,0))=1 AND SGN(player%(3,1)+num)<1 THEN 13060 PROCcallcode(player%(4,1),code_caller_type,code_caller_number) 13070 ENDIF 13080 player%(3,0)+=num 13090 ELSE 13100 IF SGN(people%(code_caller_number,5,0))=1 AND SGN(people%(code_caller_number,5,0)+num)<1 THEN 13110 PROCcallcode(people%(code_caller_number,6,1),code_caller_type,code_caller_number) 13120 ENDIF 13130 people%(code_caller_number,5,0)+=num 13140 ENDIF 13150 OTHERWISE PROCreport("Can't chage energy: for something with out energy:.") 13160 ENDCASE 13170 ELSE 13180 cur_vars(var)+=num 13190 ENDIF 13200ENDIF 13210ENDPROC 13220 13230DEFPROCcode_set(b,y,u) 13240LOCAL var,num,block,code_caller_number,code_caller_type 13250block=b 13260code_caller_number=u 13270code_caller_type=y 13280block+=8 13290var=!block 13300block+=8 13310num=!block 13320block+=4 13330IF var<2 THEN PROCreport("Can't alter variable.") 13340IF var=3 THEN 13350IF SGN(player%(3,0))=1 AND SGN(num)<1 THEN 13360PROCcallcode(player%(4,1),code_caller_type,code_caller_number) 13370ENDIF 13380player%(3,0)=num 13390ELSE 13400IF var=2 THEN 13410CASE code_caller_type OF 13420WHEN 2: 13430IF SGN(objects%(code_caller_number,5,0))=1 AND SGN(num)<1 THEN 13440PROCcallcode(objects%(code_caller_number,6,1),code_caller_type,code_caller_number) 13450ENDIF 13460objects%(code_caller_number,5,0)=num 13470WHEN 3: 13480IF code_caller_number=0 THEN 13490 IF SGN(player%(3,0))=1 AND SGN(num)<1 THEN 13500 PROCcallcode(player%(4,1),code_caller_type,code_caller_number) 13510 ENDIF 13520 player%(3,0)=num 13530ELSE 13540 IF SGN(people%(code_caller_number,5,0))=1 AND SGN(num)<1 THEN 13550 PROCcallcode(people%(code_caller_number,6,1),code_caller_type,code_caller_number) 13560 ENDIF 13570 people%(code_caller_number,5,0)=num 13580ENDIF 13590OTHERWISE PROCreport("Can't chage energy: for something with out energy:.") 13600ENDCASE 13610ELSE 13620cur_vars(var)=num 13630ENDIF 13640ENDIF 13650ENDPROC 13660 13670DEFPROCcode_end 13680PROCdisplay("") 13690PROCdisplay("") 13700PROCdisplay("*** THE END ***") 13710PROCdisplay("") 13720PROCdisplay("Press return to restart.") 13730i$=FNinput 13740PROCcls 13750PROCJump("go") 13760ENDPROC 13770 13780DEFPROCcode_print(b) 13790LOCAL block 13800block=b 13810REM first decide whether its a variable or string 13820block+=4 13830type=!block 13840block+=4 13850num=!block 13860block+=4 13870CASE type OF 13880WHEN 07:PROCcode_print_str(block) 13890WHEN 05:PROCcode_print_var(block) 13900OTHERWISE PROCreport("Can't print this label.") 13910ENDCASE 13920ENDPROC 13930 13940DEFPROCcode_print_str(b) 13950LOCAL block 13960block=b 13970t$=FNgetstring(num) 13980REPEAT 13990WHILE MID$(t$,1,2)<>"\n" AND LEN(t$)>0 14000display$+=MID$(t$,1,1) 14010t$=MID$(t$,2) 14020ENDWHILE 14030IF LEN(t$)<>0PROCdisplay(display$) 14040IF LEN(t$)>0 THEN 14050t$=MID$(t$,3) 14060display$="" 14070ENDIF 14080UNTIL LEN(t$)=0 14090ENDPROC 14100 14110DEFPROCcode_print_var(b) 14120LOCAL block 14130block=b 14140t$=FNgetvar(num) 14150display$+=t$ 14160ENDPROC 14170 14180DEFFNgetvar(c) 14190CASE c OF 14200WHEN 0:=FNgetstring(rooms%(c_room%,0,1)) 14210WHEN 1:ob=rooms%(c_room%,15,1) 14220n_o=0 14230FOR I%=0 TO objects% 14240IF object_place(I%,0)=3 AND object_place(I%,1)=0 THEN temp(n_o)=I%:n_o+=1 14250NEXT 14260CASE n_o OF 14270WHEN 0:="" 14280WHEN 1:=FNgetstring(objects%(temp(0),0,1)) 14290WHEN 2:=FNgetstring(objects%(temp(0),0,1))+" "+FNgetstring(objects%(temp(1),0,1)) 14300OTHERWISE 14310l$="" 14320FOR I%=0 TO n_o-3 14330l$+=FNgetstring(objects%(temp(I%),0,1))+" " 14340NEXT 14350l$+=FNgetstring(objects%(temp(n_o-2),0,1))+" "+FNgetstring(objects%(temp(n_o-1),0,1)) 14360=l$ 14370ENDCASE 14380WHEN 2:CASE code_caller_type OF 14390WHEN 2:=STR$objects%(code_caller_number,5,0) 14400WHEN 3:IF code_caller_number=0 THEN =STR$player%(3,1) ELSE =STR$people%(code_caller_number,5,0) 14410OTHERWISE ="-1" 14420ENDCASE 14430WHEN 3:=STR$player%(3,0) 14440ENDCASE 14450=STR$(cur_vars(c)) 14460 14470DEFPROCcode_error 14480PROCreport("visable() and invisable() are no longer suported.") 14490block+=4 14500ENDPROC 14510 14520DEFPROCshow 14530PROCdisplay(" ") 14540PROCdisplay_SetTitle("Running") 14550PROCdisplay_SetPosIndicator(FNgetstring(rooms%(c_room%,0,1))) 14560fs=rooms%(c_room%,1,1) 14570ls=rooms%(c_room%,2,1) 14580FOR y%=fs TO ls 14590PROCdisplay(FNgetstring(y%)) 14600NEXT 14610PROCdisplay(" ") 14620n_o=0 14630FOR I%=0 TO objects% 14640IF object_place(I%,0)=1 AND object_place(I%,1)=c_room% THEN temp(n_o)=I%:n_o+=1 14650NEXT 14660CASE n_o OF 14670WHEN 0:PROCdisplay("There are no objects here.") 14680WHEN 1:PROCdisplay("There is a "+FNgetstring(objects%(temp(0),0,1))+" here.") 14690WHEN 2:PROCdisplay("There is a "+FNgetstring(objects%(temp(0),0,1))+" and "+FNgetstring(objects%(temp(1),0,1))+" here.") 14700OTHERWISE 14710l$="There is a " 14720FOR I%=0 TO n_o-3 14730l$+=FNgetstring(objects%(temp(I%),0,1))+", a " 14740NEXT 14750l$+=FNgetstring(objects%(temp (n_o-2),0,1))+" and a "+FNgetstring(objects%(temp(n_o-1),0,1))+" here." 14760PROCdisplay(l$) 14770ENDCASE 14780n_o=0 14790FOR I%=0 TO people% 14800IF people_place(I%,0)=1 AND people_place(I%,1)=c_room% THEN temp(n_o)=I%:n_o+=1 14810NEXT 14820CASE n_o OF 14830WHEN 0:PROCdisplay("There are no people here.") 14840WHEN 1:PROCdisplay("There is also a "+FNgetstring(people%(temp(0),0,1))+" here.") 14850WHEN 2:PROCdisplay("There is also a "+FNgetstring(people%(temp(0),0,1))+" and a "+FNgetstring(people%(temp(1),0,1))+" here.") 14860OTHERWISE 14870l$="There is also " 14880FOR I%=0 TO n_o-3 14890l$+="a "+FNgetstring(people%(temp(I%),0,1))+", " 14900NEXT 14910l$+="a "+FNgetstring(people%(temp(n_o-2),0,1))+" and a "+FNgetstring(people%(temp(n_o-1),0,1))+" here." 14920PROCdisplay(l$) 14930ENDCASE 14940N=FALSE:S=FALSE:W=FALSE:E=FALSE:NE=FALSE:SW=FALSE:NW=FALSE:SE=FALSE:U=FALSE:D=FALSE 14950IF rooms%(c_room%,3,0)<>0 THEN E=TRUE 14960IF rooms%(c_room%,4,0)<>0 THEN W=TRUE 14970IF rooms%(c_room%,5,0)<>0 THEN S=TRUE 14980IF rooms%(c_room%,6,0)<>0 THEN N=TRUE 14990IF rooms%(c_room%,7,0)<>0 THEN U=TRUE 15000IF rooms%(c_room%,8,0)<>0 THEN D=TRUE 15010IF rooms%(c_room%,9,0)<>0 THEN SE=TRUE 15020IF rooms%(c_room%,10,0)<>0 THEN SW=TRUE 15030IF rooms%(c_room%,11,0)<>0 THEN NE=TRUE 15040IF rooms%(c_room%,12,0)<>0 THEN NW=TRUE 15050IF N+E+W+S+NW+NE+SE+SW+U+D=0 THEN 15060PROCdisplay("There are no exits.") 15070ELSE 15080i$=FNdirs 15090IF N+E+W+S+NW+NE+SE+SW+U+D=-1 THEN 15100o$="There is an exit to the "+MID$(i$,1,LEN(i$)-2)+"." 15110ELSE 15120o$="There are exits to the "+FNspecial1(i$)+"." 15130ENDIF 15140PROCdisplay(o$) 15150ENDIF 15160PROCdisplay(" ") 15170ENDPROC 15180 15190DEFFNdirs 15200l$="" 15210IF N=TRUE THEN l$+="north, " 15220IF S=TRUE THEN l$+="south, " 15230IF E=TRUE THEN l$+="east, " 15240IF W=TRUE THEN l$+="west, " 15250IF U=TRUE THEN l$+="up, " 15260IF D=TRUE THEN l$+="down, " 15270IF NW=TRUE THEN l$+="northwest, " 15280IF SE=TRUE THEN l$+="southeast, " 15290IF NE=TRUE THEN l$+="northeast, " 15300IF SW=TRUE THEN l$+="southwest, " 15310=l$ 15320 15330DEFFNspecial1(t$) 15340y$=MID$(t$,1,LEN(t$)-2) 15350I%=1 15360LI%=0 15370WHILE I%<>0 15380LI%=I% 15390I%=INSTR(y$,",",I%+1) 15400ENDWHILE 15410=MID$(y$,1,LI%-1)+" and"+MID$(y$,LI%+1) 15420 15430DEFFNgetstring(y%) 15440=strings$(y%) 15450 15460DEFPROCrepos_people 15470people_place()=-1 15480FOR I%=2 TO rooms% 15490 IF rooms%(I%,16,1)<>0 THEN 15500 block=rooms%(I%,16,1) 15510 WHILE !block<>0 AND block!4<>0 15520 i=block!4 15530 block+=8 15540 IF people_place(i,1)<>-1 THEN PROCreport("person in two places.") 15550 people_place(i,0)=&01 15560 people_place(i,1)=I% 15570 ENDWHILE 15580 ENDIF 15590NEXT 15600ENDPROC 15610 15620DEFPROCrepos_objects 15630object_place()=-1 15640REM can be in player, room or person 15650FOR I% = 0 TO people% 15660 IF people%(I%,9,1)<>0 THEN 15670 block=people%(I%,9,1) 15680 WHILE !block<>0 AND block!4<>0 15690 i=block!4 15700 block+=8 15710 IF object_place(i,1)<>-1 THEN PROCreport("object in two places.") 15720 object_place(i,0)=&03 15730 object_place(i,1)=I% 15740 ENDWHILE 15750 ENDIF 15760NEXT 15770FOR I%=2 TO rooms% 15780 IF rooms%(I%,15,1)<>0 THEN 15790 block=rooms%(I%,15,1) 15800 WHILE !block<>0 OR block!4<>0 15810 i=block!4 15820 block+=8 15830 IF object_place(i,1)<>-1 THEN PROCreport("object in two places.") 15840 object_place(i,0)=&01 15850 object_place(i,1)=I% 15860 ENDWHILE 15870 ENDIF 15880NEXT 15890IF player%(5,1)<>0 THEN 15900 block=player%(5,1) 15910 WHILE !block<>0 AND block!4<>0 15920 i=block!4 15930 block+=8 15940 IF object_place(i,1)<>-1 THEN PROCreport("object in two places.") 15950 object_place(i,0)=&03 15960 object_place(i,1)=I% 15970 ENDWHILE 15980ENDIF 15990ENDPROC 16000 16010DEFPROCERROR 16020IF ERR<>(1<<31) THEN 16030MODE 0 : REPORT:PRINT ERL:L=GET:END 16040ENDIF 16050i=EVAL("FN"+REPORT$) 16060ENDPROC 16070 16080DEFPROCJump(l$) 16090ERROR (1<<31),l$ 16100ENDPROC 16110 16120DEFPROCquit_now 16130END 16140ENDPROC
)� Byte-code Interpreter for DavidRPG2 � (c) David Spence, 1998. (ver$="2.58" 2 < � �ERROR F P ț "<DavidRPG2$Dir>.Library" Z,ț "<DavidRPG2$Dir>.<DavidRPG2$Display>" d%�display_initstart("Interpreter") n xJ�display_special("Byte-code Interpreter for !DavidRPG2 version "+ver$) �+�display_special("David Spence, 1998.") �S�PROCdisplay_special("The error messages reported will be quite vague, sorry!") �J�PROCdisplay_special("This is only a test version of the intepreter.") �P�PROCdisplay_special("Don't be suprised if an error in a file crashes this") �(�PROCdisplay_special("interpreter!") ��display_special(" ") � � err=0 � ingame%=� � �!O=�(�display_tempdir+".temp") �O� O=0 � �report("Can't find !DavidRPG2 - has it been seen by the filer?"):� ��#O � Loading: � ======== "� ,_� Strings: count strings then put into arrary the right size for all the strings to fit. 6c� Variables: make and array for the start values and one for the current values containing the @ � start values. Ja� Rooms: put in an array the right size for the data (count first). Put all lists into a TK� separate block of memory, the right size (not an array). ^� Objects: See rooms. h� People: See rooms. r9� Player: Same as rooms but with a single player. |G� Code: Array with pointer to memory blocks with the code in. � �!�**************************** �� NOTE VERY IMPORTANT �5� person0 and vars0-3 are defined in this program � �"�display_special("Loading...") � �&�PROCdisplay_special("Strings...") � �$O=�(�display_tempdir+".Strings") � line=1 �� �� �#O=10 � line+=1 � �#O �#O=0 � strings$(line) &� I%=0�line-1 0strings$(I%)=�#O :� D�#O N X(�PROCdisplay_special("Variables...") b l!O=�(�display_tempdir+".Vars") vE=-4 � � �#O>0 � �E=�((�#O)/10) �>� E<>((�#O)/10) � �report("Error in variable file."):�#O:� �8� start_vars(E+3):� 4 vars are defined in this prog. �� I%=1�E � �#O,T% � �#O,U% �start_vars(T%)=U% �� �� ��#O �"� E=-4 � E=0:� start_vars(E+3) �� cur_vars(E+3) cur_vars()=start_vars() $�PROCdisplay_special("Rooms...") *"O=�(�display_tempdir+".Rooms") 4�#O,rooms% >�#O,start_room% H0� rooms%=0 � �report("No Rooms."):CLOSEE#O:� R rooms%-=1 \� rooms%(rooms%,17,1) f� L%=0 � rooms%-2 p �#O,I% z0� J%=0 � 14 :� these donot need blocks ��#O,rooms%(I%,J%,0) ��#O,rooms%(I%,J%,1) �� ��#O,in1% ��#O,in2% �� in1%=0 � in2%=0� �rooms%(I%,15,0)=0 �rooms%(I%,15,1)=0 �� �g=(�#O)-10 �c=1 �ȕ in1%<>0 � in2%<>0 ��#O,in1% �#O,in2% c+=1 � $� temp 4*2*c . �#O=g 8� J%=0� c-1 B�#O,in1% L�#O,in2% Vtemp!((4*J%*2)+0)=in1% `temp!((4*J%*2)+4)=in2% j� t� in1%<>0 � in2%<>0 � � ~rooms%(I%,15,1)=temp �� ��#O,in1% ��#O,in2% �� in1%=0 � in2%=0� �rooms%(I%,16,0)=0 �rooms%(I%,16,1)=0 �� �g=(�#O)-10 �c=1 �ȕ in1%<>0 � in2%<>0 ��#O,in1% ��#O,in2% c+=1 � � temp 4*2*c �#O=g (� J%=0� c-1 2�#O,in1% <�#O,in2% Ftemp!((4*J%*2)+0)=in1% Ptemp!((4*J%*2)+4)=in2% Z� d� in1%<>0 � in2%<>0 � � nrooms%(I%,16,1)=temp x� ��#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% �(� in1%=0 � in2%=0 � in3%=0 � in4%=0� �rooms%(I%,17,0)=0 �rooms%(I%,17,1)=0 �� �g=(�#O)-20 �c=1 �,ȕ in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0 ��#O,in1% ��#O,in2% �#O,in3% �#O,in4% c+=1 "� ,� temp 4*4*c 6 �#O=g @� J%=0� c-1 J�#O,in1% T�#O,in2% ^�#O,in3% h�#O,in4% rtemp!((4*J%*4)+0)=in1% |temp!((4*J%*4)+4)=in2% �temp!((4*J%*4)+8)=in3% �temp!((4*J%*4)+12)=in4% �� �.� in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0� � �rooms%(I%,17,1)=temp �� �� ��#O � �&�PROCdisplay_special("Objects...") � �#O=�(�display_tempdir+".Object") ��#O,objects% objects%-=1 � objects%(objects%,8,1) � L%=0 � objects% & �#O,I% 0/� J%=0 � 6 :� these donot need blocks :�#O,objects%(I%,J%,0) DȎ J% � N� 3,4,5: X �#O,objects%(I%,J%,1) b� l� v�#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% �(� in1%=0 � in2%=0 � in3%=0 � in4%=0� �objects%(I%,7,0)=0 �objects%(I%,7,1)=0 �� �g=(�#O)-20 �c=1 �,ȕ in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0 ��#O,in1% ��#O,in2% ��#O,in3% �#O,in4% c+=1 � � temp 4*4*c * �#O=g 4� J%=0� c-1 >�#O,in1% H�#O,in2% R�#O,in3% \�#O,in4% ftemp!((4*J%*4)+0)=in1% ptemp!((4*J%*4)+4)=in2% ztemp!((4*J%*4)+8)=in3% �temp!((4*J%*4)+12)=in4% �� �.� in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0� � �objects%(I%,7,1)=temp �� ��#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% �(� in1%=0 � in2%=0 � in3%=0 � in4%=0� �objects%(I%,8,0)=0 �objects%(I%,8,1)=0 �� g=(�#O)-20 c=1 ,ȕ in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0 $�#O,in1% .�#O,in2% 8�#O,in3% B�#O,in4% Lc+=1 V� `� temp 4*4*c j �#O=g t� J%=0� c-1 ~�#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% �temp!((4*J%*4)+0)=in1% �temp!((4*J%*4)+4)=in2% �temp!((4*J%*4)+8)=in3% �temp!((4*J%*4)+12)=in4% �� �.� in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0� � �objects%(I%,8,1)=temp �� �� �#O %�PROCdisplay_special("People...") (#O=�(�display_tempdir+".People") 2�#O,people% <people%-=1 F� people%(people%,11,1) P� L%=0 � people% Z �#O,I% d/� J%=0 � 8 :� these donot need blocks n�#O,people%(I%,J%,0) xȎ J% � �� 3,4,5: � �#O,people%(I%,J%,1) �� �� � ��#O,in1% ��#O,in2% �� in1%=0 � in2%=0� �people%(I%,9,0)=0 �people%(I%,9,1)=0 �� �g=(�#O)-10 �c=1 ȕ in1%<>0 � in2%<>0 �#O,in1% �#O,in2% "c+=1 ,� 6� temp 4*2*c @ �#O=g J� J%=0� c-1 T�#O,in1% ^�#O,in2% htemp!((4*J%*2)+0)=in1% rtemp!((4*J%*2)+4)=in2% |� �� in1%<>0 � in2%<>0 � � �people%(I%,9,1)=temp �� ��#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% �(� in1%=0 � in2%=0 � in3%=0 � in4%=0� �people%(I%,10,0)=0 �people%(I%,10,1)=0 �� �g=(�#O)-20 �c=1 ,ȕ in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0 �#O,in1% �#O,in2% &�#O,in3% 0�#O,in4% :c+=1 D� N� temp 4*4*c X �#O=g b� J%=0� c-1 l�#O,in1% v�#O,in2% ��#O,in3% ��#O,in4% �temp!((4*J%*4)+0)=in1% �temp!((4*J%*4)+4)=in2% �temp!((4*J%*4)+8)=in3% �temp!((4*J%*4)+12)=in4% �� �.� in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0� � �people%(I%,10,1)=temp �� ��#O,in1% ��#O,in2% ��#O,in3% �#O,in4% (� in1%=0 � in2%=0 � in3%=0 � in4%=0� people%(I%,11,0)=0 people%(I%,11,1)=0 *� 4g=(�#O)-20 >c=1 H,ȕ in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0 R�#O,in1% \�#O,in2% f�#O,in3% p�#O,in4% zc+=1 �� �� temp 4*4*c � �#O=g �� J%=0� c-1 ��#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% �temp!((4*J%*4)+0)=in1% �temp!((4*J%*4)+4)=in2% �temp!((4*J%*4)+8)=in3% �temp!((4*J%*4)+12)=in4% �� .� in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0� � people%(I%,11,1)=temp � $� .�#O 8 B%�PROCdisplay_special("Player...") L V#O=�(�display_tempdir+".Player") `� player%(7,1) j/� J%=0 � 4 :� these donot need blocks t�#O,player%(J%,0) ~Ȏ J% � �� 3: � �#O,player%(J%,1) �� �� ��#O,in1% ��#O,in2% �� in1%=0 � in2%=0� �player%(5,0)=0 �player%(5,1)=0 �� �g=(�#O)-10 �c=1 ȕ in1%<>0 � in2%<>0 �#O,in1% �#O,in2% c+=1 (� 2� temp 4*2*c < �#O=g F� J%=0� c-1 P�#O,in1% Z�#O,in2% dtemp!((4*J%*2)+0)=in1% ntemp!((4*J%*2)+4)=in2% x� �� in1%<>0 � in2%<>0 � � �player%(5,1)=temp �� ��#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% �(� in1%=0 � in2%=0 � in3%=0 � in4%=0� �player%(6,0)=0 �player%(6,1)=0 �� �g=(�#O)-20 �c=1 ,ȕ in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0 �#O,in1% �#O,in2% "�#O,in3% ,�#O,in4% 6c+=1 @� J� temp 4*4*c T �#O=g ^� J%=0� c-1 h�#O,in1% r�#O,in2% |�#O,in3% ��#O,in4% �temp!((4*J%*4)+0)=in1% �temp!((4*J%*4)+4)=in2% �temp!((4*J%*4)+8)=in3% �temp!((4*J%*4)+12)=in4% �� �.� in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0� � �player%(6,1)=temp �� ��#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% (� in1%=0 � in2%=0 � in3%=0 � in4%=0� player%(7,0)=0 player%(7,1)=0 &� 0g=(�#O)-20 :c=1 D,ȕ in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0 N�#O,in1% X�#O,in2% b�#O,in3% l�#O,in4% vc+=1 �� �� temp 4*4*c � �#O=g �� J%=0� c-1 ��#O,in1% ��#O,in2% ��#O,in3% ��#O,in4% �temp!((4*J%*4)+0)=in1% �temp!((4*J%*4)+4)=in2% �temp!((4*J%*4)+8)=in3% �temp!((4*J%*4)+12)=in4% �� .� in1%<>0 � in2%<>0 � in3%<>0 � in4%<>0� � player%(7,1)=temp � �#O * 4#�PROCdisplay_special("Code...") > H!O=�(�display_tempdir+".Code") R� O=0 � �#O=0 � \� O<>0 ��#O f� code%(1) p� zcode%=0 �� � end=� �� ��#O,ins% � Ȏ ins% � � � 0:end=� �� 5,10: �� 1,2,6:�#O,u%:�#O,u% �)� 3,4,8,7:�#O,u%:�#O,u%:�#O,u%:�#O,u% �1� 9:�#O,u%:�#O,u%:�#O,u%:�#O,u%:�#O,u%:�#O,u% �� � � end �code%+=1 � �#O �#O=0 � code%(code%) $� o%=1 � code% . t=�#O 8 end=� B word=0 L� V�#O,ins%:word+=1 ` Ȏ ins% � j � 0:end=� t� 5,10: ~!� 1,2,6:�#O,u%:�#O,u%:word+=2 �1� 3,4,8,7:�#O,u%:�#O,u%:�#O,u%:�#O,u%:word+=4 �9� 9:�#O,u%:�#O,u%:�#O,u%:�#O,u%:�#O,u%:�#O,u%:word+=6 �� � � end �� temp (word+1)*4 � �#O=t �� I%=0� word-1 � �#O,j% �temp!(I%*4)=j% �� �� j%<>0 � � �code%(o%)=temp � �#O � (� object_place(objects%,1) 2� people_place(people%,1) <� temp(256) F P�display_special("DONE.") Z�display_initend d� n�display_poll x� 0 �� � ���restart_interp ��Jump("go") �� � �ݤgo �� restart interpreter � ingame%=� �display$="" �disps=0 ��display_special(" ") �+�display_special("New game Started...") � I%=0�2 �display_special(" ") �display_poll "� ,�start_screen 6�display(" ") @�display_poll Jcur_vars()=start_vars() Tc_room%=start_room% ^ o_room=-1 h�repos_objects r�repos_people |-�callcode(rooms%(c_room%,13,1),1,c_room%) �� I%=0 � people% �Y� people_place(I%,0)=1 � people_place(I%,1)=c_room% � �callcode(people%(I%,7,1),3,I%) �� �� �-� c_room%<>o_room � �show � �display(" ") �o_room=c_room% ��display_poll �curline$=�input ��do �� 0 �=0 � ���start_screen 5�display("You are "+�getstring(player%(0,1))+".") fs=player%(1,1) ls=player%(2,1) &� y%=fs � ls 0�display(�getstring(y%)) :� D�display(" ") N)�display("Press return to continue.") X y$=�input b�display(" ") l�display(" ") v� � ���do �(� **************first directions.... �:� �first(curline$)="GO" � curline$=�notfirst(curline$) �Ȏ �first(curline$) � �� "U","UP": �C� U= � � �report("There is no exit in that direction.") � �d(7) �� "D","DOWN": �C� D= � � �report("There is no exit in that direction.") � �d(8) �� "N","NORTH": �C� N= � � �report("There is no exit in that direction.") � �d(6) �� "S","SOUTH": �C� S= � � �report("There is no exit in that direction.") � �d(5) � "E","EAST": C� E= � � �report("There is no exit in that direction.") � �d(3) � "W","WEST": C� W= � � �report("There is no exit in that direction.") � �d(4) *� "NW","NORTHWEST": 4E� NW= � � �report("There is no exit in that direction.") � �d(12) >� "SW","SOUTHWEST": HE� SW= � � �report("There is no exit in that direction.") � �d(10) R� "NE","NORTHEAST": \E� NE= � � �report("There is no exit in that direction.") � �d(11) f� "SE","SOUTHEAST": pD� SE= � � �report("There is no exit in that direction.") � �d(9) z.� ************....then get, put, talk,.... �%� "GET":�get(�notfirst(curline$)) �1� "PICK":� �first(�notfirst(curline$))="UP" � �(�get(�notfirst(�notfirst(curline$))) �� �#�display("I don't Understand.") �� �2� "PUT":� �first(�notfirst(curline$))="DOWN" � �)�drop(�notfirst(�notfirst(curline$))) �� �#�display("I don't Understand.") �� �'� "DROP":�drop(�notfirst(curline$)) �&� "SAY":�talk(�notfirst(curline$)) � "INV","INVENTORY":�inv '� "LOOK":�look(�notfirst(curline$)) +� "DESCRIBE":�look(�notfirst(curline$)) $� "HELP","?":�help .�� ************....finally any of the form "<verb> <object|person>", "<verb> <object|person> with|using <object>", "Use <object> to <verb> <object|person>" and "<verb>" 8: B8� �curline$," WITH ")<>0 � �curline$," USING ")<>0 � L�type_b_verb V� `� �curline$," TO ")<>0 � j�type_c_verb t� ~:� �notfirst(curline$)="" � �type_d_verb � �type_a_verb �� �� �� �� � ���type_d_verb �� call room only. �l=� �$li$=�strip(�strip_end(curline$)) �� rooms%(c_room%,17,1)<>0 � � bo=rooms%(c_room%,17,1) �- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 fl$=�getstring(bo!4) A � �keyword_look(fl$,li$)=� � �callcode(bo!12,1,c_room%):l=� bo+=16 � (� 2� player%(7,1)<>0 � < bo=player%(7,1) F- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 P fl$=�getstring(bo!4) Z; � �keyword_look(fl$,li$)=� � �callcode(bo!12,3,0):l=� d bo+=16 n � x� �*� l=� � �display("You can't "+li$+".") �� � ���type_a_verb �-� call room, object, person|object|player �`� user has to have an object which can <verb> or the player must be able to <verb> and there �@� must be an object|person|player in the room with the name. �� this is big. �!� right first extract data... �/verb$= �strip(�strip_end(�first(curline$))) �4obpers$= �strip(�strip_end(�notfirst(curline$))) �8� �first(obpers$)="THE" � obpers$=�notfirst(obpers$) �� check we can do this... verb=0:obpers=0 � player%(7,1)<>0 � bo=player%(7,1) "- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 , fl$=�getstring(bo!4) 6+ � �keyword_look(fl$,verb$)=� � verb=1 @ bo+=16 J � T� ^� Io%=0 � objects% h6 � object_place(Io%,0)=3 � object_place(Io%,1)=0 � r � objects%(Io%,8,1)<>0 � | bo=objects%(Io%,8,1) �/ ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 � fl$=�getstring(bo!4) �- � �keyword_look(fl$,verb$)=� � verb=1 � bo+=16 � � � � � � �� �� Io%=0� people% �\� people_place(Io%,1)=c_room% � �toupper(�getstring(people%(Io%,0,1)))=obpers$ �obpers=1 �� �� Io%=0� objects% �u� object_place(Io%,1)=c_room% � object_place(Io%,0)=1 � �toupper(�getstring(objects%(Io%,0,1)))=obpers$ �obpers=1 � � obpers=0 � _ � obpers$="ME" � obpers$="MYSELF" obpers$=�toupper(�getstring(player%(0,1))) TEHN obpers=2 &� 0� verb=0 � obpers=0 � :/� verb=0 � �display("You can't "+verb$+".") D7� obpers=0 � �display("There's not a "+obpers$+".") N� X� call room b� rooms%(c_room%,17,1)<>0 � l bo=rooms%(c_room%,17,1) v- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 � fl$=�getstring(bo!4) �? � �keyword_look(fl$,verb$)=� � �callcode(bo!12,1,c_room%) � bo+=16 � � �� �� call objects and player �� player%(7,1)<>0 � � bo=player%(7,1) �- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 � fl$=�getstring(bo!4) �: � �keyword_look(fl$,verb$)=� � �callcode(bo!12,3,0): � bo+=16 � � � � Io%=0 � objects% 6 � object_place(Io%,0)=3 � object_place(Io%,1)=0 � � objects%(Io%,8,1)<>0 � * bo=objects%(Io%,8,1) 4/ ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 > fl$=�getstring(bo!4) H= � �keyword_look(fl$,verb$)=� � �callcode(bo!12,2,Io%) R bo+=16 \ � f � p � z� �-� call the thing the act is bestowed upon �� Io%=0� people% �T� people_place(Io%,1)=c_room% � �toupper(�getstring(people%(Io%,0,1)))=obpers$ � � � people%(Io%,10,1)<>0 � � bo=people%(Io%,10,1) �/ ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 � fl$=�getstring(bo!4) �= � �keyword_look(fl$,verb$)=� � �callcode(bo!12,3,Io%) � bo+=16 � � � � �� �� � Io%=0� objects% m� object_place(Io%,1)=c_room% � object_place(Io%,0)=1 � �toupper(�getstring(objects%(Io%,0,1)))=obpers$ � � objects%(Io%,7,1)<>0 � $ bo=objects%(Io%,7,1) ./ ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 8 fl$=�getstring(bo!4) B= � �keyword_look(fl$,verb$)=� � �callcode(bo!12,2,Io%) L bo+=16 V � ` � j� t� ~� obpers=2 � �� player%(6,1)<>0 � � bo=player%(6,1) �- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 � fl$=�getstring(bo!4) �: � �keyword_look(fl$,verb$)=� � �callcode(bo!12,3,0): � bo+=16 � � �� �� �� �� � ��type_b_verb 2� "<verb> <object|person> with|using <object>" -� call room, object, person|object|player 8� user has to have an object with the name and there (@� must be an object|person|player in the room with the name. 2f=� <verb$=�first(curline$) F curline$=�notfirst(curline$) P� curline$="" � f=� Z� �curline$," WITH ")<>0 � d.obpers$=�curline$,1,�curline$," WITH ")-1) n-curline$=�curline$,�curline$," WITH ")+6) x� �� �curline$," USING ")<>0 � �/obpers$=�curline$,1,�curline$," USING ")-1) �.curline$=�curline$,�curline$," USING ")+7) �� �f=� �� �� �� curline$="" � f=� �object$=curline$ �8� �first(object$)="THE" � object$=�notfirst(object$) �8� �first(obpers$)="THE" � obpers$=�notfirst(obpers$) �%�full_verb(verb$,obpers$,object$) �� ��type_c_verb .� "Use <object> to <verb> <object|person>" "-� call room, object, person|object|player ,8� user has to have an object with the name and there 6@� must be an object|person|player in the room with the name. @ curline$=�notfirst(curline$) J;� �first(curline$)="THE" � curline$=�notfirst(curline$) T,object$=�curline$,1,�curline$," TO ")-1) ^+curline$=�curline$,�curline$," TO ")+4) hverb$=�first(curline$) r curline$=�notfirst(curline$) |obpers$=curline$ �8� �first(obpers$)="THE" � obpers$=�notfirst(obpers$) �%�full_verb(verb$,obpers$,object$) �� � � ��full_verb(verb$,to$,from$) �verb=0:to=0:from=0 �� player%(7,1)<>0 � � bo=player%(7,1) �- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 � fl$=�getstring(bo!4) �+ � �keyword_look(fl$,verb$)=� � verb=1 � bo+=16 � � � � Io%=0 � objects% 6 � object_place(Io%,0)=3 � object_place(Io%,1)=0 � & � objects%(Io%,8,1)<>0 � 0 bo=objects%(Io%,8,1) :/ ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 D fl$=�getstring(bo!4) N- � �keyword_look(fl$,verb$)=� � verb=1 X bo+=16 b � l � v � �� �� Io%=0� people% �U� people_place(Io%,1)=c_room% � �toupper(�getstring(people%(Io%,0,1)))=to$ � to=1 �� �� Io%=0� objects% �n� object_place(Io%,1)=c_room% � object_place(Io%,0)=1 � �toupper(�getstring(objects%(Io%,0,1)))=to$ � to=1 �n� object_place(Io%,1)=0 � object_place(Io%,0)=3 � �toupper(�getstring(objects%(Io%,0,1)))=from$ � from=Io% �� �� to=0 � �O � to$="ME" � to$="MYSELF" to$=�toupper(�getstring(player%(0,1))) TEHN to=2 �� �� verb=0 � to=0 � from=0 � �.� verb=0 � �display("It can't "+verb$+".") !/� to=0 � �display("There's not a "+to$+".") !6� from=0 � �display("You havn't got a "+from$+".") !� ! Io%=from !*6 � object_place(Io%,0)=3 � object_place(Io%,1)=0 � !4 � objects%(Io%,8,1)<>0 � !> bo=objects%(Io%,8,1) !H/ ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 !R fl$=�getstring(bo!4) !\= � �keyword_look(fl$,verb$)=� � �callcode(bo!12,2,Io%) !f bo+=16 !p � !z � !� � !�-� call the thing the act is bestowed upon !�� Io%=0 � people% !�P� people_place(Io%,1)=c_room% � �toupper(�getstring(people%(Io%,0,1)))=to$ � !� � people%(Io%,10,1)<>0 � !� bo=people%(Io%,10,1) !�/ ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 !� fl$=�getstring(bo!4) !�= � �keyword_look(fl$,verb$)=� � �callcode(bo!12,3,Io%) !� bo+=16 !� � !� � !�� "� "� Io%=0� objects% "i� object_place(Io%,1)=c_room% � object_place(Io%,0)=1 � �toupper(�getstring(objects%(Io%,0,1)))=to$ � "$ � objects%(Io%,7,1)<>0 � ". bo=objects%(Io%,7,1) "8/ ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 "B fl$=�getstring(bo!4) "L= � �keyword_look(fl$,verb$)=� � �callcode(bo!12,2,Io%) "V bo+=16 "` � "j � "t� "~� "�� to=2 � "�� player%(6,1)<>0 � "� bo=player%(6,1) "�- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 "� fl$=�getstring(bo!4) "�: � �keyword_look(fl$,verb$)=� � �callcode(bo!12,3,0): "� bo+=16 "� � "�� "�� "�� "�� # # ��look(ii$) #ii$=�strip(�strip_end(ii$)) #� ii$="" � #( �show #2� #<+� �first(ii$)="AT" � ii$=�notfirst(ii$) #F,� �first(ii$)="THE" � ii$=�notfirst(ii$) #Pii$=�strip(�strip_end(ii$)) #Z� Io%=0 � people% #d2� �toupper(�getstring(people%(Io%,0,1)))=ii$ � #nA�describe(people%(Io%,0,1),people%(Io%,1,1),people%(Io%,2,1)) #x� #�� #�� Io%=0�objects% #�3� �toupper(�getstring(objects%(Io%,0,1)))=ii$ � #�D�describe(objects%(Io%,0,1),objects%(Io%,1,1),objects%(Io%,2,1)) #�� #�� #�� #�� #� #���describe(a,b,c) #��display(" ") #��display(�getstring(a)+":") #�� Iy%=b � c $�display(�getstring(Iy%)) $� $� $" $, ��help $6�display(" ") $@K�display("-----------------------------------------------------------") $J�display("Help:") $TK�display("-----------------------------------------------------------") $^�display(" ") $hA�display(" n,s,e,w,u,d,ne,nw,se and sw : Go in a direction.") $r�display(" ") $|9�display(" inv : Inventory.") $��display(" ") $�=�display(" get <object> : Get an object.") $��display(" ") $�?�display(" drop <object> : drop and object.") $��display(" ") $�=�display(" say <sentance> : say something.") $��display(" ") $�A�display(" look [<object|person>] : look at something.") $��display(" ") $��display("Actions:") $�-�display(" <verb> [the] <object|person>") $�G�display(" <verb> [the] <object|person> with|using [the] <object>") $�C�display(" Use [the] <object> to <verb> [the] <object|person>") %�display(" <verb>") %�display(" ") %K�display("-----------------------------------------------------------") %&�display(" ") %0� %: %D ��inv %N n_o=0 %X� I%=0 � objects% %bG� object_place(I%,0)=3 � object_place(I%,1)=0 � temp(n_o)=I%:n_o+=1 %l� %vȎ n_o � %�(� 0:�display("You have no objects.") %�E� 1:�display("You have a "+�getstring(objects%(temp(0),0,1))+".") %�o� 2:�display("You have a "+�getstring(objects%(temp(0),0,1))+" and "+�getstring(objects%(temp(1),0,1))+".") %� %�l$="You have a " %�� I%=0 � n_o-3 %�1l$+=�getstring(objects%(temp(I%),0,1))+", a " %�� %�al$+=�getstring(objects%(temp(n_o-2),0,1))+" and a "+�getstring(objects%(temp(n_o-1),0,1))+"." %��display(l$) %�� %�� %� &��talk(lo$) &li$=�strip(�strip_end(lo$)) &� Io%=0 � people% & #� people_place(Io%,1)=c_room% � &*� people%(Io%,11,1)<>0 � &4 bo=people%(Io%,11,1) &>- ȕ !bo<>0 � bo!4<>0 � bo!8<>0 � bo!12<>0 &H fl$=�getstring(bo!4) &R8 � �keyword_look(fl$,li$)=� ��callcode(bo!12,3,Io%) &\ bo+=16 &f � &p� &z� &�� &�� &� &���get(lo$) &�,� �first(lo$)="THE" � lo$=�notfirst(lo$) &�li$=�strip(�strip_end(lo$)) &�p=� &�� I%=0 � objects% &�9� object_place(I%,0)=1 � object_place(I%,1)=c_room% � &�3 � �toupper(�getstring(objects%(I%,0,1)))=li$ � &� p=� &� � objects%(I%,4,0)<>-1 � &�Z �display("You try to move the "+�getstring(objects%(I%,0,1))+" but it won't move.") ' � ' object_place(I%,0)=3 ' object_place(I%,1)=0 '$@ �display("You get the "+�getstring(objects%(I%,0,1))+".") '. � '8 � 'B� 'L� 'V/� p=� � �display("You cannot see the "+lo$) '`� 'j 't��drop(lo$) '~,� �first(lo$)="THE" � lo$=�notfirst(lo$) '�li$=�strip(�strip_end(lo$)) '�p=� '�� I%=0 � objects% '�3� object_place(I%,0)=3 � object_place(I%,1)=0 � '�3 � �toupper(�getstring(objects%(I%,0,1)))=li$ � '� p=� '� � objects%(I%,4,0)<>-1 � '�V �display("You try to drop the "+�getstring(objects%(I%,0,1))+" but you can't.") '� � '� object_place(I%,0)=1 '�! object_place(I%,1)=c_room% '�A �display("You drop the "+�getstring(objects%(I%,0,1))+".") ( � ( � (� (� ((/� p=� � �display("You cannot see the "+lo$) (2� (< (F ��d(o) (Pc� directions: call direction code: leaving, entering, see and unsee code is called by the code. (Z-�callcode(rooms%(c_room%,o,1),01,c_room%) (d� (n (x��callcode(i,c,d) (�7� block,code_caller_type,code_caller_number,endcode (�� i<>0 � (�code_caller_type=c (�code_caller_number=d (�disps+=1 (�block=code%(i) (� endcode=� (�� (�Ȏ !block � (�� 0:endcode=�:block+=4 (�N� 1:�code_print(block):block+=12 :� Y (�N� 2:�code_goto(block,code_caller_type,code_caller_number):block+=12 :� Y (�N� 3:�code_give(block):block+=20 :� Y )N� 4:�code_move(block):block+=20 :� Y )N� 5:�code_end:block+=4 :� Y )N� 6:�code_error:block+=12 :� Y )"N� 7:�code_set(block,code_caller_type,code_caller_number):block+=20 :� Y ),N� 8:�code_change(block,code_caller_type,code_caller_number):block+=20 :� Y )6P� 9:block=�code_if(block,code_caller_type,code_caller_number) :� Y )@) �report("Corrupt code file found.") )J� )T� endcode=� )^disps-=1 )h� disps=0 � )r �display(display$) )| display$="" )�� )�� )�� )� )���callcode_x(i,c,d) )�7� block,code_caller_type,code_caller_number,endcode )�� i<>0 � )�code_caller_type=c )�code_caller_number=d )�disps+=1 )�block=i )� endcode=� )�� *Ȏ !block � *� 0,10:endcode=�:block+=4 *N� 1:�code_print(block):block+=12 :� Y *&N� 2:�code_goto(block,code_caller_type,code_caller_number):block+=12 :� Y *0N� 3:�code_give(block):block+=20 :� Y *:N� 4:�code_move(block):block+=20 :� Y *DN� 5:�code_end:block+=4 :� Y *NN� 6:�code_error:block+=12 :� Y *XN� 7:�code_set(block,code_caller_type,code_caller_number):block+=20 :� Y *bN� 8:�code_change(block,code_caller_type,code_caller_number):block+=20 :� Y *lP� 9:block=�code_if(block,code_caller_type,code_caller_number) :� Y *v) �report("Corrupt code file found.") *�� *�� endcode=� *�disps-=1 *�� disps=0 � *� �display(display$) *� display$="" *�� *�� *�� *� *�ݤcode_if(b,y,u) *�K� var,num,block,code_caller_number,code_caller_type,ppp,co,e,v$,y$,op,p *�block=b +code_caller_number=u +code_caller_type=y +block+=8 + var=!block +*block+=8 +4 op=!block +>block+=8 +Hnum=!block +Rblock+=4 +\v$=�getvar(var) +fy$=�getstring(num) +p� op<0 � op>3 � +z.�display("Unknown conditional operation.") +�� +�Ȏ var � +� � 1,0: +�Ȏ op � +�N � 0:� �v$,y$)<>0 � �callcode_x(block,code_caller_type,code_caller_number) +�M � 1:� �v$,y$)=0 � �callcode_x(block,code_caller_type,code_caller_number) +�8 �display("Bad conditional operation with ob_got.") +�� +� +�Ȏ op � +�O � 0:� �(y$)=�(v$) � �callcode_x(block,code_caller_type,code_caller_number) +�P � 1:� �(y$)<>�(v$) � �callcode_x(block,code_caller_type,code_caller_number) +�O � 2:� �(y$)>�(v$) � �callcode_x(block,code_caller_type,code_caller_number) ,O � 3:� �(y$)<�(v$) � �callcode_x(block,code_caller_type,code_caller_number) ,� ,� ,$� ,.e=� ,8p=0 ,B� ,Lins%=!block ,Vblock+=4 ,` Ȏ ins% � ,j� 0:e=� ,t� 10:� p=0 � ,~e=� ,�� ,�p-=1 ,�� ,�� 5: ,�� 1,2,6:block+=8 ,�� 3,4,8,7:block+=16 ,�� 9:block+=16:p+=1 ,�� ,�� e ,� =block ,� ,�ݤcode_ifold(b,y,u) - K� var,num,block,code_caller_number,code_caller_type,ppp,co,e,v$,y$,op,p - block=b -code_caller_number=u -code_caller_type=y -(block+=8 -2var=!block -<block+=8 -Fnum=!block -Pblock+=4 -Zv$=�getvar(var) -dy$=�getstring(num) -n op=-1 -xȎ �y$,1,1) � -� � "=":op=0:y$=�strip(�y$,2)) -�� "<":Ȏ �y$,2,1) � -� � ">":op=1:y$=�strip(�y$,3)) -� op=2:y$=�strip(�y$,2)) -�� -� � ">":op=3:y$=�strip(�y$,2)) -�� -� � op=-1 � -�.�display("Unknown conditional operation.") -�� -�Ȏ var � -�� 1: -�Ȏ op � .N � 0:� �v$,y$)<>0 � �callcode_x(block,code_caller_type,code_caller_number) .M � 1:� �v$,y$)=0 � �callcode_x(block,code_caller_type,code_caller_number) .8 �display("Bad conditional operation with ob_got.") ."� ., .6Ȏ op � .@I � 0:� y$=v$ � �callcode_x(block,code_caller_type,code_caller_number) .JJ � 1:� y$<>v$ � �callcode_x(block,code_caller_type,code_caller_number) .TI � 2:� y$<v$ � �callcode_x(block,code_caller_type,code_caller_number) .^I � 3:� y$>v$ � �callcode_x(block,code_caller_type,code_caller_number) .h� .r� .|� .�e=� .�p=0 .�� .�ins%=!block .�block+=4 .� Ȏ ins% � .�� 0:e=� .�� 10:� p=0 � .�e=� .�� .�p-=1 .�� .�� 5: /� 1,2,6:block+=8 /� 3,4,8,7:block+=16 /� 9:block+=16:p+=1 /&� /0� e /: =block /D /N��code_give(b) /X� per,ob,block /bblock=b /lblock+=4 /vpert=!block /�block+=4 /�per=!block /�block+=4 /�obt=!block /�block+=4 /� ob=!block /�block+=4 /�object_place(ob,0)=pert /�object_place(ob,1)=per /�� /� /���code_move(b) /�� per,ob,block 0block=b 0block+=4 0pert=!block 0 block+=4 0*per=!block 04block+=4 0>obt=!block 0Hblock+=4 0R ob=!block 0\block+=4 0f� obt=1 � ob=1 � ob=c_room% 0p Ȏ pert � 0z� 2:� object 0�object_place(per,0)=obt 0�object_place(per,1)=ob 0�� 3:� person 0� � per=0 � 0�2�report("player vannot be moved by P_move().") 0�� 0�people_place(per,0)=obt 0�people_place(per,1)=ob 0�� 0�� 0�� 0� 0���code_goto(b,y,u) 1;� var,num,block,code_caller_number,code_caller_type,ppp 1block=b 1code_caller_number=u 1$code_caller_type=y 1.block+=8 18var=!block 1B� var=1 � var=c_room% 1Lblock+=4 1V+� 1) Call all unsee: of people in room. 1`� 2) Call leave: of room 1j� 3) Move to new room 1t� 4) Call enter: of room 1~)� 5) Call all see: of people in room. 1�� I%=0 � people% 1�Y� people_place(I%,0)=1 � people_place(I%,1)=c_room% � �callcode(people%(I%,8,1),3,I%) 1�� 1�-�callcode(rooms%(c_room%,14,1),1,c_room%) 1�c_room%=var 1�-�callcode(rooms%(c_room%,13,1),1,c_room%) 1�� I%=0 � people% 1�Y� people_place(I%,0)=1 � people_place(I%,1)=c_room% � �callcode(people%(I%,7,1),3,I%) 1�� 1�� 1� 1���code_change(b,y,u) 2 7� var,num,block,code_caller_number,code_caller_type 2 block=b 2code_caller_number=u 2code_caller_type=y 2(block+=8 22var=!block 2<block+=8 2Fnum=!block 2Pblock+=4 2Z.� var<2 � �report("Can't alter variable.") 2d � var=3 � 2n2 � �(player%(3,0))=1 � �(player%(3,0)+num)<1 � 2xA �callcode(player%(4,1),code_caller_type,code_caller_number) 2� � 2� player%(3,0)+=num 2�� 2� � var=2 � 2� Ȏ code_caller_type � 2� � 2: 2�[ � �(objects%(code_caller_number,5,0))=1 � �(objects%(code_caller_number,5,0)+num)<1 � 2�U �callcode(objects%(code_caller_number,6,1),code_caller_type,code_caller_number) 2� � 2�+ objects%(code_caller_number,5,0)+=num 2� � 3: 2� � code_caller_number=0 � 2�3 � �(player%(3,0))=1 � �(player%(3,1)+num)<1 � 3A �callcode(player%(4,1),code_caller_type,code_caller_number) 3 � 3 player%(3,0)+=num 3" � 3,Y � �(people%(code_caller_number,5,0))=1 � �(people%(code_caller_number,5,0)+num)<1 � 36T �callcode(people%(code_caller_number,6,1),code_caller_type,code_caller_number) 3@ � 3J* people%(code_caller_number,5,0)+=num 3T � 3^F �report("Can't chage energy: for something with out energy:.") 3h � 3r � 3| cur_vars(var)+=num 3� � 3�� 3�� 3� 3���code_set(b,y,u) 3�7� var,num,block,code_caller_number,code_caller_type 3�block=b 3�code_caller_number=u 3�code_caller_type=y 3�block+=8 3�var=!block 3�block+=8 3�num=!block 4block+=4 4.� var<2 � �report("Can't alter variable.") 4 � var=3 � 4&$� �(player%(3,0))=1 � �(num)<1 � 40?�callcode(player%(4,1),code_caller_type,code_caller_number) 4:� 4Dplayer%(3,0)=num 4N� 4X � var=2 � 4bȎ code_caller_type � 4l� 2: 4v8� �(objects%(code_caller_number,5,0))=1 � �(num)<1 � 4�S�callcode(objects%(code_caller_number,6,1),code_caller_type,code_caller_number) 4�� 4�(objects%(code_caller_number,5,0)=num 4�� 3: 4�� code_caller_number=0 � 4�% � �(player%(3,0))=1 � �(num)<1 � 4�A �callcode(player%(4,1),code_caller_type,code_caller_number) 4� � 4� player%(3,0)=num 4�� 4�8 � �(people%(code_caller_number,5,0))=1 � �(num)<1 � 4�T �callcode(people%(code_caller_number,6,1),code_caller_type,code_caller_number) 4� � 5( people%(code_caller_number,5,0)=num 5� 5D �report("Can't chage energy: for something with out energy:.") 5 � 5*� 54cur_vars(var)=num 5>� 5H� 5R� 5\ 5f��code_end 5p�display("") 5z�display("") 5��display("*** THE END ***") 5��display("") 5�(�display("Press return to restart.") 5� i$=�input 5��cls 5��Jump("go") 5�� 5� 5���code_print(b) 5�� block 5�block=b 5�3� first decide whether its a variable or string 5�block+=4 6type=!block 6block+=4 6num=!block 6$block+=4 6. Ȏ type � 68� 07:�code_print_str(block) 6B� 05:�code_print_var(block) 6L( �report("Can't print this label.") 6V� 6`� 6j 6t��code_print_str(b) 6~� block 6�block=b 6�t$=�getstring(num) 6�� 6�ȕ �t$,1,2)<>"\n" � �(t$)>0 6�display$+=�t$,1,1) 6� t$=�t$,2) 6�� 6� � �(t$)<>0�display(display$) 6�� �(t$)>0 � 6� t$=�t$,3) 6�display$="" 6�� 7 � �(t$)=0 7 � 7 7��code_print_var(b) 7(� block 72block=b 7<t$=�getvar(num) 7Fdisplay$+=t$ 7P� 7Z 7dݤgetvar(c) 7n Ȏ c � 7x(� 0:=�getstring(rooms%(c_room%,0,1)) 7�� 1:ob=rooms%(c_room%,15,1) 7� n_o=0 7�� I%=0 � objects% 7�G� object_place(I%,0)=3 � object_place(I%,1)=0 � temp(n_o)=I%:n_o+=1 7�� 7�Ȏ n_o � 7�� 0:="" 7�*� 1:=�getstring(objects%(temp(0),0,1)) 7�P� 2:=�getstring(objects%(temp(0),0,1))+" "+�getstring(objects%(temp(1),0,1)) 7� 7� l$="" 7�� I%=0 � n_o-3 7�.l$+=�getstring(objects%(temp(I%),0,1))+" " 8� 8Wl$+=�getstring(objects%(temp(n_o-2),0,1))+" "+�getstring(objects%(temp(n_o-1),0,1)) 8=l$ 8"� 8,� 2:Ȏ code_caller_type � 86*� 2:=�objects%(code_caller_number,5,0) 8@S� 3:� code_caller_number=0 � =�player%(3,1) � =�people%(code_caller_number,5,0) 8J ="-1" 8T� 8^� 3:=�player%(3,0) 8h� 8r=�(cur_vars(c)) 8| 8���code_error 8�@�report("visable() and invisable() are no longer suported.") 8�block+=4 8�� 8� 8� ��show 8��display(" ") 8� �display_SetTitle("Running") 8�=�display_SetPosIndicator(�getstring(rooms%(c_room%,0,1))) 8�fs=rooms%(c_room%,1,1) 8�ls=rooms%(c_room%,2,1) 8�� y%=fs � ls 8��display(�getstring(y%)) 9� 9�display(" ") 9 n_o=0 9&� I%=0 � objects% 90M� object_place(I%,0)=1 � object_place(I%,1)=c_room% � temp(n_o)=I%:n_o+=1 9:� 9DȎ n_o � 9N.� 0:�display("There are no objects here.") 9XJ� 1:�display("There is a "+�getstring(objects%(temp(0),0,1))+" here.") 9bt� 2:�display("There is a "+�getstring(objects%(temp(0),0,1))+" and "+�getstring(objects%(temp(1),0,1))+" here.") 9l 9vl$="There is a " 9�� I%=0 � n_o-3 9�1l$+=�getstring(objects%(temp(I%),0,1))+", a " 9�� 9�gl$+=�getstring(objects%(temp (n_o-2),0,1))+" and a "+�getstring(objects%(temp(n_o-1),0,1))+" here." 9��display(l$) 9�� 9� n_o=0 9�� I%=0 � people% 9�M� people_place(I%,0)=1 � people_place(I%,1)=c_room% � temp(n_o)=I%:n_o+=1 9�� 9�Ȏ n_o � 9�-� 0:�display("There are no people here.") 9�N� 1:�display("There is also a "+�getstring(people%(temp(0),0,1))+" here.") :y� 2:�display("There is also a "+�getstring(people%(temp(0),0,1))+" and a "+�getstring(people%(temp(1),0,1))+" here.") : :l$="There is also " : � I%=0 � n_o-3 :*3l$+="a "+�getstring(people%(temp(I%),0,1))+", " :4� :>il$+="a "+�getstring(people%(temp(n_o-2),0,1))+" and a "+�getstring(people%(temp(n_o-1),0,1))+" here." :H�display(l$) :R� :\/N=�:S=�:W=�:E=�:NE=�:SW=�:NW=�:SE=�:U=�:D=� :f"� rooms%(c_room%,3,0)<>0 � E=� :p"� rooms%(c_room%,4,0)<>0 � W=� :z"� rooms%(c_room%,5,0)<>0 � S=� :�"� rooms%(c_room%,6,0)<>0 � N=� :�"� rooms%(c_room%,7,0)<>0 � U=� :�"� rooms%(c_room%,8,0)<>0 � D=� :�#� rooms%(c_room%,9,0)<>0 � SE=� :�$� rooms%(c_room%,10,0)<>0 � SW=� :�$� rooms%(c_room%,11,0)<>0 � NE=� :�$� rooms%(c_room%,12,0)<>0 � NW=� :�!� N+E+W+S+NW+NE+SE+SW+U+D=0 � :�#�display("There are no exits.") :�� :�i$=�dirs :�"� N+E+W+S+NW+NE+SE+SW+U+D=-1 � :�4o$="There is an exit to the "+�i$,1,�(i$)-2)+"." ;� ;2o$="There are exits to the "+�special1(i$)+"." ;� ;$�display(o$) ;.� ;8�display(" ") ;B� ;L ;V ݤdirs ;` l$="" ;j� N=� � l$+="north, " ;t� S=� � l$+="south, " ;~� E=� � l$+="east, " ;�� W=� � l$+="west, " ;�� U=� � l$+="up, " ;�� D=� � l$+="down, " ;�� NW=� � l$+="northwest, " ;�� SE=� � l$+="southeast, " ;�� NE=� � l$+="northeast, " ;�� SW=� � l$+="southwest, " ;�=l$ ;� ;�ݤspecial1(t$) ;�y$=�t$,1,�(t$)-2) ;�I%=1 <