Guest User

Untitled

a guest
Nov 23rd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>Escape Room</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. // do you want to play?
  12. canYouEscape = window.confirm("Do you think you can escape the room?");
  13. if (canYouEscape == true) {beginGame = window.confirm("We'll see about that. Would you like to begin?");
  14. } else {beginGame = window.confirm("Would you like to try anyways?");}
  15. if (beginGame == false) {window.alert("Aw fine. I bet you wouldn't have been able to escape anyways ha!");}
  16.  
  17. // start game
  18. if (beginGame == true) {window.alert("You wake up in an unfamiliar room, as you become conscious you realize you have no memory of how you got there. You decide the best thing to do is find a way out.");
  19. investigateWhat = window.prompt("The first thing you do is check the wooden door, but of course, it's locked. As you look around the room you notice four things that stand out to you. The first is a shelf sticking out of the wall, supporting several bottles of different shapes and sizes. The second is where a section of the carpet is seems to be cut out in a square shape, it looks as if it could be peeled off. In another corner of the room is a small desk with three draws, on top random objects are scattered. Next to the desk resides an old radio. Which would you like to look at first? (type “shelf”, “carpet”, “desk”, or “radio”)");
  20. //set up
  21. haveCrowbar = false
  22. haveScrewdriver = false
  23. haveCassette = false
  24. openDrawerNumber = null
  25. continueWithDesk = null
  26. cassettePlayerBroken = true
  27. playCassette = false
  28. playCassetteAgain = false
  29. openToolBox = false
  30. haveKey = false
  31.  
  32. investigationLoop: while(true) {
  33. //investigate shelf
  34. if (investigateWhat == "shelf") {window.alert("You inspect the bottles on the shelf. There’s a small black one that seems to be empty, a clear round one filled with some sort of purple liquid, and a jar of water (at least that’s what it appears to be, but you still wouldn’t drink it).");}
  35.  
  36. //investigate carpet
  37. if (investigateWhat == "carpet") {if (haveCrowbar == true) {window.alert("The empty tool box remains under the trapdoor.");}
  38. if (haveCrowbar == false) {openToolBox = window.confirm("You begin to peal back the carpet square, revealing a trap door underneath. Would you like to open the trapdoor?");
  39. if (openToolBox == true) {window.alert("You open the trapdoor and find a large toolbox. Inside is a crowbar, a few nails, and a box of mints. These items are added to your inventory.");
  40. haveCrowbar = true;}}}
  41.  
  42. //investigate desk
  43. if (investigateWhat == "desk") {openDrawerNumber = window.prompt("On top of the desk lies a coffee mug filled with dirt, a small green plant is sprouting out of it. There are three drawers. Which drawer would you like to open? (type “1”, “2”, or “3”)");
  44. drawerLoop: while(true)
  45. {if (openDrawerNumber == "1") { if (haveScrewdriver == true) {window.alert("This drawer has already been emptied.");}
  46. if (haveScrewdriver == false) {window.alert("You open drawer one and find a screwdriver and a rubber band. You add these items to your inventory.");
  47. haveScrewdriver = true;}}
  48. if (openDrawerNumber == "2") {openDrawerNumber = window.alert("You open drawer two and find that it is empty.");}
  49. if (openDrawerNumber == "3") {if (haveCrowbar == false) {window.alert("You pull to open drawer three but find that it is stuck. You will need something to pry it open.");}
  50. if (haveCrowbar == true) {pryDrawer = window.confirm("The drawer is stuck would you like to use the crowbar from your inventory to open it?");
  51. if (pryDrawer == true) {window.alert("The drawer opens and inside you find a single cassette, labeled “to whom it may concern”. You take the cassette and add it to your inventory.");
  52. haveCassette = true; }}}
  53. if (openDrawerNumber == "check under plant") {window.alert("Nothing unusual, just the desk underneath.");}
  54. if (openDrawerNumber == "dump out plant") {window.alert("You dump out the dirt and plant from the mug. What a mess you’ve made! You search through the spilled dirt with your hands until you spot something shiny underneath some of it. It’s a key! You add the key to your inventory.");
  55. haveKey = true;}
  56.  
  57. continueWithDesk = window.prompt("Would you like to look in one of the drawers or exit the desk? (type “1”, “2”, “3”, or “exit desk”)")
  58. if (continueWithDesk == "1") {openDrawerNumber = "1";}
  59. if (continueWithDesk == "2") {openDrawerNumber = "2";}
  60. if (continueWithDesk == "3") {openDrawerNumber = "3";}
  61. if (continueWithDesk == "dump out plant") {openDrawerNumber = "dump out plant";}
  62. if (continueWithDesk == "check under plant") {openDrawerNumber = "check under plant";}
  63. if (continueWithDesk == "exit desk") {break;}}}
  64.  
  65. //investigate radio
  66. if (investigateWhat == "radio") {if (haveScrewdriver == false) {window.alert("You examine the old radio and see that it has a slot to play cassette tapes. However, it appears to be broken, maybe you could fix it if you had a screwdriver.");}
  67. if (haveScrewdriver == true) {if (cassettePlayerBroken == false) { if (haveCassette == false){window.alert("The cassette player works, but you don't have any thing to play in it.");}
  68. if (haveCassette == true) {if (playCassette == true) {playCassetteAgain = window.confirm("Would you like to hear the cassette again?");
  69. if (playCassetteAgain == true) {window.alert("The old cassette player spits out the words, “Check the plant.” Perhaps there is something underneath the plant, or inside. You should try “check under plant” and “dump out plant”.");
  70. hint = true;}}
  71. if (playCassette == false) {playCassette = window.confirm("The cassette player works. Would you like to play the cassette from your inventory?");
  72. if (playCassette == true) {window.alert("You put the cassette in and hit play. The static noises slowly turn to words. “Check the plant.” Hmm… perhaps there is something underneath the plant, or inside. You should try “check under plant” and “dump out plant”.");}}}}
  73. if (cassettePlayerBroken == true){fixRadio = window.confirm("You examine the old radio and see that it has a slot to play cassette tapes. However, it appears to be broken. Would you like to fix it using the screwdriver from your inventory?");
  74. if (fixRadio == true){if (haveCassette == false) {window.alert("You fixed the cassette player. Now if only you had a cassette to play...");}
  75. if (haveCassette == true) {playCassette = window.confirm("You fixed the cassette player. Would you like to play the cassette from your inventory?");
  76. if (playCassette == true) {window.alert("You put the cassette in and hit play. The static noises slowly turn to words. “Check the plant.” Hmm… perhaps there is something underneath the plant, or inside. You should try “check under plant” and “dump out plant”.");
  77. hint = true;}}
  78. cassettePlayerBroken = false;}}}}
  79. //investigate again
  80. investigateAgain = window.prompt("Which site would you like to visit now? (type “shelf”, “carpet”, “desk”, “radio”, or “door”)");
  81. investigateWhat = null;
  82. if (investigateAgain == "shelf"){investigateWhat = "shelf";}
  83. if (investigateAgain == "carpet"){investigateWhat = "carpet";}
  84. if (investigateAgain == "desk"){investigateWhat = "desk";}
  85. if (investigateAgain == "radio"){investigateWhat = "radio";}
  86.  
  87. //door + end game
  88. if (investigateAgain == "door"){if (haveKey == false){window.alert("The door is locked, you need to find a key.");}
  89. if (haveKey == true) {exitRoom = window.confirm("The door is still locked, would you like to open it using the key from your inventory?");
  90. if (exitRoom == true) {window.alert("Congratulations! You have escaped the room and beaten the game! The end.");
  91. break;}}}}}
  92. </script>
  93.  
  94.  
  95.  
  96. <script id="jsbin-source-javascript" type="text/javascript">// do you want to play?
  97. canYouEscape = window.confirm("Do you think you can escape the room?");
  98. if (canYouEscape == true) {beginGame = window.confirm("We'll see about that. Would you like to begin?");
  99. } else {beginGame = window.confirm("Would you like to try anyways?");}
  100. if (beginGame == false) {window.alert("Aw fine. I bet you wouldn't have been able to escape anyways ha!");}
  101.  
  102. // start game
  103. if (beginGame == true) {window.alert("You wake up in an unfamiliar room, as you become conscious you realize you have no memory of how you got there. You decide the best thing to do is find a way out.");
  104. investigateWhat = window.prompt("The first thing you do is check the wooden door, but of course, it's locked. As you look around the room you notice four things that stand out to you. The first is a shelf sticking out of the wall, supporting several bottles of different shapes and sizes. The second is where a section of the carpet is seems to be cut out in a square shape, it looks as if it could be peeled off. In another corner of the room is a small desk with three draws, on top random objects are scattered. Next to the desk resides an old radio. Which would you like to look at first? (type “shelf”, “carpet”, “desk”, or “radio”)");
  105. //set up
  106. haveCrowbar = false
  107. haveScrewdriver = false
  108. haveCassette = false
  109. openDrawerNumber = null
  110. continueWithDesk = null
  111. cassettePlayerBroken = true
  112. playCassette = false
  113. playCassetteAgain = false
  114. openToolBox = false
  115. haveKey = false
  116.  
  117. investigationLoop: while(true) {
  118. //investigate shelf
  119. if (investigateWhat == "shelf") {window.alert("You inspect the bottles on the shelf. There’s a small black one that seems to be empty, a clear round one filled with some sort of purple liquid, and a jar of water (at least that’s what it appears to be, but you still wouldn’t drink it).");}
  120.  
  121. //investigate carpet
  122. if (investigateWhat == "carpet") {if (haveCrowbar == true) {window.alert("The empty tool box remains under the trapdoor.");}
  123. if (haveCrowbar == false) {openToolBox = window.confirm("You begin to peal back the carpet square, revealing a trap door underneath. Would you like to open the trapdoor?");
  124. if (openToolBox == true) {window.alert("You open the trapdoor and find a large toolbox. Inside is a crowbar, a few nails, and a box of mints. These items are added to your inventory.");
  125. haveCrowbar = true;}}}
  126.  
  127. //investigate desk
  128. if (investigateWhat == "desk") {openDrawerNumber = window.prompt("On top of the desk lies a coffee mug filled with dirt, a small green plant is sprouting out of it. There are three drawers. Which drawer would you like to open? (type “1”, “2”, or “3”)");
  129. drawerLoop: while(true)
  130. {if (openDrawerNumber == "1") { if (haveScrewdriver == true) {window.alert("This drawer has already been emptied.");}
  131. if (haveScrewdriver == false) {window.alert("You open drawer one and find a screwdriver and a rubber band. You add these items to your inventory.");
  132. haveScrewdriver = true;}}
  133. if (openDrawerNumber == "2") {openDrawerNumber = window.alert("You open drawer two and find that it is empty.");}
  134. if (openDrawerNumber == "3") {if (haveCrowbar == false) {window.alert("You pull to open drawer three but find that it is stuck. You will need something to pry it open.");}
  135. if (haveCrowbar == true) {pryDrawer = window.confirm("The drawer is stuck would you like to use the crowbar from your inventory to open it?");
  136. if (pryDrawer == true) {window.alert("The drawer opens and inside you find a single cassette, labeled “to whom it may concern”. You take the cassette and add it to your inventory.");
  137. haveCassette = true; }}}
  138. if (openDrawerNumber == "check under plant") {window.alert("Nothing unusual, just the desk underneath.");}
  139. if (openDrawerNumber == "dump out plant") {window.alert("You dump out the dirt and plant from the mug. What a mess you’ve made! You search through the spilled dirt with your hands until you spot something shiny underneath some of it. It’s a key! You add the key to your inventory.");
  140. haveKey = true;}
  141.  
  142. continueWithDesk = window.prompt("Would you like to look in one of the drawers or exit the desk? (type “1”, “2”, “3”, or “exit desk”)")
  143. if (continueWithDesk == "1") {openDrawerNumber = "1";}
  144. if (continueWithDesk == "2") {openDrawerNumber = "2";}
  145. if (continueWithDesk == "3") {openDrawerNumber = "3";}
  146. if (continueWithDesk == "dump out plant") {openDrawerNumber = "dump out plant";}
  147. if (continueWithDesk == "check under plant") {openDrawerNumber = "check under plant";}
  148. if (continueWithDesk == "exit desk") {break;}}}
  149.  
  150. //investigate radio
  151. if (investigateWhat == "radio") {if (haveScrewdriver == false) {window.alert("You examine the old radio and see that it has a slot to play cassette tapes. However, it appears to be broken, maybe you could fix it if you had a screwdriver.");}
  152. if (haveScrewdriver == true) {if (cassettePlayerBroken == false) { if (haveCassette == false){window.alert("The cassette player works, but you don't have any thing to play in it.");}
  153. if (haveCassette == true) {if (playCassette == true) {playCassetteAgain = window.confirm("Would you like to hear the cassette again?");
  154. if (playCassetteAgain == true) {window.alert("The old cassette player spits out the words, “Check the plant.” Perhaps there is something underneath the plant, or inside. You should try “check under plant” and “dump out plant”.");
  155. hint = true;}}
  156. if (playCassette == false) {playCassette = window.confirm("The cassette player works. Would you like to play the cassette from your inventory?");
  157. if (playCassette == true) {window.alert("You put the cassette in and hit play. The static noises slowly turn to words. “Check the plant.” Hmm… perhaps there is something underneath the plant, or inside. You should try “check under plant” and “dump out plant”.");}}}}
  158. if (cassettePlayerBroken == true){fixRadio = window.confirm("You examine the old radio and see that it has a slot to play cassette tapes. However, it appears to be broken. Would you like to fix it using the screwdriver from your inventory?");
  159. if (fixRadio == true){if (haveCassette == false) {window.alert("You fixed the cassette player. Now if only you had a cassette to play...");}
  160. if (haveCassette == true) {playCassette = window.confirm("You fixed the cassette player. Would you like to play the cassette from your inventory?");
  161. if (playCassette == true) {window.alert("You put the cassette in and hit play. The static noises slowly turn to words. “Check the plant.” Hmm… perhaps there is something underneath the plant, or inside. You should try “check under plant” and “dump out plant”.");
  162. hint = true;}}
  163. cassettePlayerBroken = false;}}}}
  164. //investigate again
  165. investigateAgain = window.prompt("Which site would you like to visit now? (type “shelf”, “carpet”, “desk”, “radio”, or “door”)");
  166. investigateWhat = null;
  167. if (investigateAgain == "shelf"){investigateWhat = "shelf";}
  168. if (investigateAgain == "carpet"){investigateWhat = "carpet";}
  169. if (investigateAgain == "desk"){investigateWhat = "desk";}
  170. if (investigateAgain == "radio"){investigateWhat = "radio";}
  171.  
  172. //door + end game
  173. if (investigateAgain == "door"){if (haveKey == false){window.alert("The door is locked, you need to find a key.");}
  174. if (haveKey == true) {exitRoom = window.confirm("The door is still locked, would you like to open it using the key from your inventory?");
  175. if (exitRoom == true) {window.alert("Congratulations! You have escaped the room and beaten the game! The end.");
  176. break;}}}}}</script></body>
  177. </html>
Add Comment
Please, Sign In to add comment