home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / TEXTMAGS / 3RD_DIM / 3RDDM18.MSA / ROUTINES / SWITCH.TXT < prev   
Text File  |  2004-06-27  |  4KB  |  176 lines

  1.                            THE THIRD DIMENSION                    
  2.  
  3.                          Pick the correct switch
  4.                          -----------------------
  5. Switch Puzzle by John Clarke.
  6.  
  7. This puzzle is from a game that I am currently writing called "The Escape".  
  8. In this puzzle there are 6 switches on the wall and two force fields at each 
  9. end of the corridor.  You have to select one of the switches in order to 
  10. deactivate one of the force fields enabling you to go on further.  If you 
  11. select the wrong switch a laser cannon will appear in the centre of the 
  12. room and will start shooting at you.
  13.  
  14. Map
  15. ===
  16.  
  17.                -------------------------------------------
  18.                :   |  1     2     3    4    5    6   |   :
  19.                :   |               LC                |   :
  20.                :   |                                 |   :
  21.                -------------------------------------------
  22.  
  23. Key
  24. ---
  25.  
  26. 1-6 : Switches
  27.  |  : Force Field
  28. LC  : Laser Cannon
  29.                                      
  30. Sounds simple doesn't it.  Well just to make it trickier I have written 
  31. the code in such a way that the computer will decide which switch will 
  32. deactivate the force field when you start the game.
  33.  
  34. Once the corridor was created I created an initial condition.  The initial 
  35. condition makes both force fields fadebounce,  sets all variable used for 
  36. this puzzle to 0 and then selects which switch will deactivate the force 
  37. field.  The laser cannon is made invisible and is only made visible when 
  38. the wrong switch is selected.
  39.  
  40. Variables Used
  41. --------------
  42.  
  43. V30       : To store random number (0,1,2,3,4 or 5).
  44. V31 - V36 : To identify which of the switches will deactivate the force 
  45.             field.
  46.  
  47. When the computer has selected which switch will deactivate the force field 
  48. it sets the appropriate variable to 1.
  49.  
  50. Switch Number  | Value of Variable V30 | Variable to set to 1
  51. ---------------+-----------------------+---------------------
  52.       1        |          0            |         V31
  53.       2        |          1            |         V32
  54.       3        |          2            |         V33
  55.       4        |          3            |         V34
  56.       5        |          4            |         V35
  57.       6        |          5            |         V36
  58.  
  59. When the game starts and you shoot at a switch the computer looks at the 
  60. value of the variable for that switch and if it equals 1 the force field is 
  61. deactivated.  Otherwise object 15 (The Laser Cannon) is made visible and it 
  62. starts shooting at you.
  63.  
  64. This is the only area of the game that I have sent in for the 
  65. diskmag so you will not be able to go any further.
  66.  
  67.        John Clarke
  68.  
  69. The Code for this Puzzle
  70. ========================
  71.  
  72. Initial Condition 
  73. -----------------
  74.  
  75. FADEBOUNCE (6)
  76. FADEBOUNCE (7)
  77. INVIS (15)
  78. SETVAR (0,V30)
  79. SETVAR (0,V31)
  80. SETVAR (0,V32)
  81. SETVAR (0,V33)
  82. SETVAR (0,V34)
  83. SETVAR (0,V35)
  84. SETVAR (0,V36)
  85. RANDOM (5,V30)
  86. IF VAREQ? (V30,0)
  87. THEN
  88.  SETVAR (1,V31)
  89. ENDIF
  90. IF VAREQ? (V30,1)
  91. THEN
  92.  SETVAR (1,V32)
  93. ENDIF
  94. IF VAREQ? (V30,2)
  95. THEN
  96.  SETVAR (1,V33)
  97. ENDIF
  98. IF VAREQ? (V30,3)
  99. THEN
  100.  SETVAR (1,V34)
  101. ENDIF
  102. IF VAREQ? (V30,4)
  103. THEN
  104.  SETVAR (1,V35)
  105. ENDIF
  106. IF VAREQ? (V30,5)
  107. THEN
  108.  SETVAR (1,V36)
  109. ENDIF
  110.  
  111. Switch 1
  112. --------
  113.  
  114. IF SHOT?
  115. AND VAREQ? (1,V31)
  116. THEN
  117.  INVIS (7)
  118. ELSE
  119.  VIS (15)
  120. ENDIF
  121.  
  122. Switch 2
  123. --------
  124.  
  125. IF SHOT?
  126. AND VAREQ? (1,V32)
  127. THEN
  128.  INVIS (7)
  129. ELSE
  130.  VIS (15)
  131. ENDIF
  132.  
  133. Switch 3
  134. --------
  135.  
  136. IF SHOT?
  137. AND VAREQ? (1,V33)
  138. THEN
  139.  INVIS (7)
  140. ELSE
  141.  VIS (15)
  142. ENDIF
  143.  
  144. Switch 4
  145. --------
  146.  
  147. IF SHOT?
  148. AND VAREQ? (1,V34)
  149. THEN
  150.  INVIS (7)
  151. ELSE
  152.  VIS (15)
  153. ENDIF
  154.  
  155. Switch 5
  156. --------
  157.  
  158. IF SHOT?
  159. AND VAREQ? (1,V35)
  160. THEN
  161.  INVIS (7)
  162. ELSE
  163.  VIS (15)
  164. ENDIF
  165.  
  166. Switch 6
  167. --------
  168.  
  169. IF SHOT?
  170. AND VAREQ? (1,V36)
  171. THEN
  172.  INVIS (7)
  173. ELSE
  174.  VIS (15)
  175. ENDIF
  176.