<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
alert("Welcome traveler! Please type all responses in lowercase. These are the end of the instructions.")
alert("Oh, and thanks for playing...")
var response = prompt("Please choose a class... warrior, ranger, mage, or cleric.")
if (response === "mage"){
alert("Here is a staff for your journey! Use it wisely.")
var clericMage = prompt("Which way will you head first? left or right?")
}
else if (response === "cleric"){
alert("Here is a staff for your journey! Use it wisely.")
var clericMage = prompt("Which way will you head first? left or right?")
}
else if(response === "warrior"){
alert("You have been given the choice between a short sword or long sword.")
var warrior = prompt("Which will you choose? The short sword or the long sword?")
}
else if(response === "ranger"){
alert("You have been given the choice between a bow or a crossbow.")
var ranger = prompt("Which will you choose? The bow or the crossbow?")
}
else{
alert("Try again.")
}
//CLERIC MAGE ROUTE
if (clericMage === "right"){
alert("You enter a large room filled with gold coins and goblets.")
alert("Looking around you notice a large pile at the center of the room. The pile appears to be breathing...")
var clericMageResponse1 = prompt("Would you like to aquire some gold for your journey? Yes or no.")
}
else if(clericMage === "left"){
alert("You find yourself running down a long hallway.")
alert("At the end of the hallway you exit into a large colosseum filled with light.")
alert("Standing in the middle of the arena is a large one eyed cyclops.")
var clericMageResponse2 = prompt("What will you do? wand or diplomacy?")
}
if (clericMageResponse1 === "yes"){
alert("You grab a singular gold coin from the pile.")
alert("The pile at the middle of the room stirs...")
var dragon = prompt("Would you like to take another or leave the room? yes or no.")
}
else if (clericMageResponse1 === "no"){
alert("You leave the room with haste.")
var hallway = prompt("At the end of a long hallway you spot two doors. One beaming with light and the other dark and cold. Which will you choose? left or right.")
}
if(clericMageResponse2 === "wand"){
alert("You shout avada kadavra at the cyclops with great passion!!!")
alert("Nothing happens...")
alert("The cyclops proceeds to end your journey with one swing.")
alert("You die.")
}
else if(clericMageResponse2 === "diplomacy"){
alert("You sit down with the giant to discuss the terms of his surrender.")
alert("He is a very reasonable man and understands how powerful you could potentially be.")
alert("Though still not convinced to let you through he ask what you have to offer him.")
var diplomacy = prompt("Would you like to give him your gold piece? yes or no.")
}
if (diplomacy === "yes"){
alert("You win the game! Not resporting to violence was very cleric mage class of you!")
}
else if (diplomacy === "no"){
alert("The giant grows impatient with your squabble. The cyclops smashes you with his fist.")
alert("You die.")
}
if(dragon === "yes"){
alert("A large plum of fire erupts from the pile scorching your bones.")
alert("You die.")
}
else if(dragon === "no"){
alert("You leave the room with haste.")
var hallway = prompt("At the end of a long hallway you spot two doors. One beaming with light on the left and the other dark and cold on the right. Which will you choose? left or right.")
}
if (hallway === "left"){
alert("A large plum of fire erupts from the doorway scorching your bones.")
alert("You die.")
}
else if (hallway === "right"){
alert("As you enter the room a frost giant greets you.")
alert("He offers you a spot at his table to sit and sip tea with him.")
alert("Being a gentlman mage cleric class you cannot refuse his kind offer!")
alert("You sit down.")
alert("As you drink tea with the giant he tells you all about his homeland.")
alert("The tea was poisoned.")
alert("You die.")
}
//WARRIOR ROUTE
if (warrior === "short sword"){
var warrior = prompt("You have chosen well. Now, would you like to enter the dungeon (yes or no)?")
}
else if (warrior === "long sword"){
var warrior = prompt("You have chosen well. Now, would you like to enter the dungeon (yes or no)?")
}
if (warrior === "yes"){
alert("Upon entering the dungeon, you come across a fork in the road.")
var dungeon = prompt("Do you choose to go right or left?")
}
else if (warrior === "no"){
alert("You decided to chicken out. You lose!")
}
//dungeon right warrior
if (dungeon === "right"){
alert("You decided to go down the right path.")
alert("As you continue to go down, it gets darker and darker. Eventually, you can no longer see.")
var light = prompt("Fortunately, you see a light in the distance. But, do you go towards it (yes or no)?")
}
if (light === "yes"){
alert("You approach the light. Unfortunately, you come across a gaint monster on the other side and are squashed. Try again!")
}
else if (light === "no") {
alert("You go deeper into the dungeon. It gets darker and darker...")
alert("Eventually, a monster that you couldn't see attacks you and kills you. Try again!")
}
//dungeon left warrior
else if (dungeon === "left"){
alert("You decided to go left. The dungeon eventually abruptly ends at a wall.")
alert("You turn back from the dungeon, hoping to find adventure elsewhere.")
var thief = prompt("Suddenly, you noticed a villager being robbed. What will you do (chase or ignore)?")
}
if (thief === "chase"){
alert("You chase the thief at full speed into the nearby forest.")
alert("The thief notices you and tries to stop you.")
var avoid = prompt("The thief shoots an arrow at you. In a quick movement, you... (duck or dodge)")
}
else if (thief === "ignore") {
alert("You ignored the robbery and went about your day. What a wimp! You lose.")
}
if (avoid === "duck"){
alert("You tried to duck under the arrow, but are too late as the arrows hits you square in the knee. You lose!")
}
else if (avoid === "dodge") {
alert("You dodged to the side")
alert("Thanks to your quick movement, you dodged the arrow and caught the thief.")
alert("Unfortunately though, you lost your way and cannot get back to the village.")
var lost = prompt("What will you do (look for help or walk aimlessly)?")
}
if (lost === "look for help"){
alert("You look around for help and find someone.")
alert("They tell you the way back to the village is that way.")
var monster = prompt("On your way back however, a monster approaches. Will you fight it or flee from it?")
}
else if (lost === "walk aimlessly") {
alert("You become even more hopelessly lost. You may never make it back. You lose!")
}
if (monster === "flee"){
alert("You tried to flee, but the monster instead caught up and killed you. You lose!")
}
else if (monster === "fight") {
alert("You fight the monster and slay the foul beast.")
alert("You continue on your way to the village.")
alert("As you travel back to the village, you come across another fork in the road.")
var forestPath = prompt("Which way will you go? Left or right?")
}
if (forestPath === "right"){
alert("You went down the right path. As you travel further and further, the road starts to dissappear. It seems you may be lost forever. Try again!")
}
else if (forestPath === "left") {
alert("You went down the left path. As you travel, you eventually make it out of the forest and back to the village.")
alert("When you get to the village, however, an orc is there terrorizing the villagers")
var orc = prompt("Shall you fight or make peace?")
}
if (orc === "fight"){
alert("Pulling your sword out, you swung at the orc with your full might, promptly slaying the beast.")
alert("The village praises you for your heroism.")
alert("You also return the stolen item to the villager who was robbed. With that, you win the game!")
}
else if (orc === "make peace") {
alert("You go up to the orc and attempt to make peace with it.")
alert("The orc doesn't seem much for peace and throws you to the ground. You lose!")
}
//RANGER ROUTE
if (ranger === "bow"){
var shootingGallery = prompt("Great choice! Now, would you like to enter the shooting competition (yes or no)?")
}
else if (ranger === "crossbow") {
var shootingGallery = prompt("Great choice! Now, would you like to enter the shooting competition (yes or no)?")
}
if (shootingGallery === "yes"){
alert("You entered the tournament.")
alert("Round 1 is now starting")
var shoot1 = prompt("You are faced with a moving target moving left, right, left... (shoot left or right?)")
}
else if (shootingGallery === "no") {
alert("Fine then, you lose. Get out of here!")
}
if (shoot1 === "left"){
alert("You took a shot to the left and missed. You lose!")
}
else if (shoot1 === "right") {
alert("You shot right and hit the target. The audience cheers as you leave the arena.")
var bully = prompt("As you go back into the barracks, some guy pushes you to the ground and starts to ridicule you. Will you fire back or ignore?")
}
if (bully === "ignore"){
alert("You ignored him but he keeps bothering you. You deal with it for now.")
var shoot2 = prompt("You are now enterting round two. This time it's more complicated: you must hit a small target from 100 feet away. Will you aim upwards or downwards to account for arrow drop?")
}
else if (bully === "fire back") {
alert("You fire back with a ridicule of your own, but this backfires on you as you are kicked out of the tourney for disorderly conduct. You lose!")
}
if (shoot2 === "upwards"){
alert("You aimed slightly upwards and shot. You barely hit the target and make it to the final round!")
var bully2 = prompt("As you prepare for the final round, the bully comes back, but this time he tries to fight you. Will you fight or report (to the higher-ups)?")
}
else if (shoot2 === "downwards") {
alert("You aimed slightly downwards and take your shot. However, you barely missed your shot and lost round 2. Try again!")
}
if (bully2 === "fight"){
alert("You fought the bully and won the fight, but some guards caught you and now you and the bully have beem terminated from the tournament. Try again!")
}
else if (bully2 === "report") {
alert("You got beat up and knocked down, the bully mocking you the entire time. However, whenever you report it the authorities, the bully is promptly terminated from the tournament.")
var practice = prompt("It's almost time for the final round, but you don't feel prepared. So you practice by... (target practice or exercise?)")
}
if (practice === "target practice"){
alert("You take up some target practice and now feel more prepared to take on the final round.")
alert("Now it's time for the final round. As you walk into the arena, you can feel the sweat rolling down your face. You see three targets, two white and one gold. You have to hit the gold one, but you have to go around the other two in order to do so.")
var shoot3 = prompt("You notice three potential ways you can hit the gold target. So, you decide to...(shoot straight, shoot above, or shoot below)")
}
else if (practice === "exercise") {
alert("You decided to do some exercises and now feel more pumped up and ready to take on the final round.")
alert("Now it's time for the final round. As you walk into the arena, you can feel the sweat rolling down your face. You see three targets, two white and one gold. You have to hit the gold one, but the other two block the way.")
var shoot3 = prompt("You notice three potential ways you can hit the gold target. So, you decide to...(shoot straight, shoot above, or shoot below)")
}
if (shoot3 === "shoot straight"){
alert("You took a straight shot. You ended up hitting one of the white targets and failed. Try again!")
}
else if (shoot3 === "shoot above") {
alert("You tried to shoot above the targets to hit the gold one. Miraculously, you barely hit the gold target and win the final round. You have now received your prize and won the tournament!")
var win = prompt("With your prize money in hand, you now decide to...(donate or keep?)")
}
else if (shoot3 === "shoot below") {
alert("You tried to shoot below the targets to hit the gold one, but your arrow hits the floor and you lose. What were you expecting? Try again!")
}
if (win === "donate"){
alert("You donate your money to charity and to those in need and win the game!")
}
else if (win === "keep") {
alert("You decided to selfishly keep the money. A little cruel, eh? Nonetheless, you still win the game!")
}
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |