• Rewind
  • Restart
  • Bookmark
  • This story was created with Twine and is powered by TiddlyWiki
[[krowbar-start]]
try {\n var gVars = state.history[0].variables;\n gVars.items = {};\n gVars.items['gold'] = 0;\n gVars.events = {};\n gVars.stats = {};\n gVars.stats['health'] = 10;\n gVars.stats['health_max'] = 10;\n gVars.stats['strength'] = 1;\n gVars.skills = {};\n gVars.skills['adventuring'] = 2;\n} catch(e) {\n console.log("Error during Globals setup: " + e.message);\n}
<<if visited("krowbar-start") is 1>>Welcome to the adventure!<<endif>>\nThere is a door on the wall.\n<<if not visited("Get McGuffin")>>You see a McGuffin<<endif>>\n<<if not visited("Get Coins")>>You see a few coins on the floor<<endif>>\n<<actions "Get McGuffin" "Get Coins">>\s\n<<if $items['McGuffin'] is true>><<actions "Use McGuffin on door">><<endif>>\s\n<<if visited("Use McGuffin on door")>>[[Go through door|Room2]]<<endif>>\n[[PlayerProfile]]
You pick up the McGuffin.\n<<set $items['McGuffin'] to true>>\n[[Return|previous()]]
You pick up the coins.\n<<set $items['gold'] += 3>>\n[[Return|previous()]]
You use the McGuffin on the door.\nThe McGuffin crumbles and the door opens.\n<<set $items['McGuffin'] to false>>\n[[Return|previous()]]
This is room2. There is a cake on the ground.\nThe door ahead is blocked.\n<<actions "Eat cake">>\n<<if $stats['strength'] gte 3>>[[Break through the door|Room3]]\n<<else>>You are not strong enough to break this door.<<endif>>
You feel incredibly stronger!\nStrength increased to <<$stats['strength'] += 3>>\n[[Return|previous()]]
Seriously, nothing here.\nReturn to [[the start|Start]]
<br>\n<strong>Inventory:</strong>\n<<Inventory>>
try {\n version.extensions['Inventory'] = {\n major:0, minor:1, revision:0\n };\n macros['Inventory'] =\n {\n handler: function(place, macroName, params, parser)\n {\n var msg = "";\n var items = state.history[0].variables.items;\n if (items == undefined) {\n new Wikifier(place, "nothing");\n return;\n }\n for(var name in items) {\n if(!isNaN(parseFloat(items[name])) && isFinite(items[name])) {\n msg += name + "(" + items[name] + "), ";\n }\n else if(items[name] != false) {\n msg += name + ", ";\n }\n };\n new Wikifier(place, msg.slice(0,-2));\n },\n init: function() { },\n };\n} catch(e) {\n throwError(place,"Inventory Setup Error: " + e.message);\n}
<br>\n<strong>Player Stats:</strong>\n<<PlayerStats>>
try {\n version.extensions['PlayerStats'] = {\n major:0, minor:1, revision:0\n };\n macros['PlayerStats'] =\n {\n handler: function(place, macroName, params, parser)\n {\n var msg = "";\n var stats = state.history[0].variables.stats;\n if (stats == undefined) {\n new Wikifier(place, "no stats");\n return;\n }\n for(var stat in stats) {\n if(stat.slice(-4) == "_max") {\n continue;\n }\n msg += stat + ": " + stats[stat];\n if(stats[stat+"_max"] != undefined) {\n msg += " / " + stats[stat+"_max"];\n }\n msg += "<br>";\n }\n new Wikifier(place, msg);\n },\n init: function() { },\n };\n} catch(e) {\n throwError(place,"PlayerStats Setup Error: " + e.message);\n}
<br>\n<strong>Player Skills:</strong>\n<<PlayerSkills>>
try {\n version.extensions['PlayerSkills'] = {\n major:0, minor:1, revision:0\n };\n macros['PlayerSkills'] =\n {\n handler: function(place, macroName, params, parser)\n {\n var msg = "";\n var stats = state.history[0].variables.skills;\n if (stats == undefined) {\n new Wikifier(place, "no skills");\n return;\n }\n for(var stat in stats) {\n msg += stat + ": " + stats[stat]+"<br>";\n }\n new Wikifier(place, msg);\n },\n init: function() { },\n };\n} catch(e) {\n throwError(place,"PlayerSkills Setup Error: " + e.message);\n}
[[Return|previous()]]\n-~-~-~-~-~-\n<<display PlayerStats>>\n<<display PlayerSkills>>\n<<display Inventory>>
postrender.tagInventory = function(place) {\n var inv = tale.get("Inventory");\n if (inv.id !== undefined && ~this.tags.indexOf("inv")) {\n new Wikifier(place, inv.processText());\n };\n var stats = tale.get("PlayerStats");\n if(stats.id !== undefined && ~this.tags.indexOf("stats")) {\n new Wikifier(place, stats.processText());\n };\n var skills = tale.get("PlayerSkills");\n if(skills.id !== undefined && ~this.tags.indexOf("skills")) {\n new Wikifier(place, skills.processText());\n };\n}