Advertisement
sphinxadventures

Sphinx 2.6

Oct 21st, 2021
1,335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 81.79 KB | None | 0 0
  1. Rem /// Sphinx Adventure '/ V1 (Tape for BBC & Electron) '/ V2 (Disc for BBC)
  2. Rem /// (c) 1982, 1984 Acornsoft & Paul Fellows
  3. Rem
  4. Rem /// Sphinx 2    | Converted by ihardcas TO QB64 August 2021
  5. Rem /// Sphinx 2.1  | Added SAVE/LOAD logic - use xsave/xload UNTIL I can GET filenames into the noun/verb mechanism
  6. Rem /// Sphinx 2.1a | Working AND plays through - few cosmetic glitches TO sort.
  7. Rem /// Sphinx 2.1b | Most old BBC reference code stripped OUT from comments
  8. Rem /// Sphinx 2.1c | Properly implemented file names in SAVE/LOAD. xsave AND xload removed
  9. Rem /// Sphinx 2.1d | Moved Responses TO subResponse
  10. Rem /// Sphinx 2.1e | Fixed post DIAXOS movement.
  11. Rem                 | Changed some labels/procs etc TO something more meaningful
  12. Rem                 | Added turnincrementer logic
  13. Rem                 | PUT the ObjLocs AND ExitData TO arrays AND PUT in a SUB.
  14. Rem                 | Removed the initialize SUB. Brought code TO start of main.
  15. Rem /// Sphinx 2.1f | appended .sav TO FILES loaded AND saved.
  16. Rem                 | Some more tidyup of labels etc
  17. Rem                 | Added dis/ena dwarf command TO disable the fckng dwarf
  18. Rem                 | finagled some more variable names
  19. Rem /// Sphinx 2.1g | fixed bridge printing glitch.
  20. Rem                 | Fixed some Dwarf business
  21. Rem /// Sphinx 2.1h | Added decent wordwrappery SUB
  22. Rem /// Sphinx 2.1i | Moved text OUTPUT TO new wordwrap routing
  23. Rem                 | Disabled old text OUTPUT routines
  24. Rem                 | Fixed dwarf fight routine.
  25. Rem /// Sphinx 2.1j | Some variable tidyup
  26. Rem                 | fixed iffy pirate behavior.
  27. Rem /// Sphinx 2.2  | Release TO other platforms -- still need TO DO a playthrough TO make sure it all still works!!
  28. Rem                 | Removed all compound statements (:)
  29. Rem /// Sphinx 2.3  | Removed references TO subResponse AND statically entered responses
  30. Rem /// Sphinx 2.4  | Moved reading in of descriptions TO own SUB
  31. Rem /// Sphinx 2.5  | Moved reading in of objects TO own SUB
  32. Rem                 | Changed the EXIT printing a bit since it relied ON over-reading the object DATA (cheeky!)
  33. Rem /// Sphinx 2.6  | Moved the verb reading bit OUT TO own SUB
  34. Rem                 | Changed the XOR safe opening logic.
  35.  
  36. ' QB Specific screen setup
  37. DIM SHARED colGreen
  38. DIM SHARED colRed
  39. DIM SHARED colCyan
  40. colGreen = 2
  41. colRed = 4
  42. colCyan = 3
  43.  
  44. SCREEN 0
  45. WIDTH 80, 40
  46. Color colGreen
  47. ' QB Done
  48.  
  49. DIM SHARED varObjectLocations(56)
  50. DIM SHARED varObjectDesc$(56)
  51. DIM SHARED varExitArray(6)
  52. DIM SHARED varExits(143 * 6)
  53. DIM SHARED varLocationDescription$(143)
  54. DIM SHARED varVerb$(44)
  55.  
  56. DIM SHARED varKilledFlag, varKneelingFlag, varFlamesFlag, varLampLitFlag, varScore, varBearFlag, varRabbitFlag
  57. DIM SHARED varLampFuel, varScreenWidth, varSafeOpenFlag, varDwarfChance, varDwarfFlag, varTurnIncrement, varGoblinEncounters
  58. DIM SHARED varCurrentLocation, varTurnCount, varChasmFlag, varCasketOpenFlag, varDwarfEncounters, varMAX
  59. DIM SHARED varWord1$, varWord2$, varWord1Index, varWord2Index, varGotWaterFlag, varDirections$, varVampireEncounters
  60. DIM SHARED varTurnLastSeenDwarf, varSuppressDwarf ' varTurnLastSeenDwarf is a counter that resets after meeting the Dwarf. Means we dont see him for 25 turns.
  61. DIM SHARED X, varCarryingCounter, K, varWavingAtSphinxFlag, M, cn, N, W, Q, varSpacePos, varBridgeFlag, MAP, O$, R$
  62.  
  63. 'Set up some variables
  64. varDirections$ = "nsewud"
  65. varKneelingFlag = 0
  66. varWavingAtSphinxFlag = 0
  67. varTurnLastSeenDwarf = 0
  68. varGotWaterFlag = 0
  69. varDwarfChance = 0.97
  70. varLampFuel = 150 ' put some fuel in t'lamp
  71. B2$ = " "
  72. K = 0
  73. varWord1Index = 0
  74. I = 0
  75. X = 0
  76. varTurnCount = 0
  77. varChasmFlag = 0
  78. varBridgeFlag = 0
  79. varKilledFlag = 0
  80. varCasketOpenFlag = 0
  81. varSuppressDwarf = 0
  82. varDwarfEncounters = 0
  83. varSafeOpenFlag = 0
  84. varFlamesFlag = 1
  85. varLampLitFlag = 0
  86. varScore = 0
  87. varCarryingCounter = -3 ' varCarryingCounter is the number of items currently being carried. Wonder why it starts at -3?
  88. varVampireEncounters = 0
  89. varGoblinEncounters = 0
  90. varBearFlag = 0
  91. varRabbitFlag = 0
  92. varScreenWidth = 80 ' Set varScreenWidth
  93. varTurnIncrement = 1 ' Set this flag if the Turn counter is to increment. Some subs will set it to zero so the varTurnCount doesnt increment (inv, save etc)
  94.  
  95. CALL subReadExits
  96. CALL subReadObjectLocations
  97. CALL subReadLocationDescriptions
  98. CALL subReadObjects
  99. CALL subReadVerbs
  100.  
  101. varCurrentLocation = 6 'set starting location
  102.  
  103. PRINT
  104. PRINT "                  W  E  L  C  O  M  E     T  O                   "
  105. PRINT
  106. PRINT " .d8888b.  8888888b.  888    888 8888888 888b    888 Y88b   d88P "
  107. PRINT "d88P  Y88b 888   Y88b 888    888   888   8888b   888  Y88b d88P  "
  108. PRINT "Y88b.      888    888 888    888   888   88888b  888   Y88o88P   "
  109. PRINT " `Y888b.   888   d88P 8888888888   888   888Y88b 888    Y888P    "
  110. PRINT "    `Y88b. 8888888P'  888    888   888   888 Y88b888    d888b    "
  111. PRINT "      `888 888        888    888   888   888  Y88888   d88888b   "
  112. PRINT "Y88b  d88P 888        888    888   888   888   Y8888  d88P Y88b  "
  113. PRINT " `Y8888P'  888        888    888 8888888 888    Y888 d88P   Y88b "
  114. PRINT
  115. PRINT "            A    D    V    E    N    T    U    R    E            "
  116. PRINT
  117. PRINT
  118. PRINT "            GOOD LUCK IN YOUR EXPLORATIONS HERE!!                "
  119. PRINT
  120. PRINT "   Try to find all the treasure and take it to the sphinx.       "
  121. PRINT
  122. PRINT " Original (c) Acornsoft 1982. Dragged into 21st Century by Iain  "
  123. PRINT
  124. PRINT
  125. PRINT "Press Enter to continue!"
  126. INPUT "", dummy$
  127. CLS
  128.  
  129. CALL subPrintLocation(varCurrentLocation)
  130.  
  131. labMainLoop: ' Start of main loop
  132. A$ = " "
  133. X = 0
  134. varWord2$ = " "
  135. varWord1$ = " "
  136. varOutputString$ = ""
  137. M = 0
  138. K = 0
  139. IF varTurnIncrement = 1 THEN
  140.     varTurnCount = varTurnCount + 1 ' Increment turn counter
  141. END IF
  142.  
  143. 'If Light is lit then decrease fuel
  144. IF varLampLitFlag = 1 AND varTurnIncrement = 1 THEN
  145.     varLampFuel = varLampFuel - 1
  146.     varWord1Index = 0
  147.     varWord2Index = 0
  148. END IF
  149.  
  150. 'Reset the Turn Incrementer thingy flag
  151. varTurnIncrement = 1
  152.  
  153. ' varObjectLocations(31) is the frigging dwarf. This makes the dwarf appear 3% of the time if Turns - s >25. Resets varTurnLastSeenDwarf to turns.
  154. ' Dwarf might reappear after 25 turns
  155. ' I replaced RND(1)>0.97 with varDwarfChance. That way I can stop the damn thing killing me while debugging.
  156. ' Need a better variable name for varTurnLastSeenDwarf
  157.  
  158.  
  159. IF RND(1) > varDwarfChance AND varDwarfFlag = 0 AND (varTurnCount - varTurnLastSeenDwarf) > 25 THEN
  160.     varObjectLocations(31) = varCurrentLocation 'put the dwarf in this loc
  161.     varDwarfFlag = 1
  162.     varTurnLastSeenDwarf = varTurnCount
  163. END IF
  164.  
  165. IF varCurrentLocation <> varObjectLocations(31) OR varDwarfChance = 2 THEN 'is the Dwarf NOT here or been disabled
  166.     GOTO labNoDwarf
  167. ELSE
  168.     ' Assume Dwarf IS here
  169.     varDwarfEncounters = varDwarfEncounters + 1 'increment the dwarf encounter counter.
  170.  
  171.     CALL subPrintText("There is a dwarf here. He throws an axe at you.")
  172.     IF varObjectLocations(1) = 0 THEN 'we have no axe in inventory
  173.         varObjectLocations(1) = varCurrentLocation 'if no then leave axe here
  174.     END IF
  175.  
  176.     IF varDwarfEncounters > 6 OR RND(1) > 0.95 THEN 'Have we seen the dwarf 6 times or do hit the unlucky 5%? =we die
  177.         CALL subPrintText("The axe hits you hard in the chest and you bleed to death.")
  178.         CALL subKill
  179.     END IF
  180.  
  181.     IF varObjectLocations(1) = varCurrentLocation THEN 'do I have axe in inventory (location1)?
  182.         CALL subPrintText("The axe misses and lands on the ground next to you.")
  183.     ELSE
  184.         IF varObjectLocations(1) <> varCurrentLocation THEN
  185.             CALL subPrintText("The axe misses then vanishes into thin air.")
  186.         END IF
  187.  
  188.     END IF
  189.  
  190. END IF
  191. 'Reset Dwarf Suppress flag (things like inv, debug etc set this
  192. varSuppressDwarf = 0
  193.  
  194. labNoDwarf:
  195. ' Lets do the Goblins now.
  196. R$ = " "
  197. IF varCurrentLocation = 48 AND varCurrentLocation = varObjectLocations(33) THEN ' Are we in location 48(Hall of the mountain king) and are there goblins here?
  198.     varGoblinEncounters = varGoblinEncounters + 1 'Increment the goblin encounter counTer.
  199.     IF varGoblinEncounters >= 5 THEN 'kill us if more than 5 encounters
  200.         CALL subPrintText("The goblins suddenly leap upon you and tear you limb from limb!")
  201.         CALL subKill
  202.         R$ = ""
  203.     END IF
  204. END IF
  205.  
  206. IF varCurrentLocation = varObjectLocations(43) THEN 'Test for presence of vampires
  207.     varVampireEncounters = varVampireEncounters + 1 'increment vampire encounter counter
  208.     IF varVampireEncounters >= 2 THEN 'if more than two encounters then....
  209.         CALL subPrintText("The vampire leaps on you and drains your blood.")
  210.         CALL subKill ' oh dear...
  211.     END IF
  212. END IF
  213.  
  214. 'is our location>8 ("inside?"), do we not have a lamp, nor is there a lamp here then...
  215. IF varCurrentLocation > 8 AND varObjectLocations(3) <> 1 AND varCurrentLocation <> varObjectLocations(3) THEN
  216.     PRINT
  217.     CALL subPrintText("IT'S VERY DARK.")
  218.     CALL subPrintText("IF YOU MOVE YOU MAY FALL INTO A PIT.")
  219.     GOTO lab200
  220. END IF
  221.  
  222. 'Is the lamp out of fuel? is it lit and do we have it?
  223. IF varLampFuel <= 0 AND varLampLitFlag = 1 AND varObjectLocations(3) = 1 THEN
  224.     PRINT
  225.     CALL subPrintText("Your lamp has run out.")
  226.     varLampLitFlag = 0
  227. ELSE
  228.     IF varLampFuel < 10 AND varLampLitFlag = 1 AND varObjectLocations(3) = 1 THEN 'same tests but for dimming light.
  229.         PRINT
  230.         CALL subPrintText("Your lamp is getting dim.")
  231.     END IF
  232. END IF
  233.  
  234. IF varLampLitFlag = 0 AND varCurrentLocation > 8 THEN
  235.     PRINT
  236.     CALL subPrintText("It's very dark.")
  237.     CALL subPrintText("If you move, you may fall into a pit.")
  238. END IF
  239.  
  240. lab200: 'Get user input and parse it.
  241. PRINT
  242. INPUT "Command "; A$
  243. PRINT
  244.  
  245. IF LEN(A$) = 0 THEN
  246.     CALL subPrintText("What?")
  247.     GOTO lab200
  248. END IF
  249.  
  250. A$ = funConvertLowerCase$(A$)
  251.  
  252. IF LEFT$(A$, 3) = "inv" THEN
  253.     varTurnIncrement = 0 'Tell the turnIncrementer not to increment
  254.     CALL subPrintLocation(1)
  255.     GOTO labMainLoop
  256. END IF
  257.  
  258. IF A$ = "disdwarf" THEN
  259.     CALL subPrintText("Dwarf disabled")
  260.     varTurnIncrement = 0
  261.     varDwarfChance = 2
  262.     varDwarfFlag = 0
  263.     varDwarfIncrement = 0
  264.     varTurnLastSeenDwarf = 0
  265.     varObjectLocations(31) = 0
  266.     '   GoTo lab200
  267. END IF
  268.  
  269. IF A$ = "enadwarf" THEN
  270.     CALL subPrintText("Dwarf enabled")
  271.     varDwarfIncrement = 0
  272.     varTurnIncrement = 0
  273.     varDwarfChance = 0.97
  274.     GOTO lab200
  275. END IF
  276.  
  277. IF A$ = "debug" THEN
  278.     varTurnIncrement = 0 'Tell the turnIncrementer not to increment
  279.     CALL subDebug
  280.     GOTO labMainLoop
  281. END IF
  282.  
  283. 'If single letter command then treat as a direction (NSEWUD)
  284. IF LEN(A$) = 1 THEN
  285.     CALL subVerbMove(A$, varCurrentLocation)
  286.     GOTO labMainLoop
  287. END IF
  288.  
  289. 'Look for a space in the command. Then look for another space in the bit of
  290. 'string after the space. Tells us there's more than one word.
  291. varSpacePos = INSTR(A$, " ")
  292.  
  293. IF INSTR(funTrimSpaces$(RIGHT$(A$, LEN(A$) - varSpacePos)), " ") <> 0 THEN
  294.     CALL subPrintText("I'm sorry. I can't understand more than two words at a time")
  295.     varTurnIncrement = 0
  296.     GOTO labMainLoop
  297. END IF
  298.  
  299. 'If no spaces then process as a single verb
  300. 'else there must be two words so split into varWord1$ and varWord2$ and pass as verb then noun.
  301. IF varSpacePos = 0 THEN
  302.     CALL subProcessVerb(A$)
  303.     GOTO lab211
  304. ELSE
  305.     varWord1$ = funTrimSpaces$(LEFT$(A$, varSpacePos - 1))
  306.     varWord2$ = funTrimSpaces$(RIGHT$(A$, LEN(A$) - varSpacePos))
  307.  
  308.     IF varWord1$ = "load" THEN 'this is a bit cheeky but since the interpreter doesnt take an arbitrary 2nd param, have to intercept & do this.
  309.         varTurnIncrement = 0 'Tell the turnIncrementer not to increment
  310.         CALL subLoad(varWord2$)
  311.         GOTO lab200
  312.     END IF
  313.  
  314.     IF varWord1$ = "save" THEN
  315.         varTurnIncrement = 0 'Tell the turnIncrementer not to increment
  316.         CALL subSave(varWord2$)
  317.         GOTO lab200
  318.     END IF
  319.  
  320.     CALL subProcessVerb(varWord1$) 'Get the index of the Verb entered
  321.     CALL subProcessNoun(varWord2$) 'Get the index of the noun entered
  322. END IF
  323.  
  324. IF varWord1$ = "go" OR varWord1$ = "exit" OR varWord1$ = "leave" THEN
  325.     GOTO lab244
  326. END IF
  327.  
  328. IF varWord1$ = "drink" THEN
  329.     CALL subVerbEat(varWord2Index, 2)
  330.     GOTO labMainLoop
  331. END IF
  332.  
  333. 'varWord1Index and varWord2Index are the indexes of the inputted verb and noun.
  334. 'If varWord1Index isnt indexed as a known word then print "I don't understand the word"
  335. IF varWord1Index = -1 THEN
  336.     CALL subPrintText("I don't understand the word " + varWord1$)
  337.     varTurnIncrement = 0
  338.     IF varWord2Index <> -1 THEN
  339.         GOTO labMainLoop
  340.     END IF
  341. END IF
  342.  
  343. 'Do same for varWord2Index
  344. IF varWord2Index = -1 THEN
  345.     CALL subPrintText("I don't understand the word " + varWord2$)
  346.     varTurnIncrement = 0
  347.     GOTO labMainLoop
  348. ELSE
  349.     IF varWord1Index > 14 THEN 'not one of the first 14 words defined at labVerbs: so process otherwise
  350.         GOTO lab211
  351.     END IF
  352. END IF
  353.  
  354. ' Verbs:
  355. ' We can see that Get and Take jump to the same routine
  356. ' get, take, open, wave, throw, drop, kill, eat, cross, feed, rub, light, read, pay
  357. ON varWord1Index GOTO lab213, lab213, lab214, lab215, lab216, lab217, lab218, lab220, lab221, lab224, lab225, lab226, lab227, lab228
  358.  
  359. lab211:
  360. IF A$ = "exit" THEN
  361.     CALL subVerbOut(varCurrentLocation) 'synonym with Out.
  362.     GOTO labMainLoop
  363. ELSE
  364.     IF varWord1Index <> -1 THEN
  365.         K = varWord1Index - 14 'so now we've detected a verb that has no noun K=index of that verb - 14 (<14=two word verbs)
  366.     ELSE
  367.         CALL subProcessNoun(A$)
  368.         IF varWord2Index = -1 THEN
  369.             CALL subPrintText("I don't understand the word " + A$)
  370.             GOTO labMainLoop
  371.         ELSE
  372.             CALL subPrintText("What do you want to do to the " + A$)
  373.             GOTO labMainLoop
  374.         END IF
  375.     END IF
  376. END IF
  377.  
  378. lab212:
  379. ON K GOTO lab237, lab229, lab230, lab230, lab231, lab232, lab235, lab236, lab229, lab238, lab240, lab243, lab243, lab243, lab243, lab243, lab243, lab219, lab244
  380. CALL subPrintText("I can't apply that without a noun")
  381. GOTO labMainLoop
  382.  
  383. lab213: 'Get/Take
  384.  
  385. CALL subVerbGetTake(varWord2Index, varCurrentLocation, 1)
  386. IF X = 0 THEN 'X seems to be set to 1 on an unsuccesful get
  387.     varCarryingCounter = varCarryingCounter + 1 'varCarryingCounter=Carrying = there's a max of 15
  388.     GOTO labMainLoop
  389. ELSE
  390.     GOTO labMainLoop
  391. END IF
  392.  
  393. lab214: 'Open
  394. CALL subVerbOpen(varWord2Index)
  395. GOTO labMainLoop
  396.  
  397. lab215: 'Wave
  398. CALL subVerbWave(varWord2Index)
  399. GOTO labMainLoop
  400.  
  401. lab216: 'Throw
  402. CALL subVerbThrow(varWord2Index)
  403. IF X = 0 THEN 'X seems to be set to 1 on an unsuccesful throw
  404.     varCarryingCounter = varCarryingCounter - 1 'varCarryingCounter=Carrying - there's a max of 15
  405.     GOTO labMainLoop
  406. ELSE
  407.     GOTO labMainLoop
  408. END IF
  409.  
  410. lab217: 'drop = takes you to Get routine
  411. CALL subVerbGetTake(varWord2Index, 1, varCurrentLocation) 'Drop - calls 'get with INV a location
  412. IF X = 0 THEN
  413.     varCarryingCounter = varCarryingCounter - 1 'varCarryingCounter=Carrying - there's a max of 15
  414.     GOTO labMainLoop
  415. ELSE
  416.     GOTO labMainLoop
  417. END IF
  418.  
  419. lab218: 'Kill
  420. CALL subVerbKill(varWord2Index)
  421. GOTO labMainLoop
  422.  
  423. lab219: 'Fill
  424. CALL subVerbFill(varWord2Index)
  425. GOTO labMainLoop
  426.  
  427. lab220: 'Eat
  428. CALL subVerbEat(varWord2Index, 1)
  429. GOTO labMainLoop
  430.  
  431. lab221: 'Cross
  432. CALL subVerbCross(varWord2Index)
  433. GOTO labMainLoop
  434. IF varWord2Index = 53 THEN
  435.     CALL subVerbCross(varWord2Index)
  436.     GOTO labMainLoop
  437. END IF
  438.  
  439. IF varWord2Index = 56 THEN 'varWord2Index=building
  440.     IF varCurrentLocation <> 3 AND varCurrentLocation < 9 THEN 'Not Blacksmiths Forge and not outside
  441.         varCurrentLocation = 3
  442.         CALL subPrintLocation(varCurrentLocation)
  443.         GOTO labMainLoop
  444.     ELSE
  445.         IF varCurrentLocation = 3 THEN
  446.             varCurrentLocation = 2
  447.             CALL subPrintLocation(varCurrentLocation)
  448.             GOTO labMainLoop
  449.         ELSE
  450.             CALL subPrintText("I can't apply that")
  451.             GOTO labMainLoop
  452.         END IF
  453.     END IF
  454. END IF
  455.  
  456. lab224:
  457. CALL subVerbFeed(varWord2Index)
  458. GOTO labMainLoop
  459.  
  460. lab225:
  461. CALL subVerbRub(varWord2Index)
  462. GOTO labMainLoop
  463.  
  464. lab226:
  465. CALL subVerbLight(varWord2Index)
  466. GOTO labMainLoop
  467.  
  468. lab227:
  469. CALL subVerbRead(varWord2Index)
  470. GOTO labMainLoop
  471.  
  472. lab228: 'pay
  473. CALL subVerbPay(varWord2Index)
  474. GOTO labMainLoop
  475.  
  476. lab229:
  477. CALL subVerbIn(varCurrentLocation)
  478. GOTO labMainLoop
  479.  
  480. lab230:
  481. CALL subVerbOut(varCurrentLocation)
  482. GOTO labMainLoop
  483.  
  484. lab231:
  485. R$ = "#" 'This # was something different
  486. varKneelingFlag = 1
  487. CALL subPrintText("You are kneeling down.")
  488. GOTO labMainLoop
  489.  
  490. lab232:
  491. CALL subPrintText("You don't want to quit already do you?")
  492. varTurnIncrement = 0 'dont need to increment the turn counter
  493.  
  494. lab233:
  495. INPUT "yes or no", A$
  496. A$ = LEFT$(funConvertLowerCase$(A$), 1)
  497. IF A$ = "n" THEN
  498.     GOTO labMainLoop
  499. END IF
  500.  
  501. IF A$ = "y" THEN
  502.     CALL subPrintText("OK")
  503.     CALL subCalculateScore(varCurrentLocation)
  504.     END
  505. ELSE
  506.     GOTO lab233
  507. END IF
  508.  
  509. lab235: 'score
  510. CALL subCalculateScore(varCurrentLocation)
  511. GOTO labMainLoop
  512.  
  513. lab236: 'look
  514. CALL subPrintLocation(varCurrentLocation)
  515. GOTO labMainLoop
  516.  
  517. lab237: 'inventory
  518. CALL subPrintLocation(1)
  519. GOTO labMainLoop
  520.  
  521. lab238: 'help
  522. CALL subPrintHelp
  523. GOTO labMainLoop
  524.  
  525. lab240: 'DIAXOS
  526.  
  527. 'not all BASICs seem to handle XORing so tidily so have done it manually.
  528. IF varSafeOpenFlag = 0 THEN
  529.     varSafeOpenFlag = 1
  530. ELSEIF varSafeOpenFlag = 1 THEN
  531.     varSafeOpenFlag = 0
  532. END IF
  533.  
  534. 'varSafeOpenFlag = varSafeOpenFlag Xor 1 'varSafeOpenFlag is the safe door open flag. Every time we say diaxos, the safe door toggles
  535. CALL subPrintText("There was a very loud creaking sound then!")
  536. IF varCurrentLocation = 137 THEN 'Wizards spell chamber
  537.     varCurrentLocation = 138 'West Antechamber
  538. ELSE
  539.     IF varCurrentLocation = 141 THEN 'Room similar to spell chamber
  540.         varCurrentLocation = 11 ' Sorcerers Lair
  541.     END IF
  542. END IF
  543. CALL subPrintLocation(varCurrentLocation)
  544. GOTO labMainLoop
  545.  
  546. lab243:
  547. varWord1$ = LEFT$(varWord1$, 1)
  548. CALL subVerbMove(varWord1$, varCurrentLocation)
  549. GOTO labMainLoop
  550.  
  551. lab244:
  552. varWord2$ = funTrimSpaces$(varWord2$)
  553.  
  554. CALL subProcessVerb(varWord2$)
  555.  
  556. IF varWord1Index > 25 AND varWord1Index < 32 THEN 'varWord1Index is the verb index. 26=N s,e,w,u 31=D
  557.     CALL subVerbMove(LEFT$(varWord2$, 1), varCurrentLocation)
  558.     GOTO labMainLoop
  559. ELSE
  560.     IF LEN(varWord2$) = 1 THEN
  561.         CALL subVerbMove(varWord2$, varCurrentLocation)
  562.         GOTO labMainLoop
  563.     ELSE
  564.         IF varWord1Index <> -1 THEN
  565.             K = varWord1Index - 14
  566.             GOTO lab212
  567.         END IF
  568.     END IF
  569. END IF
  570.  
  571. 'double check this logic if there's problems
  572. CALL subProcessNoun(varWord2$)
  573.  
  574. IF varWord2Index = -1 THEN
  575.     CALL subPrintText("I can't apply that")
  576.     GOTO labMainLoop
  577. END IF
  578.  
  579. IF varWord2Index = 53 THEN 'bridge
  580.     CALL subVerbCross(varWord2Index)
  581.     GOTO labMainLoop
  582. END IF
  583.  
  584. IF varWord2Index <> 56 THEN 'building
  585.     CALL subPrintText("I can't apply that")
  586.     GOTO labMainLoop
  587. ELSE
  588.     IF varCurrentLocation <> 3 AND varCurrentLocation < 9 THEN
  589.         varCurrentLocation = 3
  590.         CALL subPrintLocation(varCurrentLocation)
  591.         GOTO labMainLoop
  592.     ELSE
  593.         IF varCurrentLocation = 3 THEN
  594.             varCurrentLocation = 2
  595.             CALL subPrintLocation(varCurrentLocation)
  596.             GOTO labMainLoop
  597.         END IF
  598.     END IF
  599. END IF
  600.  
  601. CALL subPrintText("I can't apply that")
  602. GOTO labMainLoop
  603.  
  604. SUB subKill ()
  605.     PRINT
  606.     CALL subPrintText("Oh dear you seem to have been killed !")
  607.     varKilledFlag = varKilledFlag - 100
  608.     CALL subCalculateScore(varCurrentLocation)
  609.     CALL subPrintText("You had " + STR$(varTurnCount) + " turns.")
  610.     END
  611. END SUB
  612.  
  613. SUB subGetObjName (n) 'returns the nth object
  614.     'can get rid of this sub really.
  615.     R$ = varObjectDesc$(n)
  616. END SUB
  617.  
  618. SUB subProcessNoun (B2$)
  619.     'Process Nouns (B2$ is the second part of a two word command)
  620.     'we're going to get the index number of the noun
  621.  
  622.     WHILE B2$ <> R$ AND i% <= 57
  623.         i% = i% + 1
  624.         R$ = varObjectDesc$(i%)
  625.     WEND
  626.     IF i% >= 57 THEN
  627.         X = 1
  628.         varWord2Index = -1
  629.     ELSE
  630.         varWord2Index = i% 'Set varWord2Index to the index of the word
  631.         varWord2$ = R$ 'and R$ to the word itself
  632.     END IF
  633. END SUB
  634.  
  635. SUB subProcessVerb (b1$) 'Verb?
  636.     'Process Verbs (B1$ is the first part of a two word command)
  637.     i% = 0
  638.     RESTORE labVerbs
  639.     WHILE b1$ <> R$ AND i% <= 38
  640.         i% = i% + 1
  641.         R$ = varVerb$(i%)
  642.     WEND
  643.  
  644.     IF i% = 38 THEN
  645.         X = 1
  646.         varWord1Index = -1
  647.     ELSE
  648.         varWord1Index = i%
  649.         varWord1$ = R$
  650.     END IF
  651. END SUB
  652.  
  653. SUB subPrintLocation (varCurrentLocation) 'prints out location, exits, objects plus other bits
  654.     DIM varOutputString$
  655.  
  656.     varCounter = 0
  657.     cn = 0
  658.     varOutputString$ = ""
  659.     IF varCurrentLocation = 1 THEN GOTO lab278 'called for INV so jump to INV processing
  660.  
  661.     R$ = varLocationDescription$(varCurrentLocation)
  662.  
  663.     'Some Dwarf shenanigans
  664.     IF varObjectLocations(31) <> 0 THEN
  665.         varObjectLocations(31) = 0
  666.         varDwarfFlag = 1 'weve bumped into the dwarf so set his flag on.
  667.     END IF
  668.  
  669.     CALL subPrintText("You are " + R$)
  670.  
  671.     IF varCurrentLocation = 136 OR varCurrentLocation = 15 THEN varObjectLocations(56) = varCurrentLocation
  672.  
  673.     IF varCurrentLocation = 16 AND varFlamesFlag = 1 THEN
  674.         CALL subPrintText("The walls are very hot!")
  675.     ELSE
  676.         IF varCurrentLocation = 16 THEN
  677.             CALL subPrintText("The walls are steaming!")
  678.         END IF
  679.     END IF
  680.  
  681.     'If loc isnt Forge, serpents stomach or bottom of rock slide then call subPrintExits with varCurrentLocation. These locs dont have exits?
  682.     IF varCurrentLocation <> 3 AND varCurrentLocation <> 142 AND varCurrentLocation <> 143 THEN
  683.         CALL subPrintExits(varCurrentLocation)
  684.         IF ABS(varCurrentLocation - 19) = 1 AND varChasmFlag = 1 THEN
  685.             PRINT
  686.         ELSE
  687.             IF ABS(varCurrentLocation - 42) = 1 AND varBridgeFlag = 1 THEN
  688.                 PRINT
  689.             END IF
  690.         END IF
  691.     END IF
  692.  
  693.     IF varChasmFlag = 1 AND ABS(varCurrentLocation - 19) = 1 THEN
  694.         CALL subPrintText("A bridge now spans the chasm.")
  695.         varObjectLocations(53) = varCurrentLocation 'A bridge now spans the
  696.     END IF
  697.  
  698.     IF varBridgeFlag = 1 AND ABS(varCurrentLocation - 42) = 1 THEN
  699.         CALL subPrintText("A bridge now spans the glacier.")
  700.         varObjectLocations(53) = varCurrentLocation
  701.     END IF
  702.  
  703.     IF varCurrentLocation = 26 OR varCurrentLocation = 27 THEN
  704.         varObjectLocations(53) = varCurrentLocation
  705.     END IF
  706.  
  707.     lab278: 'display the objects, either INV if varCurrentLocation=1 or just what's here
  708.     j = 0
  709.     I = 0
  710.     varCounter = 0
  711.     WHILE j < 52 'objects under #52 only.
  712.         j = j + 1
  713.         IF varObjectLocations(j) = varCurrentLocation THEN
  714.             varCounter = varCounter + 1 'count the number of things at this location.
  715.         END IF
  716.     WEND
  717.  
  718.     IF varCounter = 0 AND varCurrentLocation = 1 THEN 'if count=0 and location=1 then print 'not carrying anything'
  719.         CALL subPrintText("You are not carrying anything.")
  720.         GOTO lab284
  721.     ELSE
  722.         IF varCounter = 0 AND varCurrentLocation <> 1 THEN
  723.             GOTO lab284 'there's nothing here
  724.         ELSE
  725.             PRINT
  726.             varMAX = varCounter
  727.         END IF
  728.     END IF
  729.  
  730.     IF varCurrentLocation = 1 THEN 'is location =1 (inv)
  731.         varOutputString$ = "You're currently holding "
  732.     ELSE
  733.         varOutputString$ = "There is "
  734.     END IF
  735.  
  736.     I = 0
  737.     cn = 0
  738.     varCounter = varMAX
  739.  
  740.     WHILE I < 52 'Loop through all the objects, poss replace with a for/next. After obj 52 we dont want to display
  741.         I = I + 1
  742.         IF varObjectLocations(I) = varCurrentLocation THEN 'run through the list of objects. check if something is here.
  743.             CALL subObjectText(I, varCounter, varCurrentLocation) 'If there is then..... call OT with the Ith object (in the object list) and the number of objects at this location, had to add varCurrentLocation - poss QB bug?
  744.             varOutputString$ = varOutputString$ + R$
  745.             varCounter = varCounter - 1 'reduce the count and repeat
  746.         END IF
  747.     WEND
  748.  
  749.     CALL subPrintText(varOutputString$)
  750.  
  751.     lab284:
  752.     IF varDwarfEncounters <> 0 AND varDwarfFlag = 1 THEN
  753.         varObjectLocations(31) = varCurrentLocation
  754.     END IF
  755.  
  756.     IF varCasketOpenFlag = 1 AND varCurrentLocation = 94 THEN
  757.         CALL subPrintText("The casket is open.")
  758.     END IF
  759.  
  760.     IF varCurrentLocation = 24 AND varSafeOpenFlag = 1 THEN
  761.         CALL subPrintText("The safe door is open.")
  762.     END IF
  763.  
  764.     PRINT
  765. END SUB
  766.  
  767. SUB subPrintExits (varCurrentLocation)
  768.     'This routine just prints out "there are exits to the North... etc"
  769.     I = varCurrentLocation * 6 - 6
  770.  
  771.     FOR J = 1 TO 6
  772.         MAP = varExits(I + J)
  773.         IF MAP > 0 THEN
  774.             varCounter = varCounter + 1 'increment exit counter
  775.             varExitArray(J) = 1
  776.         ELSE
  777.             varExitArray(J) = 0
  778.         END IF
  779.     NEXT J
  780.  
  781.     IF varCounter > 1 THEN
  782.         O$ = "There are exits to the "
  783.     ELSE
  784.         IF varCounter = 1 THEN
  785.             O$ = "There is an exit "
  786.         END IF
  787.     END IF
  788.  
  789.     FOR J = 1 TO 6
  790.         ' changed this a bit from original code because of data mappings
  791.         IF J = 1 THEN R$ = "north"
  792.         IF J = 2 THEN R$ = "south"
  793.         IF J = 3 THEN R$ = "east"
  794.         IF J = 4 THEN R$ = "west"
  795.         IF J = 5 THEN R$ = "up"
  796.         IF J = 6 THEN R$ = "down"
  797.         IF varCounter = 0 OR varExitArray(J) = 0 THEN GOTO lab296
  798.         IF varCounter > 2 THEN O$ = O$ + R$ + ", "
  799.         IF varCounter = 2 THEN O$ = O$ + R$ + " and "
  800.         IF varCounter = 1 THEN O$ = O$ + R$ + "."
  801.         varCounter = varCounter - 1
  802.         lab296:
  803.     NEXT J
  804.     CALL subPrintText(O$)
  805. END SUB
  806.  
  807. SUB subVerbOpen (varWord2Index) 'Open
  808.     IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
  809.         CALL subPrintText("I see no " + varWord2$ + " here.")
  810.         GOTO lab306
  811.     END IF
  812.  
  813.     IF varWord2Index = 40 AND varCurrentLocation = 94 AND varCasketOpenFlag = 0 THEN
  814.         varObjectLocations(43) = 94
  815.         varCasketOpenFlag = 1
  816.         CALL subPrintLocation(varCurrentLocation)
  817.         GOTO lab306
  818.     END IF
  819.  
  820.     IF varWord2Index = 39 THEN
  821.         CALL subPrintText("You cant do that at the moment.")
  822.     END IF
  823.  
  824.     IF varWord2Index = 8 AND varObjectLocations(5) = 1 THEN
  825.         CALL subPrintText("The chest opens easily with the keys revealing many rubies.")
  826.         varObjectLocations(16) = varCurrentLocation
  827.     ELSE
  828.         IF varWord2Index = 8 THEN
  829.             CALL subPrintText("You can't with no keys!")
  830.         END IF
  831.     END IF
  832.  
  833.     IF varWord2Index = 10 AND varObjectLocations(7) = 1 THEN
  834.         CALL subPrintText("You open up the clam with the jack and many pearls roll out.")
  835.         varObjectLocations(18) = varCurrentLocation
  836.     ELSE
  837.         IF varWord2Index = 10 THEN
  838.             CALL subPrintText("You can't do that at the moment")
  839.         END IF
  840.     END IF
  841.  
  842.     IF varWord2Index = 8 OR varWord2Index = 10 OR varWord2Index = 39 THEN GOTO lab306
  843.     CALL subPrintText("I can't apply that")
  844.     lab306:
  845. END SUB
  846.  
  847. SUB subVerbMove (A$, N)
  848.     'subVerbMove deals with single letter commands so N,S,E,W,U,D
  849.     'N=starting location?
  850.     'A$=the command (N,S... etc)
  851.     M = INSTR(varDirections$, A$) ' M is the offset of the given command in the string varDirections$
  852.     X = 0 'Exit flag
  853.  
  854.     IF M = 0 THEN
  855.         CALL subPrintText("I don't understand the word " + A$)
  856.         GOTO lab318
  857.     END IF
  858.  
  859.     CALL subTrialMove(N, M) 'Call subTrialMove with current loc and offset of command
  860.     '   RESTORE labExitData
  861.  
  862.     IF X = 1 THEN GOTO lab314
  863.  
  864.     IF varLampLitFlag = 0 THEN
  865.         IF N > 8 THEN
  866.             IF RND(1) > 0.5 THEN
  867.                 CALL subPrintText("You fell in a pit")
  868.                 CALL subKill
  869.             END IF
  870.         END IF
  871.     END IF
  872.  
  873.     MAP = varExits(N * 6 - 6 + M)
  874.  
  875.     IF MAP = 0 THEN
  876.         CALL subPrintText("There is no way to go that direction!")
  877.     ELSE
  878.         varCurrentLocation = MAP
  879.     END IF
  880.  
  881.     lab314:
  882.     IF varCurrentLocation = 4 THEN 'inside the forest 25% chance of putting you at the end of the road (L2)
  883.         IF RND(1) > 0.75 THEN
  884.             varCurrentLocation = 2
  885.         END IF
  886.     END IF
  887.  
  888.     IF varBearFlag = 1 THEN varObjectLocations(35) = varCurrentLocation 'Make the Bear follow us if bear=1
  889.  
  890.     IF varRabbitFlag = 1 THEN varObjectLocations(38) = varCurrentLocation 'Make the rabbit follow us if rabbit=1
  891.  
  892.     CALL subPrintLocation(varCurrentLocation)
  893.  
  894.     IF varCurrentLocation = 33 AND RND(1) > 0.5 THEN
  895.         CALL subPrintText("A hollow voice whispers DIAXOS.")
  896.     END IF
  897.  
  898.  
  899.     lab318:
  900. END SUB
  901.  
  902. SUB subVerbGetTake (varWord2Index, N, K)
  903.     'Call subVerbGetTake(varWord2Index, 1, varCurrentLocation) - sample call
  904.     'jack, food, mouse,bridge,swamp,lake,building
  905.     IF NOT (varWord2Index = 8 OR varWord2Index = 10 OR ABS(varWord2Index - 37) <= 7 OR varWord2Index >= 53) THEN
  906.         GOTO lab321
  907.     ELSE
  908.         X = 1
  909.         IF varObjectLocations(varWord2Index) <> N THEN
  910.             'Seems to deal with taking something that isnt there. There was some funky code here that I could get the jist of so just removed
  911.             'Call subResponse(8 - Sgn(N - 1)) '??
  912.             CALL subPrintText("I see no " + varWord2$ + " here")
  913.             GOTO lab332
  914.         ELSE
  915.             CALL subPrintText("You're joking!")
  916.             GOTO lab332
  917.         END IF
  918.     END IF
  919.  
  920.     lab321:
  921.     R$ = "'"
  922.     IF K = 1 AND varWord2Index = 28 AND varObjectLocations(27) <> 1 AND varCurrentLocation = 15 THEN
  923.         CALL subPrintText("You have nothing to put it in, so it runs away through your fingers.")
  924.         GOTO lab332
  925.     END IF
  926.  
  927.     IF varWord2Index = 28 AND varGotWaterFlag = 1 THEN
  928.         varObjectLocations(28) = 1
  929.     ELSE
  930.         IF varWord2Index = 28 THEN
  931.             varObjectLocations(28) = 15
  932.         ELSE
  933.             IF varWord2Index = 52 AND K = 1 THEN
  934.                 CALL subPrintText("The mouse runs around refusing to be caught.")
  935.                 GOTO lab332
  936.             END IF
  937.         END IF
  938.     END IF
  939.  
  940.     R$ = " "
  941.  
  942.     IF varWord2Index = 52 AND N = 1 AND K = 111 AND varObjectLocations(42) = 111 THEN
  943.         varObjectLocations(42) = 0
  944.         varWord1$ = "drop"
  945.         varWord2$ = "mouse." + CHR$(10) + CHR$(13) + "The elephant sees it and runs away"
  946.     END IF
  947.  
  948.     R$ = ""
  949.  
  950.     IF varCarryingCounter = 15 AND K = 1 THEN
  951.         CALL subPrintText("You can't carry anything more, you'll have to drop something first.")
  952.         X = 1
  953.         GOTO lab332
  954.     END IF
  955.  
  956.     IF K = 1 AND varObjectLocations(27) = 1 AND varObjectLocations(28) = 1 AND varWord2Index = 28 THEN
  957.         CALL subPrintText("Your bottle is already full.")
  958.         X = 1
  959.         GOTO lab330
  960.     END IF
  961.  
  962.     IF N = 1 AND varWord2Index = 27 AND varGotWaterFlag = 1 THEN
  963.         varGotWaterFlag = 0
  964.         CALL subPrintText("You drop the bottle and all the water leaks away!")
  965.         varCarryingCounter = varCarryingCounter - 1
  966.         varWord1$ = "will have to get some more from"
  967.         varWord2$ = "lake"
  968.     END IF
  969.  
  970.     IF varWord2Index = 28 AND K = 1 AND varObjectLocations(28) = N THEN
  971.         varWord1$ = "fill"
  972.         varWord2$ = "bottle with the water"
  973.     END IF
  974.  
  975.     IF varObjectLocations(varWord2Index) = N THEN
  976.         varObjectLocations(varWord2Index) = K
  977.         CALL subPrintText("You " + varWord1$ + " the " + varWord2$ + ".")
  978.     ELSE
  979.         IF K = 1 THEN
  980.             CALL subPrintText("I see no " + varWord2$ + " here.")
  981.             X = 1
  982.         ELSE
  983.             CALL subPrintText("You're not carrying the " + varWord2$ + " here.")
  984.             X = 1
  985.         END IF
  986.     END IF
  987.  
  988.     lab330:
  989.     IF varObjectLocations(28) = 1 AND varWord2Index = 28 THEN
  990.         varObjectLocations(28) = 15
  991.         varGotWaterFlag = 1
  992.     ELSE
  993.         IF varWord2Index = 28 THEN
  994.             varObjectLocations(28) = 15
  995.             varGotWaterFlag = 0
  996.         END IF
  997.     END IF
  998.  
  999.     IF varCurrentLocation = 117 AND N = 1 AND varWord2Index <> 9 THEN
  1000.         varObjectLocations(varWord2Index) = 0
  1001.         CALL subPrintText("Oh dear the " + varWord2$ + " sank into the swamp.")
  1002.     END IF
  1003.     lab332:
  1004. END SUB
  1005.  
  1006. SUB subTrialMove (varCurrentLocation, n) 'seems to be like a trial move...
  1007.  
  1008.     'X is set high if a move cant be made for whatever reason.
  1009.     IF varCurrentLocation = varObjectLocations(36) THEN
  1010.         I = 11
  1011.         DO
  1012.             I = I + 1
  1013.         LOOP UNTIL varObjectLocations(I) = 1 OR I = 30 'Having a quick look through the inv for something the pirate wants
  1014.  
  1015.         IF I < 30 THEN
  1016.             varObjectLocations(I) = 51
  1017.             CALL subGetObjName(I)
  1018.             CALL subPrintText("The pirate snatches your " + R$)
  1019.             c% = c% - 1
  1020.             IF I = 27 AND varGotWaterFlag = 1 THEN
  1021.                 varGotWaterFlag = 0
  1022.             END IF
  1023.         END IF
  1024.     END IF
  1025.  
  1026.     IF varCurrentLocation = varObjectLocations(35) THEN
  1027.         varBearFlag = 1
  1028.         CALL subPrintText("There is a brown bear following you.")
  1029.     END IF
  1030.  
  1031.     IF varCurrentLocation = varObjectLocations(38) THEN
  1032.         varRabbitFlag = 1
  1033.         CALL subPrintText("The giant rabbit is still with you!")
  1034.     END IF
  1035.  
  1036.     IF varCurrentLocation = 16 AND varFlamesFlag = 1 AND n = 3 THEN
  1037.         X = 1
  1038.         CALL subPrintText("The flame's heat drives you back.")
  1039.     END IF
  1040.  
  1041.     IF varCurrentLocation = 117 AND n = 3 AND varObjectLocations(41) = 117 THEN
  1042.         CALL subPrintText("The crocodile snaps its jaws neatly biting your leg off. You bleed to death!")
  1043.         CALL subKill
  1044.     END IF
  1045.  
  1046.     IF varCurrentLocation = 94 AND n <> 6 AND varCasketOpenFlag = 0 THEN
  1047.         varObjectLocations(43) = 94
  1048.         varCasketOpenFlag = 1
  1049.         GOTO lab349
  1050.     END IF
  1051.  
  1052.     IF varCurrentLocation = 111 AND n = 1 AND varCurrentLocation = varObjectLocations(42) THEN
  1053.         CALL subPrintText("The elephant is blocking the way.")
  1054.         X = 1
  1055.         GOTO lab349
  1056.     END IF
  1057.  
  1058.     IF varCurrentLocation = 48 AND varCurrentLocation = varObjectLocations(33) AND n = 4 THEN
  1059.         X = 1
  1060.         CALL subPrintText("The goblins crowd around and stop you.")
  1061.     END IF
  1062.  
  1063.     IF varCurrentLocation = 30 AND n = 1 AND varCurrentLocation = varObjectLocations(32) THEN
  1064.         X = 1
  1065.         CALL subPrintText("The ogre is blocking the way.")
  1066.     END IF
  1067.  
  1068.     IF varCurrentLocation = 36 AND n = 6 AND varCurrentLocation = varObjectLocations(30) THEN
  1069.         X = 1
  1070.         CALL subPrintText("The dragon is blocking the way.")
  1071.     END IF
  1072.  
  1073.     IF varCurrentLocation = 32 AND varCurrentLocation = varObjectLocations(37) AND varCurrentLocation = varObjectLocations(35) THEN
  1074.         CALL subPrintText("The bear growls and chases the orc away.")
  1075.         varObjectLocations(35) = 0 'make poor friendly bear gone
  1076.         varObjectLocations(37) = 0 'make Orc gone
  1077.         varBearFlag = 0 ' Bear flag = off
  1078.     END IF
  1079.  
  1080.     IF varCurrentLocation = 32 AND varCurrentLocation = varObjectLocations(37) AND n = 1 THEN
  1081.         X = 1
  1082.         CALL subPrintText("The orc won't let you get by.")
  1083.     END IF
  1084.  
  1085.     IF (varCurrentLocation = 24 AND n = 5) OR (varCurrentLocation = 51 AND n = 6) THEN
  1086.         IF varSafeOpenFlag = 0 THEN
  1087.             X = 1
  1088.             CALL subPrintText("You can't! The safe door is shut.")
  1089.             PRINT
  1090.         END IF
  1091.     END IF
  1092.  
  1093.     IF varCurrentLocation = 51 AND n = 6 THEN
  1094.         IF varSafeOpenFlag = 0 THEN
  1095.             X = 1
  1096.             CALL subPrintText("You can't! The safe door is shut.")
  1097.             PRINT
  1098.         END IF
  1099.     END IF
  1100.  
  1101.     IF varCurrentLocation = 28 AND n = 6 THEN
  1102.         CALL subPrintText("ARRRGH! CRASH!! The rocks gave way and you rolled to the bottom of the rock slide.")
  1103.         PRINT
  1104.     END IF
  1105.     lab349:
  1106. END SUB
  1107.  
  1108. SUB subVerbKill (w) 'Kill
  1109.     IF varObjectLocations(w) <> varCurrentLocation THEN
  1110.         CALL subPrintText("I see no " + varWord2$ + " here.")
  1111.         GOTO lab354
  1112.     ELSE
  1113.         IF w < 30 OR w = 39 OR w = 40 OR ABS(w - 48) < 4 OR w > 52 THEN
  1114.             CALL subPrintText("You're joking!")
  1115.             GOTO lab354
  1116.         END IF
  1117.     END IF
  1118.     lab351:
  1119.     INPUT "What with? Your bare hands ? ", b$
  1120.     b$ = funConvertLowerCase$(b$)
  1121.     IF b$ <> "no" THEN
  1122.         GOTO lab353
  1123.     ELSE
  1124.         INPUT "What with then ? ", varWord2$
  1125.         CALL subProcessNoun(funConvertLowerCase$(varWord2$))
  1126.         IF X = 1 THEN
  1127.             GOTO lab354
  1128.         ELSE
  1129.             varWord1$ = "throw"
  1130.             CALL subVerbThrow(varWord2Index)
  1131.             IF X = 1 THEN
  1132.                 GOTO lab354
  1133.             ELSE
  1134.                 varCarryingCounter = varCarryingCounter - 1
  1135.                 GOTO lab354
  1136.             END IF
  1137.         END IF
  1138.     END IF
  1139.  
  1140.     lab353:
  1141.     IF b$ <> "yes" THEN
  1142.         CALL subPrintText("yes or no")
  1143.         GOTO lab351
  1144.     ELSE
  1145.         IF w = 30 THEN
  1146.             CALL subPrintText("Well done! You vanquished a dragon with your bare hands!")
  1147.             varObjectLocations(30) = 0
  1148.             varObjectLocations(6) = varCurrentLocation
  1149.         ELSE
  1150.             CALL subPrintText("Your blows are useless.")
  1151.         END IF
  1152.     END IF
  1153.  
  1154.     lab354:
  1155. END SUB
  1156.  
  1157. SUB subVerbWave (varWord2Index) 'Wave
  1158.     IF varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
  1159.         CALL subPrintText("You're not carrying the " + varWord2$ + ".")
  1160.         GOTO lab362
  1161.     ELSE
  1162.         IF varWord2Index = 28 THEN
  1163.             CALL subPrintText("I can't apply that")
  1164.             GOTO lab362
  1165.         END IF
  1166.     END IF
  1167.  
  1168.     IF varWord2Index <> 4 THEN
  1169.         CALL subPrintText("OK")
  1170.         GOTO lab362
  1171.     END IF
  1172.  
  1173.  
  1174.     IF varCurrentLocation = 18 AND varChasmFlag = 0 THEN
  1175.         CALL subPrintText("A bridge now spans the chasm.")
  1176.         varChasmFlag = 1
  1177.         varObjectLocations(53) = varCurrentLocation
  1178.         GOTO lab362
  1179.     ELSE
  1180.         IF varCurrentLocation = 135 AND varObjectLocations(26) = 0 THEN
  1181.             CALL subPrintText("The fairy king appears, hands you a mithril ring, bows and slips away.")
  1182.             varObjectLocations(26) = 1
  1183.             GOTO lab362
  1184.         END IF
  1185.     END IF
  1186.  
  1187.     IF varCurrentLocation = 41 AND varBridgeFlag = 0 THEN
  1188.         CALL subPrintText("A bridge now spans the glacier.")
  1189.         varBridgeFlag = 1
  1190.         varObjectLocations(53) = varCurrentLocation
  1191.         GOTO lab362
  1192.     END IF
  1193.  
  1194.     IF varCurrentLocation = 50 AND varKneelingFlag = 1 THEN
  1195.         varWavingAtSphinxFlag = 1 'sets flag of waving at sphinx
  1196.         CALL subFinish
  1197.     END IF
  1198.  
  1199.     CALL subPrintText("Nothing happens")
  1200.     lab362:
  1201. END SUB
  1202.  
  1203. SUB subVerbEat (varWord2Index, n) 'Eat
  1204.     IF varWord2Index = 28 AND n = 2 AND (varGotWaterFlag = 1 OR varCurrentLocation = 15) THEN
  1205.         CALL subPrintText("Thanks! It was delicious")
  1206.         varGotWaterFlag = 0
  1207.         GOTO lab369
  1208.     END IF
  1209.  
  1210.     IF varWord2Index = 28 THEN
  1211.         CALL subPrintText("I can't apply that")
  1212.         GOTO lab369
  1213.     END IF
  1214.  
  1215.     IF varObjectLocations(varWord2Index) <> 1 THEN
  1216.         CALL subPrintText("You're not carrying the " + varWord2$ + " here.")
  1217.         GOTO lab369
  1218.     END IF
  1219.  
  1220.     IF n = 1 THEN
  1221.         IF varWord2Index = 9 OR varWord2Index = 29 OR varWord2Index = 50 THEN
  1222.             CALL subPrintText("Thanks! It was delicuious")
  1223.             varObjectLocations(varWord2Index) = 0
  1224.             GOTO lab369
  1225.         END IF
  1226.     END IF
  1227.  
  1228.     CALL subPrintText("You're joking!")
  1229.     lab369:
  1230. END SUB
  1231.  
  1232. SUB subVerbCross (varWord2Index) 'Cross
  1233.     IF varObjectLocations(varWord2Index) <> 1 AND varObjectLocations(varWord2Index) <> varCurrentLocation AND varWord2Index <> 28 THEN
  1234.         CALL subPrintText("I see no " + varWord2$ + " here.")
  1235.         GOTO lab378
  1236.     ELSE
  1237.         IF varWord2Index = 28 THEN
  1238.             CALL subPrintText("I can't apply that")
  1239.             GOTO lab378
  1240.         END IF
  1241.     END IF
  1242.  
  1243.     IF varCurrentLocation <> 18 THEN
  1244.         GOTO lab372
  1245.     ELSE
  1246.         IF varChasmFlag = 1 THEN
  1247.             varCurrentLocation = 20
  1248.             CALL subPrintLocation(varCurrentLocation)
  1249.             GOTO lab378
  1250.         ELSE
  1251.             CALL subPrintText("You can't! It's too wide to jump.")
  1252.             GOTO lab378
  1253.         END IF
  1254.     END IF
  1255.  
  1256.     lab372:
  1257.     IF varCurrentLocation <> 20 THEN
  1258.         GOTO lab373
  1259.     ELSE
  1260.         IF varChasmFlag = 1 THEN
  1261.             varCurrentLocation = 18
  1262.             CALL subPrintLocation(varCurrentLocation)
  1263.             GOTO lab378
  1264.         ELSE
  1265.             CALL subPrintText("You can't! It's too wide to jump.")
  1266.             GOTO lab378
  1267.         END IF
  1268.     END IF
  1269.  
  1270.     lab373:
  1271.     IF ABS(varCurrentLocation - 42) <> 1 THEN
  1272.         GOTO lab374
  1273.     ELSE
  1274.         IF varBridgeFlag = 0 THEN
  1275.             CALL subPrintText("You can't! It's too wide to jump.")
  1276.             GOTO lab378
  1277.         ELSE
  1278.             IF varObjectLocations(26) = 1 THEN
  1279.                 varCurrentLocation = varCurrentLocation - 2 * SGN(varCurrentLocation - 42)
  1280.                 CALL subPrintLocation(varCurrentLocation)
  1281.                 GOTO lab378
  1282.             ELSE
  1283.                 CALL subPrintText("AAARGHH The bridge collapsed!")
  1284.                 CALL subKill
  1285.             END IF
  1286.         END IF
  1287.     END IF
  1288.  
  1289.     lab374:
  1290.     IF ABS(varCurrentLocation - 26.5) < 1 AND varObjectLocations(34) = 26 THEN 'Test the ABS thing and presence of troll.
  1291.         CALL subPrintText("The troll wont let you get by.")
  1292.         GOTO lab378
  1293.     END IF
  1294.  
  1295.     IF varCurrentLocation <> 27 AND varCurrentLocation <> 26 THEN 'are we next to troll bridge or at troll bridge
  1296.         GOTO lab376
  1297.     ELSE
  1298.         IF varRabbitFlag = 1 OR varBearFlag = 1 THEN 'If the rabbit or bear is with us then....
  1299.             CALL subPrintText("AAARGHH The bridge collapsed!")
  1300.             CALL subKill
  1301.         ELSE
  1302.             varCurrentLocation = 27 + (varCurrentLocation = 27) 'everything is good so move us to 27 if we're not at 27 already
  1303.             CALL subPrintLocation(varCurrentLocation)
  1304.             GOTO lab378
  1305.         END IF
  1306.     END IF
  1307.  
  1308.     lab376:
  1309.     IF varCurrentLocation = 15 AND varWord2Index = 55 AND varObjectLocations(48) = 1 THEN
  1310.         varCurrentLocation = 142
  1311.         CALL subPrintText("You set off in the boat. Suddenly a sea-serpent leaps from beneath the waves and swallows you!")
  1312.         CALL subPrintLocation(varCurrentLocation)
  1313.         varObjectLocations(48) = 0
  1314.         GOTO lab378
  1315.     ELSE
  1316.         IF varCurrentLocation = 15 AND varWord2Index = 55 THEN
  1317.             CALL subPrintText("It's too wide to swim.")
  1318.             GOTO lab378
  1319.         END IF
  1320.     END IF
  1321.  
  1322.     CALL subPrintText("I can't apply that")
  1323.     lab378:
  1324. END SUB
  1325.  
  1326. SUB subVerbThrow (varWord2Index) ' throw?
  1327.     CALL subVerbGetTake(varWord2Index, 1, varCurrentLocation)
  1328.     IF X = 1 THEN GOTO lab407
  1329.     R$ = " "
  1330.     IF varWord2Index > 1 THEN GOTO lab393
  1331.  
  1332.     IF varCurrentLocation = varObjectLocations(31) AND RND(1) < 0.6 THEN
  1333.         varObjectLocations(31) = 0 'Dwarf is dead, remove him.
  1334.         varDwarfEncounters = 0
  1335.         varDwarfFlag = 0
  1336.         CALL subPrintText("You killed a little dwarf!")
  1337.         GOTO lab407
  1338.     ELSE
  1339.         IF varCurrentLocation = varObjectLocations(31) THEN
  1340.             CALL subPrintText("The dwarf dodges neatly aside.")
  1341.             GOTO lab407
  1342.         END IF
  1343.     END IF
  1344.  
  1345.     IF varCurrentLocation = varObjectLocations(32) THEN
  1346.         CALL subPrintText("The ogre catches the axe and slices you in two with it.")
  1347.         CALL subKill
  1348.     END IF
  1349.  
  1350.     IF varCurrentLocation = varObjectLocations(30) THEN
  1351.         CALL subPrintText("The axe bounces harmlessly off the dragon.")
  1352.         GOTO lab407
  1353.     END IF
  1354.  
  1355.     IF varCurrentLocation = varObjectLocations(33) THEN
  1356.         CALL subPrintText("That made the goblins real mad!")
  1357.         GOTO lab407
  1358.     END IF
  1359.  
  1360.     IF varCurrentLocation = varObjectLocations(34) THEN
  1361.         CALL subPrintText("The troll ducks, picks up the fallen axe and kills you with a single blow.")
  1362.         CALL subKill
  1363.     END IF
  1364.  
  1365.     IF varCurrentLocation = varObjectLocations(35) THEN
  1366.         CALL subPrintText("The bear is confused. He only wants to be your friend!")
  1367.         GOTO lab407
  1368.     END IF
  1369.  
  1370.     IF varCurrentLocation = varObjectLocations(36) THEN
  1371.         CALL subPrintText("The pirate dodges smartly away into the tunnels!")
  1372.         varObjectLocations(36) = 20 + INT(RND(10))
  1373.         GOTO lab407
  1374.     END IF
  1375.  
  1376.     IF varCurrentLocation = varObjectLocations(37) THEN
  1377.         CALL subPrintText("The orc dodges and then growls ominously at you!")
  1378.         GOTO lab407
  1379.     END IF
  1380.  
  1381.     IF varCurrentLocation = varObjectLocations(38) THEN
  1382.         CALL subPrintText("The rabbit hops aside and says NEEERH WHATS UP DOC ?")
  1383.     END IF
  1384.  
  1385.     GOTO lab407
  1386.  
  1387.     lab393:
  1388.     IF varWord2Index > 2 THEN
  1389.         GOTO lab403
  1390.     END IF
  1391.  
  1392.     IF varCurrentLocation = varObjectLocations(31) THEN
  1393.         CALL subPrintText("You killed a little dwarf!")
  1394.         varDwarfEncounters = 0
  1395.         varObjectLocations(31) = 0
  1396.         GOTO lab407
  1397.     END IF
  1398.  
  1399.     IF varCurrentLocation = varObjectLocations(32) THEN
  1400.         CALL subPrintText("The sword kills the ogre but then melts away.")
  1401.         varObjectLocations(32) = 0
  1402.         varObjectLocations(2) = 0
  1403.         GOTO lab407
  1404.     END IF
  1405.  
  1406.     IF varCurrentLocation = varObjectLocations(30) THEN
  1407.         CALL subPrintText("The sword kills the dragon. Then both sword and dragon fade away until only the dragons teeth remain.")
  1408.         varObjectLocations(30) = 0
  1409.         varObjectLocations(2) = 0
  1410.         varObjectLocations(6) = varCurrentLocation
  1411.         GOTO lab407
  1412.     END IF
  1413.  
  1414.     IF varCurrentLocation = varObjectLocations(33) THEN
  1415.         CALL subPrintText("That made the goblins real mad!")
  1416.         GOTO lab407
  1417.     END IF
  1418.  
  1419.     IF varCurrentLocation = varObjectLocations(34) THEN
  1420.         CALL subPrintText("The troll catches the sword and kills you with a single stroke.")
  1421.         CALL subKill
  1422.     END IF
  1423.  
  1424.     IF varCurrentLocation = varObjectLocations(35) THEN
  1425.         CALL subPrintText("The bear is confused. He only wants to be your friend!")
  1426.         GOTO lab407
  1427.     END IF
  1428.  
  1429.     IF varCurrentLocation = varObjectLocations(36) THEN
  1430.         CALL subPrintText("The pirate dodges smartly away into the tunnels!")
  1431.         varObjectLocations(36) = 20 + INT(RND(10))
  1432.         GOTO lab407
  1433.     END IF
  1434.  
  1435.     IF varCurrentLocation = varObjectLocations(37) THEN
  1436.         CALL subPrintText("The orc dodges and then growls ominously at you!")
  1437.         GOTO lab407
  1438.     END IF
  1439.  
  1440.     IF varCurrentLocation = varObjectLocations(38) THEN
  1441.         CALL subPrintText("The rabbit hops aside and says NEEERH WHATS UP DOC ?")
  1442.         GOTO lab407
  1443.     END IF
  1444.  
  1445.     lab403:
  1446.     IF varWord2Index = 28 AND varCurrentLocation = 16 AND varFlamesFlag = 1 THEN
  1447.         varFlamesFlag = 0
  1448.         CALL subPrintText("The flame dies in a cloud of steam.")
  1449.     END IF
  1450.  
  1451.     IF varWord2Index = 6 AND varCurrentLocation = varObjectLocations(33) THEN
  1452.         CALL subPrintText("The teeth become skeleton warriors and drive the goblins away.")
  1453.         varObjectLocations(33) = 0
  1454.         varObjectLocations(6) = 0
  1455.     ELSE 'I think this logic can be separated out; it was like this to save a line?
  1456.         IF varCurrentLocation = varObjectLocations(41) AND varWord2Index = 47 THEN
  1457.             CALL subPrintText("The mouse eats the stilton and allows itself to be caught.")
  1458.             varObjectLocations(41) = 0
  1459.             varObjectLocations(47) = 0
  1460.         END IF
  1461.     END IF
  1462.  
  1463.     R$ = ""
  1464.  
  1465.     IF varCurrentLocation = 117 AND varWord2Index = 9 THEN
  1466.         CALL subPrintText("Suddenly a huge bird swoops down snatches the food and carries you across the swamp.")
  1467.         varCurrentLocation = 118
  1468.         varObjectLocations(9) = 0
  1469.         CALL subPrintLocation(varCurrentLocation)
  1470.     END IF
  1471.  
  1472.     IF varCurrentLocation = varObjectLocations(43) AND varWord2Index = 49 THEN
  1473.         CALL subPrintText("The stake pierces the vampires chest he screams and is dispersed on the wind.")
  1474.         varObjectLocations(43) = 0
  1475.         varObjectLocations(49) = 0
  1476.     END IF
  1477.  
  1478.     lab407:
  1479. END SUB
  1480.  
  1481. SUB subVerbFeed (varWord2Index) 'Feed
  1482.     IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
  1483.         CALL subPrintText("I see no " + varWord2$ + " here.")
  1484.         GOTO lab414
  1485.     ELSE
  1486.         IF varWord2Index = 28 THEN
  1487.             CALL subPrintText("I can't apply that")
  1488.             GOTO lab414
  1489.         END IF
  1490.     END IF
  1491.  
  1492.     IF varWord2Index = 30 OR varWord2Index = 32 OR varWord2Index = 33 OR varWord2Index = 37 THEN
  1493.         CALL subPrintText("The only thing it wants to eat is, possibly, YOU!")
  1494.         GOTO lab414
  1495.     ELSE
  1496.         IF varWord2Index <> 38 AND varWord2Index <> 35 AND varWord2Index <> 41 AND varWord2Index <> 52 THEN
  1497.             CALL subPrintText("You're joking")
  1498.             GOTO lab414
  1499.         END IF
  1500.     END IF
  1501.  
  1502.     IF varWord2Index = 41 AND varObjectLocations(9) = 1 THEN
  1503.         CALL subPrintText("You throw the food to the crocodile. Suddenly a huge bird swoops down snatches the food and carries you across the swamp.")
  1504.         varCurrentLocation = 118
  1505.         CALL subPrintLocation(varCurrentLocation)
  1506.         varObjectLocations(9) = 0
  1507.         GOTO lab414
  1508.     ELSE
  1509.         IF varWord2Index = 41 THEN
  1510.             CALL subPrintText("You have nothing it wants.")
  1511.             GOTO lab414
  1512.         END IF
  1513.     END IF
  1514.  
  1515.     IF varWord2Index = 52 AND varObjectLocations(50) = 1 THEN
  1516.         CALL subPrintText("The mouse eats the stilton and allows itself to be caught.")
  1517.         varObjectLocations(52) = 1
  1518.         varObjectLocations(50) = 0
  1519.         GOTO lab414
  1520.     ELSE
  1521.         IF varWord2Index = 52 THEN
  1522.             CALL subPrintText("You have nothing it wants.")
  1523.             GOTO lab414
  1524.         END IF
  1525.     END IF
  1526.  
  1527.     IF varWord2Index = 35 OR varWord2Index = 38 THEN
  1528.         CALL subPrintText("What with")
  1529.         K = varWord2Index
  1530.         O$ = varWord2$
  1531.         INPUT A$
  1532.         CALL subProcessNoun(funConvertLowerCase$(A$))
  1533.         IF varWord2Index <> 29 AND varWord2Index <> 9 THEN
  1534.             CALL subPrintText("You're joking!")
  1535.         ELSE
  1536.             CALL subEat
  1537.             varObjectLocations(varWord2Index) = 0
  1538.             varObjectLocations(K) = 0
  1539.             varCarryingCounter = varCarryingCounter - 2
  1540.             IF K = 35 THEN
  1541.                 varBearFlag = 0
  1542.             ELSE
  1543.                 IF K = 38 THEN
  1544.                     varRabbitFlag = 0
  1545.                 END IF
  1546.             END IF
  1547.         END IF
  1548.     END IF
  1549.     lab414:
  1550. END SUB
  1551.  
  1552. SUB subVerbRub (varWord2Index) 'Rub?
  1553.     IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
  1554.         CALL subPrintText("I see no " + varWord2$ + " here.")
  1555.         GOTO lab420
  1556.     ELSE
  1557.         IF varWord2Index = 28 THEN
  1558.             CALL subPrintText("I can't apply that")
  1559.             GOTO lab420
  1560.         END IF
  1561.     END IF
  1562.  
  1563.     IF varWord2Index = 3 AND varLampLitFlag = 1 AND varLampFuel <= 10 THEN
  1564.         varLampFuel = 150
  1565.         CALL subPrintText("Your lamp is brighter now.")
  1566.         GOTO lab420
  1567.     ELSE
  1568.         IF varWord2Index = 3 AND varLampFuel <= 0 THEN
  1569.             varLampFuel = 150
  1570.             CALL subPrintText("Nothing obvious happens!")
  1571.             GOTO lab420
  1572.         ELSE
  1573.             IF varWord2Index = 3 AND varLampFuel > 0 THEN
  1574.                 CALL subPrintText("Nothing obvious happens!")
  1575.                 GOTO lab420
  1576.             END IF
  1577.         END IF
  1578.     END IF
  1579.  
  1580.     IF varWord2Index = 26 THEN
  1581.         varCurrentLocation = 11
  1582.         CALL subPrintLocation(varCurrentLocation)
  1583.         GOTO lab420
  1584.     END IF
  1585.  
  1586.     CALL subPrintText("You're joking!")
  1587.     lab420:
  1588. END SUB
  1589.  
  1590. SUB subVerbLight (varWord2Index) 'Light verb
  1591.     IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
  1592.         CALL subPrintText("I see no " + varWord2$ + " here.")
  1593.         GOTO labExitVerbLight
  1594.     ELSE
  1595.         IF varWord2Index = 28 THEN
  1596.             CALL subPrintText("I can't apply that")
  1597.             GOTO labExitVerbLight
  1598.         END IF
  1599.     END IF
  1600.  
  1601.     IF varWord2Index = 51 THEN
  1602.         varObjectLocations(51) = 0
  1603.         CALL subPrintText("Your matches flare up making a lot of smoke.")
  1604.         IF varCurrentLocation = 142 THEN
  1605.             CALL subPrintText("The serpent starts to cough violently and you get thrown out.")
  1606.             varCurrentLocation = 136
  1607.             CALL subPrintLocation(varCurrentLocation)
  1608.             GOTO labExitVerbLight
  1609.         ELSE
  1610.             IF varWord2Index = 51 THEN
  1611.                 GOTO labExitVerbLight
  1612.             END IF
  1613.         END IF
  1614.     END IF
  1615.  
  1616.     IF varWord2Index = 3 AND varLampLitFlag = 0 AND varLampFuel > 0 THEN
  1617.         varLampLitFlag = 1
  1618.         CALL subPrintText("Your lamp is now on.")
  1619.         GOTO labExitVerbLight
  1620.     ELSE
  1621.         IF varWord2Index = 3 AND varLampLitFlag = 0 THEN
  1622.             CALL subPrintText(" Your lamp has run out.")
  1623.             GOTO labExitVerbLight
  1624.         ELSE
  1625.             IF varWord2Index = 3 THEN
  1626.                 CALL subPrintText("Your lamp is already lit!")
  1627.                 GOTO labExitVerbLight
  1628.             END IF
  1629.         END IF
  1630.     END IF
  1631.     CALL subPrintText("I can't apply that")
  1632.     labExitVerbLight:
  1633. END SUB
  1634.  
  1635. SUB subVerbRead (varWord2Index) 'read
  1636.     IF varWord2Index = 28 THEN
  1637.         CALL subPrintText("I can't apply that")
  1638.         GOTO labExitVerbRead
  1639.     END IF
  1640.  
  1641.     IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 THEN
  1642.         CALL subPrintText("I see no " + varWord2$ + " here")
  1643.         GOTO labExitVerbRead
  1644.     END IF
  1645.  
  1646.     IF varWord2Index = 21 THEN
  1647.         CALL subPrintText("The books tell of a land across the water.")
  1648.     ELSE
  1649.         CALL subPrintText("I can't apply that")
  1650.     END IF
  1651.  
  1652.     labExitVerbRead:
  1653. END SUB
  1654.  
  1655. SUB subVerbPay (varWord2Index)
  1656.     IF varWord2Index = 28 THEN
  1657.         CALL subPrintText("I can't apply that")
  1658.         GOTO labExitVerbPay
  1659.     END IF
  1660.  
  1661.     I = 11
  1662.     IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 THEN
  1663.         CALL subPrintText("I see no " + varWord2$ + " here.")
  1664.         GOTO labExitVerbPay
  1665.     END IF
  1666.  
  1667.     IF varWord2Index = 34 THEN
  1668.         WHILE I <> 26 AND varObjectLocations(I) <> 1
  1669.             I = I + 1
  1670.         WEND
  1671.         IF I < 26 THEN
  1672.             varObjectLocations(I) = 51
  1673.             CALL subGetObjName(I)
  1674.             CALL subSnatch
  1675.             varObjectLocations(34) = 0
  1676.             varCarryingCounter = varCarryingCounter - 1
  1677.         ELSE
  1678.             CALL subPrintText("You fell in a pit.")
  1679.         END IF
  1680.     END IF
  1681.  
  1682.     labExitVerbPay:
  1683. END SUB
  1684.  
  1685. SUB subVerbIn (n) 'In
  1686.     IF n = 2 THEN
  1687.         varCurrentLocation = 3
  1688.         CALL subPrintLocation(varCurrentLocation)
  1689.     ELSE
  1690.         IF n = 8 THEN
  1691.             varCurrentLocation = 9
  1692.             CALL subPrintLocation(varCurrentLocation)
  1693.         ELSE
  1694.             CALL subPrintText("I can't apply that")
  1695.         END IF
  1696.     END IF
  1697.  
  1698. END SUB
  1699.  
  1700. SUB subVerbOut (n) 'out or exit
  1701.     'n is current loc
  1702.     IF n = 3 THEN '
  1703.         varCurrentLocation = 2
  1704.         CALL subPrintLocation(varCurrentLocation)
  1705.     ELSE
  1706.         IF n = 9 THEN
  1707.             varCurrentLocation = 8
  1708.             CALL subPrintLocation(varCurrentLocation)
  1709.         ELSE
  1710.             CALL subPrintText("I can't apply that")
  1711.         END IF
  1712.     END IF
  1713. END SUB
  1714.  
  1715. SUB subCalculateScore (varCurrentLocation)
  1716.     'calculate and print score
  1717.     varScore = 0
  1718.     'iterate through these objects. If we have them in inventory (1) or are they at Sphinx (50) then add 30 points
  1719.     FOR j = 11 TO 29
  1720.         IF varObjectLocations(j) = 1 OR varObjectLocations(j) = 50 THEN varScore = varScore + 30
  1721.     NEXT j
  1722.     FOR j = 45 TO 48
  1723.         IF varObjectLocations(j) = 1 OR varObjectLocations(j) = 50 THEN varScore = varScore + 30
  1724.     NEXT j
  1725.  
  1726.     IF varWavingAtSphinxFlag = 1 THEN ' varWavingAtSphinxFlag is set if we're kneeling and wand waving
  1727.         IF varCurrentLocation = 50 THEN ' are we at the sphinx ?
  1728.             varScore = varScore + 170
  1729.         END IF
  1730.     END IF
  1731.  
  1732.     IF varScore + varKilledFlag < 0 THEN
  1733.         CALL subPrintText("You have scored 0 out of a possible 800.")
  1734.     ELSE
  1735.         CALL subPrintText("You have scored " + STR$(varScore + varKilledFlag) + " out of 800.")
  1736.     END IF
  1737. END SUB
  1738.  
  1739. FUNCTION funTrimSpaces$ (z$)
  1740.     'seems to just trim off leading spaces. QB seems not to like ASC(x) so jiggled a bit.
  1741.     lab453: 'Surely we can do some loopery here
  1742.     IF LEFT$(z$, 1) = " " THEN
  1743.         z$ = RIGHT$(z$, LEN(z$) - 1)
  1744.         GOTO lab453
  1745.     END IF
  1746.  
  1747.     lab454: 'surely we can do some loopery here
  1748.     IF RIGHT$(z$, 1) = " " THEN
  1749.         z$ = LEFT$(z$, LEN(z$) - 1)
  1750.         GOTO lab454
  1751.     END IF
  1752.     funTrimSpaces$ = z$
  1753. END FUNCTION
  1754.  
  1755. FUNCTION funConvertLowerCase$ (z$)
  1756.     'Just converts to lower case, puts entire z$ into lower case into B$ and passes to funTrimSpaces$
  1757.     b$ = ""
  1758.     FOR j = 1 TO LEN(z$)
  1759.         Q = ASC(MID$(z$, j, 1))
  1760.         IF Q > 64 AND Q < 91 THEN
  1761.             Q = Q + 32
  1762.         END IF
  1763.         b$ = b$ + CHR$(Q)
  1764.     NEXT j
  1765.     funConvertLowerCase$ = (funTrimSpaces$(b$))
  1766. END FUNCTION
  1767.  
  1768. SUB subVerbFill (w) 'F=Fill?
  1769.     IF w = 28 THEN 'is the verb water?
  1770.         CALL subPrintText("I can't apply that")
  1771.         GOTO labExitVerbFill
  1772.     END IF
  1773.  
  1774.     IF varObjectLocations(w) <> varCurrentLocation AND varObjectLocations(w) <> 1 THEN
  1775.         CALL subPrintText("I see no " + varWord2$ + " here.")
  1776.         GOTO labExitVerbFill
  1777.     ELSE
  1778.         IF varObjectLocations(varWord2Index) <> 1 THEN
  1779.             CALL subPrintText("You're not carrying the " + varWord2$ + ".")
  1780.             GOTO labExitVerbFill
  1781.         END IF
  1782.     END IF
  1783.  
  1784.     IF w = 27 AND varCurrentLocation = varObjectLocations(28) AND varGotWaterFlag = 0 THEN
  1785.         CALL subPrintText("Your bottle is now full of water.")
  1786.         varGotWaterFlag = 1
  1787.     ELSE
  1788.         IF w = 27 AND varCurrentLocation = varObjectLocations(28) THEN
  1789.             CALL subPrintText("your bottle is already full.")
  1790.         ELSE
  1791.             CALL subPrintText("I can't apply that")
  1792.         END IF
  1793.     END IF
  1794.     labExitVerbFill:
  1795. END SUB
  1796.  
  1797. SUB subObjectText (w, n, varCurrentLocation)
  1798.     'process OT for w=object number, n=count left to deal with
  1799.     'OT seems to print out the description of the object given the objects presence eg "a set of keys" when the object is just 'keys'
  1800.     R$ = ""
  1801.     K = 0
  1802.  
  1803.     IF n = 1 AND varMAX <> 1 THEN
  1804.         R$ = R$ + " and "
  1805.     END IF
  1806.  
  1807.     IF w = 5 THEN 'keys
  1808.         R$ = R$ + "a set of keys,"
  1809.         GOTO lab478
  1810.     END IF
  1811.  
  1812.     IF w = 6 THEN 'teeth
  1813.         R$ = R$ + "a set of dragon's teeth,"
  1814.         GOTO lab478
  1815.     END IF
  1816.  
  1817.     IF w = 26 THEN 'ring
  1818.         R$ = R$ + "a mithril "
  1819.         GOTO lab477
  1820.     END IF
  1821.  
  1822.     IF w = 1 OR w = 42 OR w = 17 OR w = 46 THEN 'axe, elephant, emerald, amethyst
  1823.         R$ = R$ + "an "
  1824.         GOTO lab477
  1825.     END IF
  1826.  
  1827.     IF w = 50 THEN 'stilton
  1828.         R$ = R$ + "a piece of stilton,"
  1829.         GOTO lab478
  1830.     END IF
  1831.  
  1832.     IF w = 9 THEN 'food
  1833.         GOTO lab477
  1834.     END IF
  1835.  
  1836.     IF w = 7 THEN 'jack
  1837.         R$ = R$ + "a hydraulic "
  1838.         GOTO lab477
  1839.     END IF
  1840.  
  1841.     IF w = 48 OR w = 49 THEN 'boat, stake
  1842.         R$ = R$ + "a wooden "
  1843.         GOTO lab477
  1844.     END IF
  1845.  
  1846.     IF w = 11 OR w = 20 THEN 'sapphires, opals
  1847.         R$ = R$ + "a cluster of "
  1848.         GOTO lab477
  1849.     END IF
  1850.  
  1851.     IF w = 16 OR w = 18 THEN 'rubies, pearls
  1852.         R$ = R$ + "a small fortune in "
  1853.         GOTO lab477
  1854.     END IF
  1855.  
  1856.     IF w = 51 THEN 'matches
  1857.         R$ = R$ + "a box of "
  1858.         GOTO lab477
  1859.     END IF
  1860.  
  1861.     IF w = 33 THEN 'goblins
  1862.         R$ = R$ + "a gang of "
  1863.         GOTO lab477
  1864.     END IF
  1865.  
  1866.     IF w = 22 THEN 'spices
  1867.         R$ = R$ + "a small jar of "
  1868.         GOTO lab477
  1869.     END IF
  1870.  
  1871.     IF w = 21 THEN 'books
  1872.         R$ = R$ + "a collection of library "
  1873.         GOTO lab477
  1874.     END IF
  1875.  
  1876.     IF w = 19 THEN 'coins
  1877.         R$ = R$ + "a set of "
  1878.         GOTO lab477
  1879.     END IF
  1880.  
  1881.     IF w = 43 THEN 'vampire
  1882.         R$ = R$ + "an evil "
  1883.         GOTO lab477
  1884.     END IF
  1885.  
  1886.     IF w = 36 THEN 'pirate
  1887.         R$ = R$ + "a bearded "
  1888.         GOTO lab477
  1889.     END IF
  1890.  
  1891.     IF ABS(w - 14) < 2 THEN 'gold, silver, maybe platinum
  1892.         R$ = R$ + "a bar of "
  1893.         GOTO lab477
  1894.     END IF
  1895.  
  1896.     IF w = 44 THEN 'serpent
  1897.         R$ = R$ + "a bad smell,"
  1898.         GOTO lab478
  1899.     END IF
  1900.  
  1901.     IF w = 32 OR w = 37 OR w = 41 THEN 'ogre, orc, crocodile
  1902.         R$ = R$ + "a mean looking "
  1903.         GOTO lab477
  1904.     END IF
  1905.  
  1906.     IF w = 30 OR w = 42 THEN 'dragon, elephant
  1907.         R$ = R$ + "a large "
  1908.         GOTO lab477
  1909.     END IF
  1910.  
  1911.     IF w = 35 OR w = 38 THEN 'bear, rabbit
  1912.         R$ = R$ + "a friendly "
  1913.         GOTO lab477
  1914.     END IF
  1915.  
  1916.     IF w <> 27 THEN 'if anything other than the bottle then lab475
  1917.         GOTO lab475
  1918.     ELSE 'so we have the bottle
  1919.         IF varGotWaterFlag = 0 THEN 'does it have water.. no
  1920.             R$ = R$ + "a bottle,"
  1921.             GOTO lab478
  1922.         ELSE
  1923.             R$ = R$ + "a bottle of water," 'must have water then
  1924.             GOTO lab478
  1925.         END IF
  1926.     END IF
  1927.  
  1928.     lab475:
  1929.     IF w = 28 AND varGotWaterFlag = 1 AND LEFT$(A$, 3) = "inv" THEN 'varWord2Index8= water
  1930.         GOTO lab478
  1931.     ELSE
  1932.         IF w = 28 THEN
  1933.             GOTO lab477
  1934.         END IF
  1935.     END IF
  1936.  
  1937.  
  1938.     R$ = R$ + "a "
  1939.  
  1940.     lab477:
  1941.     O$ = R$
  1942.     CALL subGetObjName(w)
  1943.     R$ = O$ + R$ + ", "
  1944.     IF INSTR(R$, " ") = 0 THEN
  1945.         R$ = " " + R$
  1946.         K = 1
  1947.     END IF
  1948.  
  1949.     lab478:
  1950.  
  1951.     IF n <= 2 THEN
  1952.         R$ = LEFT$(R$, LEN(R$) - 1)
  1953.     END IF
  1954.  
  1955.     IF varCurrentLocation <> 1 AND n = 1 THEN
  1956.         R$ = R$ + " here"
  1957.     END IF
  1958.  
  1959.     IF n = 1 THEN
  1960.         R$ = R$ + "."
  1961.     END IF
  1962.  
  1963.     'If Pos(0) + Len(R$) > (varScreenWidth - 2) Then
  1964.     '    R$ = funScreenPrint$(R$, (varScreenWidth - 1))
  1965.     'End If
  1966.  
  1967.     IF K = 1 AND R$ = " " THEN
  1968.         R$ = RIGHT$(R$, LEN(R$) - 1)
  1969.     END IF
  1970.  
  1971.     cn = 0
  1972.     '    Call subPrintText(R$)
  1973. END SUB
  1974.  
  1975. SUB subPrintText (varScrText$)
  1976.     Color colCyan 'so we can see what is being run through this sub
  1977.     DIM a%, z%, varStringLength
  1978.  
  1979.     varStringLength = LEN(varScrText$)
  1980.     a% = 1
  1981.     z% = varScreenWidth + 1 - POS(0)
  1982.     DO
  1983.         IF z% > varStringLength + 1 THEN
  1984.             z% = varStringLength + 1
  1985.         ELSE
  1986.             DO
  1987.                 z% = z% - 1
  1988.             LOOP UNTIL MID$(varScrText$, z%, 1) = " "
  1989.         END IF
  1990.  
  1991.         IF z% < a% THEN
  1992.             z% = a% + varScreenWidth + 1
  1993.         END IF
  1994.  
  1995.         PRINT MID$(varScrText$, a%, z% - a%);
  1996.  
  1997.         IF z% - a% < varScreenWidth THEN
  1998.             PRINT
  1999.         ELSE
  2000.             IF MID$(varScrText$, z%, 1) = " " THEN
  2001.                 a% = a% + 1
  2002.             ELSE
  2003.                 z% = z% + 1
  2004.             END IF
  2005.         END IF
  2006.  
  2007.         a% = z% + 1
  2008.         z% = a% + varScreenWidth + 1
  2009.     LOOP UNTIL a% > varStringLength
  2010.  
  2011.     IF POS(0) > 0 THEN
  2012.         PRINT
  2013.         GOTO labExit
  2014.     ELSE
  2015.         GOTO labExit
  2016.     END IF
  2017.  
  2018.     labExit:
  2019.     Color colGreen 'put the colour back
  2020. END SUB
  2021.  
  2022. SUB subFinish
  2023.     CALL subPrintText("Well done, you've solved the puzzle.")
  2024.     CALL subCalculateScore(varCurrentLocation)
  2025.     CALL subPrintText("You had  " + STR$(varTurnCount) + " turns.")
  2026.     END
  2027. END SUB
  2028.  
  2029. SUB subEat
  2030.     CALL subPrintText("The " + O$ + " eats the " + varWord2$ + " and runs away.")
  2031. END SUB
  2032.  
  2033. SUB subSnatch
  2034.     CALL subPrintText("The troll snatches your " + R$ + " and runs away.")
  2035. END SUB
  2036.  
  2037. SUB subSave (filename$)
  2038.     DIM cnt AS INTEGER
  2039.     filename$ = filename$ + ".sav"
  2040.     OPEN filename$ FOR OUTPUT AS #1
  2041.     'Print #1, varBearFlag, varChasmFlag, varCasketOpenFlag, varCarryingCounter, cn, varDwarfEncounters, varFlamesFlag, varGoblinEncounters, I, j, K
  2042.     'Print #1, varKilledFlag, varCurrentLocation, varLampFuel, I, varWavingAtSphinxFlag, M, varMAX, N, Q, varRabbitFlag, varTurnLastSeenDwarf, varSafeOpenFlag
  2043.     'Print #1, varScore, varSpacePos, varTurnCount, varBridgeFlag, varVampireEncounters, varGotWaterFlag, W, X, si, mi,  varLampLitFlag, varDwarfFlag, varDwarfChance
  2044.     'Print #1, varSuppressDwarf
  2045.  
  2046.     PRINT #1, varBearFlag, varChasmFlag, varCasketOpenFlag, varCarryingCounter, varDwarfEncounters, varFlamesFlag, varGoblinEncounters
  2047.     PRINT #1, varKilledFlag, varCurrentLocation, varLampFuel, varWavingAtSphinxFlag, varRabbitFlag, varTurnLastSeenDwarf, varSafeOpenFlag
  2048.     PRINT #1, varScore, varTurnCount, varBridgeFlag, varVampireEncounters, varGotWaterFlag, varLampLitFlag, varDwarfFlag, varDwarfChance
  2049.     PRINT #1, varSuppressDwarf
  2050.  
  2051.     FOR cnt = 1 TO 56
  2052.         PRINT #1, varObjectLocations(cnt)
  2053.     NEXT
  2054.     CLOSE #1
  2055.     CALL subPrintText("Game state saved")
  2056. END SUB
  2057.  
  2058. SUB subLoad (filename$)
  2059.     DIM cnt AS INTEGER
  2060.     filename$ = filename$ + ".sav"
  2061.     OPEN filename$ FOR INPUT AS #1
  2062.     'Input #1, varBearFlag, varChasmFlag, varCasketOpenFlag, varCarryingCounter, varCounter, cn, varDwarfEncounters, varFlamesFlag, varGoblinEncounters, I, j, K
  2063.     'Input #1, varKilledFlag, varCurrentLocation, varLampFuel, I, varWavingAtSphinxFlag, M, varMAX, N, Q, varRabbitFlag, varTurnLastSeenDwarf, varSafeOpenFlag
  2064.     'Input #1, varScore, SP, varTurnCount, varBridgeFlag, varVampireEncounters, varGotWaterFlag, W, X, si, mi, D%, varLampLitFlag, varDwarfFlag, varDwarfChance
  2065.     'Input #1, varSuppressDwarf
  2066.  
  2067.     INPUT #1, varBearFlag, varChasmFlag, varCasketOpenFlag, varCarryingCounter, varDwarfEncounters, varFlamesFlag, varGoblinEncounters
  2068.     INPUT #1, varKilledFlag, varCurrentLocation, varLampFuel, varWavingAtSphinxFlag, varRabbitFlag, varTurnLastSeenDwarf, varSafeOpenFlag
  2069.     INPUT #1, varScore, varTurnCount, varBridgeFlag, varVampireEncounters, varGotWaterFlag, varLampLitFlag, varDwarfFlag, varDwarfChance
  2070.     INPUT #1, varSuppressDwarf
  2071.  
  2072.  
  2073.     FOR cnt = 1 TO 56
  2074.         INPUT #1, varObjectLocations(cnt)
  2075.     NEXT
  2076.     CLOSE #1
  2077.     CALL subPrintText("Game state loaded")
  2078.     PRINT
  2079.     CALL subPrintLocation(varCurrentLocation)
  2080. END SUB
  2081.  
  2082. SUB subDebug
  2083.     'Prints out the state of play
  2084.     IF varDwarfChance = 0.97 THEN
  2085.         varDwarfStatus$ = "ENABLED"
  2086.     ELSE
  2087.         varDwarfStatus$ = "DISABLED"
  2088.     END IF
  2089.  
  2090.     Color colRed
  2091.     PRINT
  2092.     PRINT "Environment"
  2093.     Color colGreen
  2094.     PRINT "Location # :"; varCurrentLocation
  2095.     PRINT "Dwarf Status: "; varDwarfStatus$
  2096.     PRINT
  2097.     Color colRed
  2098.     PRINT "Counters"
  2099.     Color colGreen
  2100.     PRINT "Turn: "; varTurnCount; "Items :"; varCarryingCounter; " Lamp Fuel="; varLampFuel; "DwarfEncounters: "; varDwarfEncounters
  2101.  
  2102.     PRINT "DwarfSeenIncr: "; varTurnLastSeenDwarf
  2103.     PRINT
  2104.     Color colRed
  2105.     PRINT "Flags"
  2106.     Color colGreen
  2107.     PRINT "Bear: "; varBearFlag; " Rabbit: "; varRabbitFlag; " Dwarf: "; varDwarfFlag; " Lamp Lit: "; varLampLitFlag
  2108.     PRINT "Water: "; varGotWaterFlag; " Flames: "; varFlamesFlag; " Casket: "; varCasketOpenFlag; " Chasm: "; varChasmFlag
  2109.     PRINT "DwarfSuppress: "; varSuppressDwarf; "Safe: "; varSafeOpenFlag
  2110.     PRINT
  2111.     Color colRed
  2112.     PRINT "Exit Array"
  2113.     Color colCyan
  2114.     PRINT " N  S  E  W  U  D"
  2115.     Color colCyan + 8
  2116.     FOR i% = 1 TO 6
  2117.         PRINT varExitArray(i%);
  2118.     NEXT i%
  2119.     Color colRed
  2120.     PRINT
  2121.     PRINT "Objects array :"
  2122.     FOR i% = 1 TO 56
  2123.         Color colCyan + 8
  2124.         PRINT i%; ":";
  2125.         Color colCyan
  2126.         PRINT varObjectLocations(i%); " ";
  2127.     NEXT
  2128.     Color 2
  2129.     PRINT
  2130. END SUB
  2131.  
  2132.  
  2133.  
  2134. SUB subReadExits
  2135.     labExitData: 'Keeping labExitData here for now since two SUBs use it and QB64 seems to keep DATA local to the sub.  Nor does QB64 allow for it at end.
  2136.     '1
  2137.     DATA 0,0,0,0,0,0
  2138.     DATA 4,5,4,4,0,0
  2139.     DATA 0,0,0,0,0,0
  2140.     DATA 4,4,4,4,0,0
  2141.     DATA 2,6,7,4,0,0
  2142.     DATA 5,4,4,4,0,0
  2143.     DATA 4,4,8,5,0,0
  2144.     DATA 4,4,4,7,0,9
  2145.     DATA 0,14,10,0,8,0
  2146.     DATA 15,11,16,9,0,0
  2147.     '11
  2148.     DATA 10,0,12,0,0,0
  2149.     DATA 0,13,14,11,0,0
  2150.     DATA 12,0,0,0,0,17
  2151.     DATA 9,0,0,12,0,0
  2152.     DATA 0,10,17,0,0,0
  2153.     DATA 0,17,18,10,0,0
  2154.     DATA 16,0,0,15,13,0
  2155.     DATA 19,0,0,16,0,0
  2156.     DATA 0,18,0,0,0,0
  2157.     DATA 21,0,22,0,0,0
  2158.     '21
  2159.     DATA 0,20,23,0,0,0
  2160.     DATA 0,25,0,20,24,0
  2161.     DATA 120,0,24,21,0,0
  2162.     DATA 0,0,0,23,51,22
  2163.     DATA 22,26,0,0,0,0
  2164.     DATA 25,0,0,0,0,0
  2165.     DATA 0,0,30,28,0,0
  2166.     DATA 0,29,27,0,0,143
  2167.     DATA 28,39,0,0,0,0
  2168.     DATA 31,0,0,27,33,0
  2169.     '31
  2170.     DATA 0,30,32,0,0,0
  2171.     DATA 40,0,0,31,0,0
  2172.     DATA 0,34,35,0,0,30
  2173.     DATA 33,0,0,73,0,0
  2174.     DATA 0,36,0,33,0,0
  2175.     DATA 35,0,0,0,0,37
  2176.     DATA 0,0,0,38,36,0
  2177.     DATA 0,0,37,0,0,0
  2178.     DATA 29,72,0,0,0,0
  2179.     DATA 0,32,0,0,42,41
  2180.     '41
  2181.     DATA 0,0,0,0,40,0
  2182.     DATA 0,0,0,0,0,40
  2183.     DATA 44,0,0,46,47,0
  2184.     DATA 45,43,47,46,0,0
  2185.     DATA 0,44,111,0,46,47
  2186.     DATA 45,43,44,48,46,47
  2187.     DATA 45,43,44,0,0,0
  2188.     DATA 0,0,46,49,0,101
  2189.     DATA 52,0,48,0,0,0
  2190.     DATA 0,71,0,0,0,0
  2191.     '51
  2192.     DATA 0,0,0,0,0,24
  2193.     DATA 0,0,53,49,0,0
  2194.     DATA 54,52,52,52,0,0
  2195.     DATA 53,55,53,53,0,0
  2196.     DATA 54,54,56,54,0,0
  2197.     DATA 55,55,55,57,0,0
  2198.     DATA 56,56,58,56,0,0
  2199.     DATA 57,59,57,57,0,0
  2200.     DATA 60,58,58,58,0,0
  2201.     DATA 59,61,59,59,0,0
  2202.     '61
  2203.     DATA 60,60,62,60,0,0
  2204.     DATA 61,61,61,63,0,0
  2205.     DATA 62,62,64,62,0,0
  2206.     DATA 63,65,63,63,0,0
  2207.     DATA 66,64,64,64,0,0
  2208.     DATA 65,67,65,65,0,0
  2209.     DATA 52,66,68,66,0,0
  2210.     DATA 67,67,67,69,0,0
  2211.     DATA 68,68,70,68,0,0
  2212.     DATA 69,71,69,69,0,0
  2213.     '71
  2214.     DATA 50,70,70,70,0,0
  2215.     DATA 73,39,0,74,0,81
  2216.     DATA 81,0,86,72,74,0
  2217.     DATA 0,72,73,75,0,79
  2218.     DATA 74,0,76,0,76,77
  2219.     DATA 75,77,0,0,78,75
  2220.     DATA 78,79,0,0,75,76
  2221.     DATA 76,0,79,77,0,82
  2222.     DATA 0,74,78,77,80,0
  2223.     DATA 0,81,82,86,79,0
  2224.     '81
  2225.     DATA 72,0,73,80,0,82
  2226.     DATA 80,78,0,0,81,83
  2227.     DATA 84,87,0,0,85,82
  2228.     DATA 87,0,85,83,0,88
  2229.     DATA 0,87,84,83,86,0
  2230.     DATA 73,0,80,87,0,85
  2231.     DATA 83,84,0,0,85,86
  2232.     DATA 84,0,89,90,0,91
  2233.     DATA 90,0,90,88,0,91
  2234.     DATA 89,89,0,0,88,91
  2235.     '91
  2236.     DATA 88,89,0,0,92,90
  2237.     DATA 0,91,0,93,0,0
  2238.     DATA 0,0,92,0,94,0
  2239.     DATA 98,99,97,0,95,93
  2240.     DATA 0,100,0,0,0,94
  2241.     DATA 0,0,0,0,100,0
  2242.     DATA 0,0,100,94,0,0
  2243.     DATA 0,94,0,100,0,0
  2244.     DATA 94,0,0,0,0,100
  2245.     DATA 95,0,98,97,99,96
  2246.     '101
  2247.     DATA 102,0,103,0,48,0
  2248.     DATA 0,101,0,108,0,107
  2249.     DATA 0,105,0,101,0,109
  2250.     DATA 0,106,107,0,110,0
  2251.     DATA 103,0,0,0,0,106
  2252.     DATA 104,0,0,0,105,0
  2253.     DATA 0,0,0,104,102,0
  2254.     DATA 0,0,0,102,0,0
  2255.     DATA 0,0,0,0,103,0
  2256.     DATA 0,0,104,0,0,0
  2257.     '111
  2258.     DATA 112,0,0,45,0,0
  2259.     DATA 0,111,0,0,113,0
  2260.     DATA 0,0,114,0,0,112
  2261.     DATA 119,0,0,113,0,0
  2262.     DATA 0,116,0,120,0,0
  2263.     DATA 115,117,0,0,0,0
  2264.     DATA 116,0,118,0,0,0
  2265.     DATA 0,0,121,117,0,0
  2266.     DATA 0,114,0,0,0,0
  2267.     DATA 0,23,115,0,0,0
  2268.     '121
  2269.     DATA 0,123,122,118,0,0
  2270.     DATA 0,0,131,121,124,0
  2271.     DATA 121,127,0,132,0,0
  2272.     DATA 0,126,0,128,0,122
  2273.     DATA 126,0,133,134,0,0
  2274.     DATA 124,125,0,0,0,0
  2275.     DATA 123,0,0,0,135,0
  2276.     DATA 0,0,124,129,0,0
  2277.     DATA 0,0,128,0,0,130
  2278.     DATA 0,0,0,0,129,0
  2279.     '131
  2280.     DATA 0,0,0,122,0,0
  2281.     DATA 0,0,123,0,0,0
  2282.     DATA 0,0,0,125,0,0
  2283.     DATA 0,0,125,0,0,0
  2284.     DATA 0,0,0,0,0,127
  2285.     DATA 0,0,0,0,0,137
  2286.     DATA 0,0,0,0,136,0
  2287.     DATA 0,0,139,0,0,0
  2288.     DATA 0,140,0,138,0,0
  2289.     DATA 139,0,141,0,0,0
  2290.     '141
  2291.     DATA 0,0,0,140,0,0
  2292.     DATA 0,0,0,0,0,0
  2293.     DATA 0,0,0,0,0,0
  2294.  
  2295.     RESTORE labExitData
  2296.     FOR varCO = 1 TO (143 * 6)
  2297.         READ varExits(varCO)
  2298.     NEXT varCO
  2299. END SUB
  2300.  
  2301. SUB subReadObjectLocations
  2302.     labObjectLocations:
  2303.     'Read in the objects into the array. Rearranged into 10's
  2304.     'Seems to be a discrepancy here - loop to 55, yet there's 56 here.
  2305.     'Perhaps because the building (obj56) plays no pickyupy role
  2306.     DATA 0,13,3,11,3,0,143,49,17,40
  2307.     DATA 39,38,134,19,51,0,42,0,131,132
  2308.     DATA 22,34,49,31,20,0,5,15,14,36
  2309.     DATA 0,30,48,26,29,10,32,21,24,94
  2310.     DATA 117,111,0,142,110,95,138,92,126,108
  2311.     DATA 119,96,0,117,15,3
  2312.     RESTORE labObjectLocations
  2313.     FOR j = 1 TO 55
  2314.         READ varObjectLocations(j)
  2315.     NEXT j
  2316. END SUB
  2317.  
  2318. SUB subPrintHelp
  2319.     PRINT "I can't, you're on your own."
  2320.     PRINT
  2321.     PRINT "To move use directions such as N,S or E. I can understand simple instructions."
  2322.     PRINT "These statements should be in the form  <verb> <noun> separated by a space."
  2323.     PRINT
  2324.     PRINT "If you get stuck try something completely different."
  2325.     PRINT
  2326.     PRINT "By the way magic is quite useful!"
  2327.  
  2328. END SUB
  2329.  
  2330. SUB subReadLocationDescriptions
  2331.     labdatalocs:
  2332.     DATA Dummyloc 'This is because the original code data started at line 2 and was RESTORED to by proc call.
  2333.     DATA "at the end of a road, outside a building. All around is forest."
  2334.     DATA "in the building, obviously an old blacksmith's forge."
  2335.     DATA in the forest.
  2336.     DATA "on the road, a small raised path leads east, the road runs north-south."
  2337.     DATA ON the top of a mountain. In the distance a small building can be seen. All around you IS dense forest. A road leads north.
  2338.     DATA ON a narrow path which seems TO descend TO the east.
  2339.     DATA in the valley of doom. The path disappears down a small shaft here. Strange echoes can be heard from below.
  2340.     DATA in the hall of spirits. Ghostly laughs AND howls can be heard echoing around the walls. The air IS full of dust AND cobwebs.
  2341.     DATA at a cross-roads in the tunnels. A chill wind blows from the north.
  2342.     DATA in the Sorcerers lair. The walls resound with the SOUND of LONG forgotten spells.
  2343.     DATA at a T-junction.
  2344.     DATA "in the sword chamber, a large stone sits in the middle of the floor."
  2345.     DATA in the gardeners store.
  2346.     DATA by a lake which stretches far away TO the horizon. The far side can only be dimly seen.
  2347.     DATA in the fiery passage.
  2348.     DATA in the banqueting hall.
  2349.     DATA "at the edge of a deep crack, it is too wide to jump."
  2350.     DATA in the smelting room. A large furnace sits in the corner.
  2351.     DATA "in the oriental room, beside the chasm. The walls are decorated with chinese paintings."
  2352.     DATA "in a very large room, the floor is covered with straw."
  2353.     DATA in the old library.
  2354.     DATA at a T-junction.
  2355.     DATA in the bank vault. An enormous safe IS set into the ceiling. There IS no obvious handle.
  2356.     DATA in a steep passage.
  2357.     DATA at the troll bridge. A sign says STOP! TROLL OPERATED TOLL BRIDGE
  2358.     DATA at a fork in the path. Behind you IS the troll bridge.
  2359.     DATA "in a very small, dark room. Full of broken rocks. A sign says DANGER FALLING ROCKS."
  2360.     DATA in a large cave. It smells of bears.
  2361.     DATA in a large room full of huge furniture.
  2362.     DATA in the soft room. The walls resemble warm ice-cream.
  2363.     DATA "in the slimy passage. A green, sticky slime crawls all around you."
  2364.     DATA in a very small rocky cavern containing many stalactites.
  2365.     DATA in a tiny room. ON the wall it says Be humble in the eyes of the sphinx AND use your brains!
  2366.     DATA in a narrow tunnel.
  2367.     DATA in the dragons lair. The bones of many adventurers lie here.
  2368.     DATA in a narrow steep-sided passage. The roof cant be seen by lamp-light.
  2369.     DATA at the DEAD-END-DIAMOND-MINE.
  2370.     DATA in the blue room.
  2371.     DATA in the oyster room. A very cold draft comes from below.
  2372.     DATA ON the edge of a vast glacier. It IS riddled with deep crevasses too wide TO jump!
  2373.     DATA in the green room.
  2374.     DATA ON a high plateau. The bridge leads back across the glacier.
  2375.     DATA in the catacombs.
  2376.     DATA in the catacombs.
  2377.     DATA in the catacombs.
  2378.     DATA in the catacombs.
  2379.     DATA in the hall of the mountain king.
  2380.     DATA in an old pirates hideout. Many seafaring relics lie here
  2381.     DATA ON the edge of the desert. A huge sphinx sits here.
  2382.     DATA in the safe.
  2383.     DATA in the desert.
  2384.     DATA in the desert.
  2385.     DATA in the desert.
  2386.     DATA in the desert.
  2387.     DATA in the desert.
  2388.     DATA in the desert.
  2389.     DATA in the desert.
  2390.     DATA in the desert.
  2391.     DATA in the desert.
  2392.     DATA in the desert.
  2393.     DATA in the desert.
  2394.     DATA in the desert.
  2395.     DATA in the desert.
  2396.     DATA in the desert.
  2397.     DATA in the desert.
  2398.     DATA in the desert.
  2399.     DATA in the desert.
  2400.     DATA in the desert.
  2401.     DATA in the desert.
  2402.     DATA in the desert.
  2403.     DATA in the red room.
  2404.     DATA in the red room.
  2405.     DATA in the white room.
  2406.     DATA in the orange room.
  2407.     DATA in the purple room.
  2408.     DATA at a cross in the tunnels.
  2409.     DATA at a cross in the tunnels.
  2410.     DATA at a cross in the tunnels.
  2411.     DATA at a cross in the tunnels.
  2412.     DATA at a cross in the tunnels.
  2413.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2414.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2415.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2416.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2417.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2418.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2419.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2420.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2421.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2422.     DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
  2423.     DATA at the foot of a hill. A castle can be seen at the top of it.
  2424.     DATA in the castle gateway. The castle has obviously been left derelict FOR many years AS the walls are begining TO crumble away.
  2425.     DATA in an immense courtyard.
  2426.     DATA in the ruins of the north tower.
  2427.     DATA in the dungeons. The air here IS very musty. The floor IS covered in dust AND cobwebs cling TO you AS you move.
  2428.     DATA in the Counts dining room. The decorations ON the walls here are the blood stains of some of his unfortunate victims!
  2429.     DATA ON a steep staircase.
  2430.     DATA in the south tower.
  2431.     DATA in the ballroom. The music of the orchestras which used TO PLAY here still lingers ON.
  2432.     DATA at the entrance TO the gnomes halls.
  2433.     DATA in the gnomes kitchen.
  2434.     DATA in the main hall. The Gnomes are obviously very untidy! They are also very shy AND slip silently away AS you enter.
  2435.     DATA at a T-junction.
  2436.     DATA at the south END of the main hall.
  2437.     DATA in a low tunnel.
  2438.     DATA in a low tunnel.
  2439.     DATA in the dairy. There IS a mouth_watering smell here of buttermilk AND cheese.
  2440.     DATA "in the pit. It is small,dark and very unpleasant here."
  2441.     DATA in the rainbow room. The walls are decorated with all the colours imaginable.
  2442.     DATA in a large chamber decorated in the style of the Maharajas palace.
  2443.     DATA in a tiny water-worn pipe.
  2444.     DATA in a tunnel hewn OUT of the rock by a giant explosion.
  2445.     DATA in a room full of bottles of chemicals. This IS the alchemists store. The smell of sulphur IS overpowering.
  2446.     DATA in a very tight passageway. A cool damp wind blows from the south.
  2447.     DATA in a dark damp passageway. The ground IS becoming a little soggy here.
  2448.     DATA in the Everglades. It IS rather swampy here AND the mosquitoes are real pests!
  2449.     DATA in a dark damp passageway. The ground IS a little soggy here.
  2450.     DATA in the alchemists laboratory. Theres a powerful sulphurous odour!
  2451.     DATA "on a small path winding its way through a petrified forest."
  2452.     DATA at a T-junction.
  2453.     DATA at a T-junction.
  2454.     DATA in the music room. Beautiful melodies echo all around.
  2455.     DATA at a T-junction.
  2456.     DATA "on the yellow brick road. Well I think it was yellow once upon a time but it has got rather muddy now."
  2457.     DATA in an immense canyon. The sides reach upwards AS far AS the eye can see.
  2458.     DATA in a small shrine obviously devoted TO some fairy chief AS pictures of him decorate all the walls.
  2459.     DATA in a small passage. The ground IS rather soft underfoot.
  2460.     DATA in a patch of quicksand. Luckily though some kind previous adventurer has PUT a plank down so you can go ON safely.
  2461.     DATA at a dead_end. Oh dear you seem TO have struggled through that quicksand FOR nothing.
  2462.     DATA in the treasury.
  2463.     DATA at yet another dead_end.
  2464.     DATA at a dead END. Youll have TO follow the yellow brick road once more.
  2465.     DATA at the END of the yellow brick road. Im afraid you cant go ANY further in this direction AS the rest of the road hasnt been built yet.
  2466.     DATA in a fairy grotto. It IS very beautiful but seems TO be deserted.
  2467.     DATA ON the east shore. The mountains rise sharply all around the cove.
  2468.     DATA in the wizards spell-chamber. When you entered the wizard was here mumbling about some lost spell-books. He saw you grunted something AND vanished.
  2469.     DATA in the west antechamber TO the inner sanctum.
  2470.     DATA in the inner sanctum. NOT many have passed this way before. One intrepid adventurer seems TO have written some graffiti DAVE KNEW W LANE.
  2471.     DATA in the east antechamber.
  2472.     DATA in a room similar TO the spell-chamber.
  2473.     DATA in the serpents stomach. Oh dear you seem TO have become the monsters lunch.
  2474.     DATA at the bottom of the rock slide. It IS cramped AND airless here. There IS no obvious way TO GET OUT.
  2475.  
  2476.     RESTORE labdatalocs
  2477.  
  2478.     FOR i% = 1 TO 143
  2479.         READ varLocationDescription$(i%)
  2480.     NEXT i%
  2481. END SUB
  2482.  
  2483. SUB subReadObjects
  2484.     labObjects:
  2485.     DATA axe,sword,lamp,wand,keys,teeth,jack,chest,food,clam
  2486.     DATA sapphires,diamond,gold,silver,platinum,rubies,emerald,pearls,coins,opals
  2487.     DATA books,spices,sceptre,cushion,rug,ring,bottle,water,carrot,dragon
  2488.     DATA dwarf,ogre,goblins,troll,bear,pirate,orc,rabbit,safe,casket
  2489.     DATA crocodile,elephant,vampire,serpent,bracelet,amethyst,crown,boat,stake,stilton
  2490.     DATA matches,mouse,bridge,swamp,lake,building,
  2491.  
  2492.     RESTORE labObjects:
  2493.     FOR i% = 1 TO 56
  2494.         READ varObjectDesc$(i%)
  2495.     NEXT i%
  2496. END SUB
  2497.  
  2498. SUB subReadVerbs
  2499.     labVerbs:
  2500.     DATA GET,take,OPEN,wave,throw,drop,KILL,eat,cross,feed
  2501.     DATA rub,light,READ,pay,inventory,enter,OUT,leave,kneel,quit
  2502.     DATA score,look,in,help,diaxos,north,south,east,west,up
  2503.     DATA down,fill,go,load,save
  2504.  
  2505.     RESTORE labVerbs:
  2506.     FOR i% = 1 TO 35
  2507.         READ varVerb$(i%)
  2508.     NEXT i%
  2509. END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement