// UNDERTYPED // A text-based puzzle/adventure game on typed.art // // How to run: // 1. Copy everything in this token. // 2. Open developer console using F12 or inspect element. // 3. Paste everything in the Console. // 4. Press Enter. // 5. The game should load in the same token. // const aTags=document.getElementsByTagName("p");let foundP=document.createElement("p");for(let i=0;i<aTags.length;i++)if(aTags[i].textContent.includes("// UNDERTYPED")){foundP=aTags[i];break}document.body.style.backgroundColor="rgb(0,0,0)",document.body.style.height="100vh",gameWindow=document.createElement("div"),foundP.parentElement.appendChild(gameWindow),foundP.remove(),gameWindow.innerHTML="LOADING...",gameWindow.scrollIntoView({behavior:"smooth",block:"center"});try{document.getElementsByClassName("header")[0].style.backgroundColor="rgb(0,0,0)",document.getElementsByClassName("page")[0].style.filter="grayscale(0%)"}catch(a){}let font1=document.createElement("link");font1.setAttribute("rel","stylesheet"),font1.setAttribute("type","text/css"),font1.setAttribute("href","https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");let font2=document.createElement("link");font2.setAttribute("rel","stylesheet"),font2.setAttribute("type","text/css"),font2.setAttribute("href","https://fonts.googleapis.com/css2?family=VT323&display=swap");let link1=document.createElement("link");link1.setAttribute("rel","preconnect"),link1.setAttribute("href","https://fonts.googleapis.com");let link2=document.createElement("link");link2.setAttribute("rel","preconnect"),link2.setAttribute("href","https://fonts.gstatic.com"),link2.crossOrigin=!0,document.head.appendChild(link1),document.head.appendChild(link2),document.head.appendChild(font1),document.head.appendChild(font2),gameWindow.style.fontFamily="'Press Start 2P'",gameWindow.style.fontSize="24px",gameWindow.style.color="white",gameWindow.style.textAlign="left";let typeSpeedDefault=50;async function WTT(b){let c=2typeSpeedDefault;for(let a=0;a<b.length;a++)setTimeout(()=>{gameWindow.innerHTML+=b[a]},ca);return new Promise(a=>setTimeout(a,cb.length))}async function WTN(c){let d=typeSpeedDefault,a=document.createElement("div");a.style.fontFamily="'VT323'",gameWindow.appendChild(a);for(let b=0;b<c.length;b++)setTimeout(()=>{a.innerHTML+=c[b]},db);return a.scrollIntoView({behavior:"smooth",block:"center"}),new Promise(a=>setTimeout(a,dc.length))}async function WTO(c){let d=typeSpeedDefault,a=document.createElement("div");a.style.fontFamily="'VT323'",a.style.color="rgb(255,255,0)",gameWindow.appendChild(a);for(let b=0;b<c.length;b++)setTimeout(()=>{a.innerHTML+=c[b]},db);return a.scrollIntoView({behavior:"smooth",block:"center"}),new Promise(a=>setTimeout(a,dc.length))}async function WTS(c){let d=typeSpeedDefault,a=document.createElement("div");a.style.fontFamily="'VT323'",a.style.color="rgb(0,255,0)",gameWindow.appendChild(a);for(let b=0;b<c.length;b++)setTimeout(()=>{a.innerHTML+=c[b]},db);return a.scrollIntoView({behavior:"smooth",block:"center"}),new Promise(a=>setTimeout(a,dc.length))}async function WTL(c){let d=typeSpeedDefault,a=document.createElement("div");a.style.fontFamily="'VT323'",a.style.color="rgb(255,0,0)",gameWindow.appendChild(a);for(let b=0;b<c.length;b++)setTimeout(()=>{a.innerHTML+=c[b]},db);return a.scrollIntoView({behavior:"smooth",block:"center"}),new Promise(a=>setTimeout(a,d*c.length))}function loadGame(){gameWindow.innerHTML="",WTT("UNDERTYPED").then(()=>{WTN("A text-based puzzle/adventure game on typed.art").then(()=>{WTN(".").then(()=>{WTO("> [ENTER] to start").then(()=>{document.body.onkeydown=function(a){"Enter"==a.key&&WTS("Started the game.").then(()=>{document.body.onkeydown=null,section1_1()})}})})})})}function section1_1(){WTN(".").then(()=>{WTN("The door closes behind you...").then(()=>{WTN("It seems like you are stuck in the dungeon.").then(()=>{WTO("> [ENTER] to walk forward").then(()=>{document.body.onkeydown=function(a){"Enter"==a.key&&WTS("Starts walking forward...").then(()=>{document.body.onkeydown=null,section2_1()})}})})})})}function section2_1(){WTN(".").then(()=>{WTN("You find two doors, one of them has blood on it.").then(()=>{WTO("> [Z] to open the normal door").then(()=>{WTO("> [X] to open the bloody door").then(()=>{document.body.onkeydown=function(a){"z"==a.key&&WTS("Opens the normal door...").then(()=>{document.body.onkeydown=null,section3_1()}),"x"==a.key&&WTS("Opens the bloody door...").then(()=>{document.body.onkeydown=null,section3_2()})}})})})})}function section3_1(){WTN(".").then(()=>{WTN("You enter a very clean room.").then(()=>{WTN("There is a box in the middle of the room.").then(()=>{WTO("> [Z] to open the box").then(()=>{WTO("> [X] to leave the room").then(()=>{document.body.onkeydown=function(a){"z"==a.key&&WTS("Opens the box...").then(()=>{document.body.onkeydown=null,section7_1()}),"x"==a.key&&WTS("Turns around to leave the room...").then(()=>{document.body.onkeydown=null,section7_2()})}})})})})})}function section7_1(){WTN(".").then(()=>{WTN("There is a long and thin sword along with a short and fat sword in the box.").then(()=>{WTN("You hear the walking sound of a creature from behind.").then(()=>{WTN("You need to choose a sword to fight.").then(()=>{WTO("> [Z] to use the long and thin sword").then(()=>{WTO("> [X] to use the short and fat sword").then(()=>{document.body.onkeydown=function(a){"z"==a.key&&WTS("Chooses the long and thin sword...").then(()=>{document.body.onkeydown=null,section8_1()}),"x"==a.key&&WTS("Chooses the short and fat sword...").then(()=>{document.body.onkeydown=null,section8_2()})}})})})})})})}function section8_1(){WTN(".").then(()=>{WTN("A spider like creature enters the room.").then(()=>{WTN("You try to stab it with your sword but it breaks.").then(()=>{WTN("The last thing you see is the monster's throat...").then(()=>{WTN(".").then(()=>{WTL("You died.").then(()=>{WTO("> [R] to restart").then(()=>{document.body.onkeydown=function(a){"r"==a.key&&(document.body.onkeydown=null,gameWindow.innerHTML="",loadGame())}})})})})})})})}function section8_2(){WTN(".").then(()=>{WTN("A spider like creatures enters the room.").then(()=>{WTN("You stab the creature using your sword.").then(()=>{WTN("The monster starts bleeding and falls to the ground.").then(()=>{WTN(".").then(()=>{WTS("You beat the creature.").then(()=>{WTO("> [R] to restart").then(()=>{document.body.onkeydown=function(a){"r"==a.key&&(document.body.onkeydown=null,gameWindow.innerHTML="",loadGame())}})})})})})})})}function section7_2(){WTN(".").then(()=>{WTN("You try to open the door to leave the room, but it's locked from the outside.").then(()=>{WTN("You try to break it using your hammer but it doesn't work.").then(()=>{WTN("You try to pick the lock but it gets jammed instead.").then(()=>{WTN("It seems like that you are stuck in the room forever...").then(()=>{WTN(".").then(()=>{WTL("You died of starvation.").then(()=>{WTO("> [R] to restart").then(()=>{document.body.onkeydown=function(a){"r"==a.key&&(document.body.onkeydown=null,gameWindow.innerHTML="",loadGame())}})})})})})})})})}function section3_2(){WTN(".").then(()=>{WTN("You open the door, there is a long and dark hallway illuminated with candles.").then(()=>{WTN("There is a trail of blood on the floor, you follow it.").then(()=>{WTN("You reach a locked door.").then(()=>{WTO("> [Z] to try breaking the door using your hammer").then(()=>{WTO("> [X] to try to pick the door lock").then(()=>{document.body.onkeydown=function(a){"z"==a.key&&WTS("Tries to break the door using hammer...").then(()=>{document.body.onkeydown=null,section4_1()}),"x"==a.key&&WTS("Tries to pick the door lock...").then(()=>{document.body.onkeydown=null,section5_1()})}})})})})})})}function section4_1(){WTN(".").then(()=>{WTN("You start hitting the door with your hammer but you hit your thumb instead.").then(()=>{WTN("You scream loudly.").then(()=>{WTN("You hear a walking sound from behind. It sounds like a spider-like creature.").then(()=>{WTN("The last thing you see is the sharp claws of the creature...").then(()=>{WTN(".").then(()=>{WTL("You died.").then(()=>{WTO("> [R] to restart").then(()=>{document.body.onkeydown=function(a){"r"==a.key&&(document.body.onkeydown=null,gameWindow.innerHTML="",loadGame())}})})})})})})})})}function section5_1(){WTN(".").then(()=>{WTN("You successfully pick the door lock and enter the room.").then(()=>{WTN('You see a man hanging upside down from the ceiling. He tells you: "Do not get close..!"').then(()=>{WTO("> [Z] to help the man").then(()=>{WTO("> [X] to hide behind the door").then(()=>{document.body.onkeydown=function(a){"z"==a.key&&WTS("Walks close to the man...").then(()=>{document.body.onkeydown=null,section6_1()}),"x"==a.key&&WTS("Hides behind the door...").then(()=>{document.body.onkeydown=null,section6_2()})}})})})})})}function section6_1(){WTN(".").then(()=>{WTN("You try to cut the rope to free the man.").then(()=>{WTN("He keeps telling you to run away, but you ignore him.").then(()=>{WTN("The last thing you hear is the sound of a giant creature behind you...").then(()=>{WTN(".").then(()=>{WTL("You died.").then(()=>{WTO("> [R] to restart").then(()=>{document.body.onkeydown=function(a){"r"==a.key&&(document.body.onkeydown=null,gameWindow.innerHTML="",loadGame())}})})})})})})})}function section6_2(){WTN(".").then(()=>{WTN("You hear the sound of a creature coming towards the room.").then(()=>{WTN("The monster enters the room, it has spider-like legs with big claws as it's hands.").then(()=>{WTN("You stab it multiple times from the back using your hammer.").then(()=>{WTN("It screams in terror and dies by bleeding on the floor.").then(()=>{WTN(".").then(()=>{WTS("You beat the creature.").then(()=>{WTO("> [R] to restart").then(()=>{document.body.onkeydown=function(a){"r"==a.key&&(document.body.onkeydown=null,gameWindow.innerHTML="",loadGame())}})})})})})})})})}loadGame()