home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / 101-125 / apd107 / adventure.amos / adventure.amosSourceCode next >
AMOS Source Code  |  1978-01-16  |  18KB  |  518 lines

  1. '
  2. '
  3. ' Timewarp Adventure By D. Ramsey
  4. ' 1990/91 Pixel Precision
  5. '
  6. ' For Help, advice write to :- 
  7. ' Dominic Ramsey, 2 The Paddocks, Haddenham, Bucks. HP17 8AG.
  8. Screen Open 0,640,256,16,Hires
  9. Unpack 6 To 0 : Hide On 
  10. Curs Off : Paper 2 : Pen 1
  11. Ink 0, : Bar 0,0 To 7,7 : Ink 3, : Bar 1,3 To 7,7 : Ink 2, : Bar 4,5 To 7,7
  12. 'Aaaarghh!'
  13. Wind Open 1,16,40,76,25
  14. LOCATION=5 : NUM_OBJS=21 : NUM_ROOMS=15 : NUM_KEYS=1 : SCORE=0
  15. Dim ROOM$(NUM_ROOMS),DESC$(NUM_ROOMS),NORTH(NUM_ROOMS),SOUTH(NUM_ROOMS),WEST(NUM_ROOMS),EAST(NUM_ROOMS)
  16. Dim UP(NUM_ROOMS),DWN(NUM_ROOMS)
  17. Dim OBJ$(NUM_OBJS),OBJDESC$(NUM_OBJS),OBJDESC2$(NUM_OBJS),OBJLOC(NUM_OBJS),OBJVAR(NUM_OBJS)
  18. Dim CARRIED(NUM_OBJS),DESCRIBE(NUM_OBJS),INOBJ(NUM_OBJS)
  19. ' describe variable describes an object. 
  20. '  1 - Object not shown after a look command and cannot be got 
  21. '  2 - Object not shown but is examinable
  22. '  4 - Object breaks after dropping
  23. '  8 - Object is openable and is open
  24. ' 16 - Object is openable and closed 
  25. ' 32 - Object is Locked (closed) 
  26. ' 64 - Object is in another object (inobj var) 
  27. '128 - Object is on another object 
  28. '256 - Object is under "    "
  29. '512 - Object is behind "   "
  30. SETSCENE:
  31. Print "This is the beginings of an adventure that I never finished. What there is  of it is quite playable, and the source code should give you some ideas on  writing adventures of your own."
  32. Print "Type quit to end."
  33. Print 
  34. Print "Marty has been thrown back in time to 194O when a time travel experiment    went wrong.";
  35. Print " Unfortunately, pieces of the time machine have been scattered   over a wide area. It is your";
  36. Print " job to direct Marty around the town and find   all the  pieces of the time machine before it ";
  37. Print "is too late!"
  38. Print 
  39. '
  40. GTDAT:
  41. ' Description of Variables 
  42. 'Room$= name of room, desc$=description of room,north etc= room arived at
  43. 'if moved in that dir. obj$=objectname,objloc =location of obj 
  44. 'objvar=object variable - weight of object 
  45. 'objvar   =   1       obj is pickupable
  46. '             2       obj is movable 
  47. '             3       obj is too heavy to move 
  48. '             4       obj is bolted to floor 
  49. '             5       obj stuck to wall
  50. '             6       obj out of reach 
  51. 'rooms 
  52. For X=1 To NUM_ROOMS
  53.  Read ROOM$(X),DESC$(X),NORTH(X),EAST(X),SOUTH(X),WEST(X),UP(X),DWN(X)
  54.  Next 
  55.   Data "White classroom","The classroom is large and airy with white painted walls. The floor is very highly polished and quite slippery. There is a large blackboard at the far  side of the room, and a large table in the middle.",0,2,4,0,0,0
  56.   Data "Narrow corridor","The corridor is very dark and has wooden coatpegs along one wall and stairs at the end.",0,3,0,1,0,5
  57.   Data "Laboratory","The laboratory is large and painted green. Along the far wall are glass     cabinets containing a variety of pickled creatures.",0,0,0,2,0,0
  58.   Data "Staff room","The room is empty except for a table and three chairs it smells revolting inhere!",0,5,0,0,0,0
  59.   Data "School entrance hall","The Entrance Hall is very large with doors leading east and west. To the    North is a large wooden starcase leading upwards.",0,6,8,4,2,0
  60.   Data "Blue classroom","This classroom is small but tidy everything is very clean. There is a large window to the north, covering the whole wall.",0,0,0,5,0,0
  61.   Data "The street","I am on a narrow cobbled street leading east. There is a dead end to the west.",0,8,0,0,0,0
  62.   Data "The street","I am on a narrow cobbled street running east - west. It seems to get wider  to the east, opening out into a main road.",5,9,0,7,0,0
  63.   Data "The street","I am on a cobbled street which widens out to the east. To the west, the     street gets much narrower and darker.",0,14,0,8,0,0
  64.   Data "Great Hall","The Great Hall is a huge room with a shiny wooden floor. Various portraits  are hung around the walls and the room is lit by a central chandelier.",0,11,12,0,0,0
  65.   Data "Mayor's office","The Mayor's office is a small dimly lit room with a single north facing     window. There is a large desk towards the back of the room, with a comfy    looking chair. There is a picture hanging above the desk.",0,0,13,10,0,0
  66.   Data "Inside Town Hall","This building has obviously suffered some bomb damage as there is a small   pile of rubble in the middle of the floor. Looking up, daylight can be seen through a hole in the ceiling.",10,13,14,0,0,0
  67.   Data "Committee room","This is where the town council meets. It is a large room, with a polished   wooden table surrounded by twenty chairs. I can see the Mayor's office      through the door to the north.",11,0,0,12,0,0
  68.   Data "The road","I am on the road outside the Town Hall. To the west, the road narrows into acobbled street.",12,15,0,9,0,0
  69.   Data "The road","I am in the road, but cannot go any further as it is blocked. The only way  is back the way I came.",0,0,0,14,0,0
  70. '
  71. '
  72. 'objects 
  73. For X=1 To NUM_OBJS
  74.  Read OBJ$(X),OBJDESC$(X),OBJDESC2$(X),OBJLOC(X),OBJVAR(X),DESCRIBE(X),INOBJ(X)
  75.  Next 
  76.   Data "Key","It looks and feels like solid gold. Could be quite valuable, Doc.","Gold Key",1,2,257,4
  77.   Data "Watch","It is a ninetees digital watch with a built in address book. The face was   cracked in the accident, but it seems to be working Ok.","Digital Watch",0,1,1,0
  78.   Data "Table","The table is very large and made of solid wood. It looks far too heavy to   move","Large Table",1,3,3,0
  79.   Data "Bible","The bible is very old and dusty. It appears to have several pages missing.","Dusty Bible",1,2,1,0
  80.   Data "Jar","The jar seems to contain a pickled bat!.","Pickling Jar",3,2,1,0
  81.   Data "Book","It is a dull brown excercise book with some sums scribbled inside.","Excercise book",4,1,1,0
  82.   Data "Marble","The marble is plain white and quite boring.","White marble",8,1,5,0
  83.   Data "Cupboard","It looks as though it could be quite valuable, possibly an antique.","Antique Cupboard",3,3,33,0
  84.   Data "Coin","It looks really valuable. It has a date on it... 35O BC. Wow! that's Old!","Gold Coin",3,1,64,8
  85.   Data "Picture","It is a rather large portrait of Winston Churchill. It seems to take up mostof the wall.","Portarit",11,5,7,0
  86.   Data "Chandelier","It is a large crystal chandelier with twenty candle shaped bulbs.","Crystal Chandelier",10,6,7,0
  87.   Data "Windows","They are large with painted wooden frames.","Large Windows",1,3,7,0
  88.   Data "Stairs","It is a large solid wood staircase. It appears to have woodworm.","Staircase",5,3,7,0
  89.   Data "Pegs","They are just like any other wooden coatpegs.","Coatpegs",2,5,7,0
  90.   Data "Blackboard","It has the three times table written on it, but nothing else.","Board",1,5,7,0
  91.   Data "Desk","It's just like any other office desk.","Office desk",11,3,7,0
  92.   Data "Chair","It's a comfy black leather armchair. It seems to be attached to the floor.","Armchair",11,4,7,0
  93.   Data "Pictures","I don't recognise any of the faces.","Portarits",10,5,7,0
  94.   Data "Phase Lock Module","It's a component from the time machine.","Module",3,1,64,8
  95.   Data "Flux Capacitor","This is the main component from the time machine.","Capacitor",10,1,1,0
  96.   Data "Time Projection Unit (TPU)","This is the time control we need.","TPU",7,1,1,0
  97. 'Carrying watch
  98. CARRIED(2)=1
  99. DISPLAY:
  100. MD=5 : Gosub ACTION
  101. Gosub EX
  102. '
  103. ' Get User Input 
  104. '
  105. PARSER:
  106. MD=0 : Rem move direction variable
  107. Pen 0 : Print ">";
  108. Pen 4
  109. '
  110. Line Input "";I$ : Pen 1
  111. I$=Upper$(I$)
  112. If I$="SAVE GAME" Then Gosub SVGAME : Goto PARSER
  113. If I$="LOAD GAME" Then Gosub LDGAME : Goto PARSER
  114. While Right$(I$,1)="."
  115.  I$=Left$(I$,Len(I$)-1)
  116.  Wend 
  117. '
  118. While Instr(I$," THE ")>0
  119. X=Instr(I$," THE ")
  120. If X>0
  121.  I$=Left$(I$,X-1)+Right$(I$,Len(I$)-X-3)
  122.  End If 
  123.  Wend 
  124. '
  125. While Instr(I$," TO ")>0
  126. X=Instr(I$," TO ")
  127. If X>0
  128.  I$=Left$(I$,X-1)+Right$(I$,Len(I$)-X-2)
  129. End If 
  130. Wend 
  131. If Right$(I$,2)="IT" Then NOUN$=OBJ$(LASTOBJ) : Goto CHKDIRS
  132. If Right$(I$,4)="THEM" Then NOUN$=OBJ$(LASTOBJ) : Goto CHKDIRS
  133. NOUN$=Right$(I$,Len(I$)-Instr(I$," "))
  134.   If Left$(NOUN$,3)="AT " Then NOUN$=Right$(NOUN$,Len(NOUN$)-3)
  135.   If Left$(NOUN$,3)="IN " Then NOUN$=Right$(NOUN$,Len(NOUN$)-3)
  136. For X=1 To NUM_OBJS
  137.   If NOUN$=Upper$(OBJ$(X)) Then MD2=X : LASTOBJ=X
  138.   If NOUN$=Upper$(OBJDESC2$(X)) Then MD2=X : LASTOBJ=X
  139. Next X
  140. CHKDIRS:
  141. If Left$(I$,3)="GO " Then I$=Right$(I$,Len(I$)-3)
  142. If Left$(I$,4)="RUN " Then I$=Right$(I$,Len(I$)-4)
  143. If Left$(I$,5)="WALK " Then I$=Right$(I$,Len(I$)-5)
  144. If I$="RUN" Then Print "Which way?" : Print : Goto PARSER
  145. If I$="WALK" Then Print "Which way?" : Print : Goto PARSER
  146. If I$="N" Then MD=1
  147. If I$="E" Then MD=2
  148. If I$="S" Then MD=3
  149. If I$="W" Then MD=4
  150. If I$="U" Then MD=11
  151. If I$="D" Then MD=12
  152. If I$="NORTH" Then MD=1
  153. If I$="EAST" Then MD=2
  154. If I$="SOUTH" Then MD=3
  155. If I$="WEST" Then MD=4
  156. If Left$(I$,2)="UP" Then MD=11
  157. If Left$(I$,4)="DOWN" Then MD=12
  158. If I$="LOOK" Then MD=5
  159. If I$="L" Then MD=5
  160. If I$="EXITS" Then MD=6
  161. If Left$(I$,1)="X" Then MD=6
  162. If I$="I" Then MD=7
  163. If I$="INV" Then MD=7
  164. If I$="INVENTORY" Then MD=7
  165. If Left$(I$,4)="EXAM" Then MD=8
  166. If Left$(I$,7)="LOOK AT" Then MD=8
  167. If Left$(I$,7)="LOOK IN" Then MD=8
  168. If Left$(I$,4)="L AT" Then MD=8
  169. If Left$(I$,4)="TAKE" Then MD=9
  170. If Left$(I$,7)="PICK UP" Then MD=9
  171. If Left$(I$,3)="GET" Then MD=9
  172. If Left$(I$,4)="DROP" Then MD=10
  173. If Left$(I$,4)="OPEN" Then MD=13
  174. If Left$(I$,5)="UNLOC" Then MD=14
  175. If Left$(I$,4)="LOCK" Then MD=15
  176. If Left$(I$,4)="CLOS" Then MD=16
  177. If Left$(I$,4)="SHUT" Then MD=16
  178. If Left$(I$,4)="MOVE" Then MD=17
  179. If Left$(I$,4)="PUSH" Then MD=17
  180. If Left$(I$,4)="PULL" Then MD=17
  181. If Left$(I$,4)="QUIT" Then Stop 
  182. Gosub ACTION
  183. Goto PARSER
  184. '
  185. 'action
  186. ACTION:
  187. ACTED=0
  188.  If MD=5
  189.  Print "I am in the ";ROOM$(LOCATION);"."
  190.    Print DESC$(LOCATION)
  191.     For X=1 To NUM_OBJS
  192.      If OBJLOC(X)=LOCATION
  193.      If DESCRIBE(X) and 1
  194.      If(DESCRIBE(X) and 2)=0
  195.     If INOBJ(X)=0 and(DESCRIBE(X) and 64)=0
  196.    Print " I can see a ";Lower$(OBJ$(X));"."
  197.   End If 
  198.  End If 
  199. End If 
  200. End If 
  201.  Next 
  202.  ACTED=1 : 
  203. End If 
  204. If MD=1 and NORTH(LOCATION)>0 Then LOCATION=NORTH(LOCATION) : Print ROOM$(LOCATION) : ACTED=1
  205. If MD=2 and EAST(LOCATION)>0 Then LOCATION=EAST(LOCATION) : Print ROOM$(LOCATION) : ACTED=1
  206. If MD=3 and SOUTH(LOCATION)>0 Then LOCATION=SOUTH(LOCATION) : Print ROOM$(LOCATION) : ACTED=1
  207. If MD=4 and WEST(LOCATION)>0 Then LOCATION=WEST(LOCATION) : Print ROOM$(LOCATION) : ACTED=1
  208. If MD=11 and UP(LOCATION)>0 Then LOCATION=UP(LOCATION) : Print ROOM$(LOCATION) : ACTED=1
  209. If MD=12 and DWN(LOCATION)>0 Then LOCATION=DWN(LOCATION) : Print ROOM$(LOCATION) : ACTED=1
  210. '
  211. If MD=1 and NORTH(LOCATION)=0 and ACTED=0 Then Print "I can't go that way." : ACTED=1
  212. If MD=2 and EAST(LOCATION)=0 and ACTED=0 Then Print "I can't go that way." : ACTED=1
  213. If MD=3 and SOUTH(LOCATION)=0 and ACTED=0 Then Print "I can't go that way." : ACTED=1
  214. If MD=4 and WEST(LOCATION)=0 and ACTED=0 Then Print "I can't go that way." : ACTED=1
  215. If MD=11 and UP(LOCATION)=0 and ACTED=0 Then Print "I can't go up." : ACTED=1
  216. If MD=12 and DWN(LOCATION)=0 and ACTED=0 Then Print "I can't go down." : ACTED=1
  217. If MD=6 Then Gosub EX : ACTED=1
  218. If MD=7 Then Gosub INVENTORY : ACTED=1
  219. If MD=8 Then Gosub EXAM : ACTED=1
  220. If MD=9 Then Gosub PICKUP : ACTED=1
  221. If MD=10 Then Gosub DROP : ACTED=1
  222. If MD=13 Then Gosub OPEN : ACTED=1
  223. If MD=14 Then Gosub UNLOCK : ACTED=1
  224. If MD=15 Then Gosub LOCK : ACTED=1
  225. If MD=16 Then Gosub CLOS : ACTED=1
  226. If MD=17 Then Gosub PUSH : ACTED=1
  227. If ACTED=0 Then Print "Sorry, I don't understand."
  228. Print 
  229. Return 
  230.  EX:
  231.   Print "Possible exits : ";
  232.   If NORTH(LOCATION) Then Print " North ";
  233.  If SOUTH(LOCATION) Then Print " South ";
  234.  If EAST(LOCATION) Then Print " East ";
  235.  If WEST(LOCATION) Then Print " West ";
  236.  If UP(LOCATION) Then Print " Up ";
  237.  If DWN(LOCATION) Then Print " Down ";
  238. Print : Print 
  239.  Return 
  240. '
  241. INVENTORY:
  242. Print "I am carrying :-"
  243. XX=0
  244. For X=1 To NUM_OBJS
  245. XX=XX+CARRIED(X)
  246. If X>18 Then Pen 5 Else Pen 1
  247. If CARRIED(X)>0 Then Print OBJDESC2$(X)
  248. Next 
  249. If XX=0 Then Print " Nothing."
  250. Return 
  251. '
  252. EXAM:
  253. '
  254. 'check to see if noun is a room first. 
  255. For X=1 To NUM_ROOMS
  256.  If Upper$(ROOM$(X))=NOUN$ and LOCATION=X
  257.   Print DESC$(X)
  258.  Return 
  259. End If 
  260. Next X
  261. If(DESCRIBE(MD2) and 1)=0
  262.  Print "Sorry, I can't see that here."
  263.  Return 
  264. End If 
  265. If OBJLOC(MD2)<>LOCATION
  266.  If CARRIED(MD2)=0
  267.   Print "Sorry, can't see it here!"
  268.   Return 
  269.  End If 
  270.  End If 
  271. Print OBJDESC$(MD2)
  272.  If(DESCRIBE(MD2) and 32)=32
  273.   Print "It is closed and locked."
  274.  End If 
  275. If(DESCRIBE(MD2) and 16)=16
  276.  Print "It is closed."
  277. End If 
  278. If(DESCRIBE(MD2) and 8)
  279.  Print "It is open."
  280. For X=1 To NUM_OBJS
  281. If INOBJ(X)=MD2 and(DESCRIBE(X) and 64)=64
  282.  Print "It has a ";OBJ$(X);" in it."
  283. End If 
  284. Next X
  285. End If 
  286. Return 
  287. '
  288. PICKUP:
  289.  If OBJLOC(MD2)<>LOCATION
  290.   Print "Sorry, I can't see that here!"
  291.  Return 
  292.  End If 
  293. If(DESCRIBE(MD2) and 1)=0
  294.   Print "Sorry, I can't see that here, Doc!"
  295. Return 
  296.  End If 
  297. If OBJVAR(MD2)=3
  298.  Print "I can't move it, it's too heavy."
  299.  Return 
  300. End If 
  301. If OBJVAR(MD2)=4
  302.  Print "But it's bolted to the floor."
  303.  Return 
  304.  End If 
  305. If OBJVAR(MD2)=5
  306.  Print "But it's stuck to the wall."
  307.  Return 
  308. End If 
  309. If OBJVAR(MD2)=6
  310. Print "But it's too high. I can't reach it."
  311. Return 
  312. End If 
  313. XX=0 : For X=1 To NUM_OBJS
  314.  XX=XX+CARRIED(X)
  315. Next X
  316. If XX>10
  317.  Print "Sorry, I can't carry any more at the moment."
  318.  Return 
  319. End If 
  320. CARRIED(MD2)=OBJVAR(MD2)
  321. Print "OK, I've got the ";OBJ$(MD2);"."
  322. OBJLOC(MD2)=0
  323. For X=1 To NUM_OBJS
  324. If INOBJ(X)=MD2
  325.  If(DESCRIBE(X) and 256)=256
  326.  Print "There was something underneath it."
  327.  DESCRIBE(X)=DESCRIBE(X)-256
  328. INOBJ(X)=0
  329. End If 
  330. If(DESCRIBE(X) and 512)=512
  331. Print "There was something behind it."
  332. DESCRIBE(X)=DESCRIBE(X)-512
  333. INOBJ(X)=0
  334. End If 
  335. End If 
  336. Next 
  337. Return 
  338. '
  339. DROP:
  340. If CARRIED(MD2)>0
  341.  If DESCRIBE(MD2) and 2
  342.      Print "I can't drop that!"
  343. Return 
  344.  End If 
  345.   If DESCRIBE(MD2) and 4
  346.   Print "The ";OBJ$(MD2);" hits the ground and breaks."
  347. If Left$(OBJ$(MD2),6)<>"Broken"
  348.   OBJ$(MD2)="Broken "+OBJ$(MD2) : OBJDESC2$(MD2)="Broken "+OBJDESC2$(MD2)
  349.  CARRIED(MD2)=0 : OBJLOC(MD2)=LOCATION
  350. OBJDESC$(MD2)=OBJDESC$(MD2)+" It is broken."
  351. End If 
  352. Return 
  353. End If 
  354. Print "Ok."
  355.  CARRIED(MD2)=0
  356. OBJLOC(MD2)=LOCATION
  357. Return 
  358. End If 
  359. Print "I'm not carrying it!"
  360. Return 
  361. '
  362. OPEN:
  363. If OBJLOC(MD2)<>LOCATION and CARRIED(MD2)=0 Then Print "I can't see it here, Doc." : Return 
  364.  X=DESCRIBE(MD2)
  365.  If(X and 16) or(X and 32) or(X and 8)
  366.   If(X and 32)
  367.     Print "But it's locked."
  368.  Return 
  369. End If 
  370.  If(X and 8)
  371.   Print "But it's already open!"
  372.   Return 
  373.   End If 
  374. If(X and 16)
  375.  Print "Ok, ";OBJ$(MD2);" opened."
  376.  DESCRIBE(MD2)=DESCRIBE(MD2)-8
  377. For XX=1 To NUM_OBJS
  378.  If INOBJ(XX)=MD2 and(DESCRIBE(XX) and 64)=64
  379.  DESCRIBE(XX)=DESCRIBE(XX)+1
  380.  ' make visible 
  381.  End If 
  382. Next 
  383. Return 
  384. End If 
  385. End If 
  386. Print "I can't possibly open a ";Lower$(OBJ$(MD2));"!"
  387. Return 
  388. '
  389. CLOS:
  390. If OBJLOC(MD2)<>LOCATION and CARRIED(MD2)=0 Then Print "I can't see it here, Doc." : Return 
  391.  X=DESCRIBE(MD2)
  392. If(X and 8) or(X and 16) or(X and 32)
  393.  If(X and 16) or(X and 32)
  394.     Print "But it's already closed."
  395.  Return 
  396. End If 
  397. If(X and 8)
  398.  Print "Ok, ";Lower$(OBJ$(MD2));" closed."
  399.  DESCRIBE(MD2)=DESCRIBE(MD2)+8
  400. For XX=1 To NUM_OBJS
  401.  If INOBJ(XX)=MD2 and(DESCRIBE(XX) and 64)=64
  402.  DESCRIBE(XX)=DESCRIBE(XX)-1
  403.  ' make invisible 
  404.  End If 
  405. Next 
  406. Return 
  407. End If 
  408. End If 
  409. Print "I can't possibly close a ";Lower$(OBJ$(MD2));"!"
  410. Return 
  411. '
  412. UNLOCK:
  413. '
  414. 'This routine must be made so that the correct key opens the correct item
  415. '
  416. 'Check if carrying key ( Object Number Less than........2) 
  417. If OBJLOC(MD2)<>LOCATION and CARRIED(MD2)=0 Then Print "I can't see it here!" : Return 
  418. XX=0
  419. For X=1 To NUM_KEYS
  420. If CARRIED(X)>0 Then XX=1
  421. Next X
  422. If XX=0
  423.  Print "But I'm not carrying a key!"
  424.  Return 
  425. End If 
  426. If CARRIED(1)
  427.   If MD2=8
  428.    If(DESCRIBE(MD2) and 32)=32
  429.    Print "Ok, the ";Lower$(OBJ$(MD2));" is unlocked."
  430.    DESCRIBE(MD2)=DESCRIBE(MD2)-16
  431.   Return 
  432.   End If 
  433.  Print "But it's not locked!"
  434.  Return 
  435.  End If 
  436. Print "This key does not fit the ";OBJDESC2$(MD2);"."
  437. Return 
  438. End If 
  439. Return 
  440. '
  441. LOCK:
  442. '
  443. 'This routine must be made so that the correct key opens the correct item
  444. 'Same as unlock, only different. 
  445. 'Check if carrying key ( Object Number Less than........2) 
  446. If OBJLOC(MD2)<>LOCATION and CARRIED(MD2)=0 Then Print "I can't see it here!" : Return 
  447. XX=0
  448. For X=1 To NUM_KEYS
  449. If CARRIED(X)>0 Then XX=1
  450. Next X
  451. If XX=0
  452.  Print "But I'm not carrying a key!"
  453.  Return 
  454. End If 
  455. If CARRIED(1)
  456.   If MD2=8
  457.    If(DESCRIBE(MD2) and 16)=16
  458.    Print "Ok, the ";Lower$(OBJ$(MD2));" is locked."
  459.    DESCRIBE(MD2)=DESCRIBE(MD2)+16
  460.   Return 
  461.   End If 
  462.  Print "But it's locked already."
  463.  Return 
  464.  End If 
  465. Print "This key does not fit the ";OBJDESC2$(MD2);"."
  466. Return 
  467. End If 
  468. Return 
  469. '
  470. PUSH:
  471. If OBJVAR(MD2)>2 Then Print "It's to heavy to move." : Return 
  472. For X=1 To NUM_OBJS
  473.  If INOBJ(X)=MD2
  474.   If(DESCRIBE(X) and 256)
  475.    Print "There was a ";Lower$(OBJ$(X));" underneath."
  476.    DESCRIBE(X)=DESCRIBE(X)-256 : INOBJ(X)=0 : MD2=X
  477.  Return 
  478. End If 
  479. If(DESCRIBE(X) and 512)
  480.  Print "There was a ";Lower$(OBJ$(X));" behind it."
  481.    DESCRIBE(X)=DESCRIBE(X)-512 : INOBJ(X)=0 : MD2=X
  482.   Return 
  483.  End If 
  484. End If 
  485. Next 
  486. Print "Ok"
  487. Return 
  488. '
  489. SVGAME:
  490. Open Out 5,"SAVE.GAME"
  491. Print #5,NUM_OBJS : Print #5,NUM_KEYS : Print #5,NUM_ROOMS : Print #5,LOCATION : Print #5,SCORE
  492. For X=1 To NUM_ROOMS : Print #5,ROOM$(X) : Print #5,DESC$(X)
  493. Print #5,NORTH(X) : Print #5,SOUTH(X)
  494. Print #5,WEST(X) : Print #5,EAST(X)
  495. Print #5,UP(X) : Print #5,DWN(X)
  496. Next X
  497. For X=1 To NUM_OBJS : Print #5,OBJ$(X) : Print #5,OBJDESC$(X) : Print #5,OBJDESC2$(X) : Print #5,OBJLOC(X) : Print #5,OBJVAR(X) : Print #5,CARRIED(X) : Print #5,DESCRIBE(X) : Print #5,INOBJ(X)
  498. Next 
  499. Print #5,MD : Print #5,MD2 : Print #5,LASTOBJ
  500. Close 5
  501. Print "OK" : Print 
  502. Return 
  503. '
  504. '
  505. LDGAME:
  506. Open In 5,"SAVE.GAME"
  507. Input #5,NUM_OBJS : Input #5,NUM_KEYS : Input #5,NUM_ROOMS : Input #5,LOCATION : Input #5,SCORE
  508. For X=1 To NUM_ROOMS : Input #5,ROOM$(X) : Line Input #5,DESC$(X)
  509. Input #5,NORTH(X) : Input #5,SOUTH(X)
  510. Input #5,WEST(X) : Input #5,EAST(X)
  511. Input #5,UP(X) : Input #5,DWN(X)
  512. Next X
  513. For X=1 To NUM_OBJS : Input #5,OBJ$(X) : Line Input #5,OBJDESC$(X) : Input #5,OBJDESC2$(X) : Input #5,OBJLOC(X) : Input #5,OBJVAR(X) : Input #5,CARRIED(X) : Input #5,DESCRIBE(X) : Input #5,INOBJ(X)
  514. Next 
  515. Input #5,MD : Input #5,MD2 : Input #5,LASTOBJ
  516. Close 5
  517. Print "OK" : Print 
  518. Return