Silly Parser Demo

Here's a silly parser game. Feel free use it as a demo.

[[1]]:
@clear
<!---------Javascript and HTML three-word parser--------->
window.myFunction = function() {
  var prepthing = document.getElementById("prepthing").value;
  var prep = prepthing.split(" ")[0];
  var the = prepthing.split(" ")[1];
  var thing = prepthing.split(" ")[2];
  document.getElementById("prep").innerHTML = prep;
  document.getElementById("the").innerHTML = the;
  document.getElementById("thing").innerHTML = thing;
  squiffy.set("prep", prep);
  squiffy.set("the", the);
  squiffy.set("thing", thing);
};

<meta id="prep"></meta> <meta id="the"></meta> <meta id="thing"></meta>

<!---------Easy way to create styles, if you don't like CSS--------->
@set style=<div style="background-color:black; background-size: 300px 100px; color:white; font-family:comic sans MS; border:5px outset red;">
@set ug=<span style="text-decoration:underline; color:green;">
@set ur=<span style="text-decoration:underline; color:red;">
@set uo=<span style="text-decoration:underline; color:orange;">

{style}<img src="https://cdn.stocksnap.io/img-thumbs/960w/antique-bathroom_NLS7MTPBNY.jpg" alt="bathroom" width="500" height="600">

<!---------The game begins here.--------->
You are locked in the bathroom. There's a toilet, a tub, {if cake:and a door. You have a cake.}{else:a door, and a cake.}

You can look <input id="prepthing" onchange="myFunction()" name="prepthing"> {if end:[{ug}[Do it!]](dead)}{else:[[{ug}Do it!]](1, started)}

<!---------Resolve the word "the"--------->
{if thing:{@thing=@the}{@the=the}}
{if started:&gt;You look {prep} {the} {if thing=true:}{else:{thing}}.}

<!---------How Squiffy can parse commands--------->
{if thing=toilet: There's poop and a key in the toilet. {if gloves:You put on the gloves and take the key.{@key}}}

{if thing=tub: There's a box in the tub.}

{if thing=door:{if key:You open the door. There's a crazy woman. She points a gun at you{@end}.}{else:The door is locked.} {if key:{if cake:You quickly throw the cake at the crazy woman. Some gets in her mouth. She closes her eyes and falls down. <br><center>**You win!**</center>}}}

{if thing=cake: You can't [[{ur}have]](1, cake) your cake and [[{uo}eat]](eat the cake) it, too.}

{if thing=key:{if gloves:You put on the gloves and take the key.{@key}}{else:Haha! You touched poop! But You can't take the key. It's too yucky.}}

{if thing=box: The small box is locked. {if prep=under:There are gloves under the box.{@gloves}}{if prep=on:There's nothing on the box.}{if prep=next to:There is nothing next to the box.}}

{if thing=gloves:You put on the gloves.{@gloves}}

[Do it!]:
@clear
    squiffy.story.go("1")


[[eat the cake]]:
@clear
{style}You eat the cake. You feel sleepy. You close your eyes.

<center>**You died!**</center>

[[have the cake]]:
{@cake}
You pick up the cake.

[[dead]]:
@clear

{style}She shoots you.

<center>**You died!**</center>

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums