try { macros['randomp'] = { \n\n handler: function(place,macroName,params,parser) {\n var state = 0;\n var passageflag = false;\n var chance = 100;\n var r = Math.random() * 100;\n \n for(var i = 0; i < params.length; i++) {\n switch(state) {\n case 0:\n if(params[i] == 'passage') {\n passageflag = true;\n state = 1;\n break;\n }\n //No break !!! fall through if keyword 'passage' is not used\n \n case 1:\n chance -= params[i];\n state = 2;\n break;\n \n case 2:\n if(r >= chance) {\n if(passageflag) macros.display.handler(place,macroName,[ params[i] ]); \n else new Wikifier(place, params[i]);\n return;\n }\n state = 0;\n break;\n }\n }\n },\n\n init: function() { }\n \n};} catch(e) { \n throwError(place,"Macro Randomp Error: "+e.message); \n}
There's a certain appeal to the unknown, a thrill in not being able to predict your future. The boredom of stability replaced completely by the excitement of danger. That is what you want.\n\nThat is what you thought you wanted, anyway, when you left home. Now, you're not so sure. The drabness of predictability might be a small sacrifice for a good night's sleep and a warm bed. \n\nConcerns of comfort and boredom aren't your biggest concern, though. At this point, you're not even sure where you are. The fog that descended upon you sometime in the night and is obscuring [[everything]]. Where did you decide to sleep last night? That knowledge is not within your grasp currently.\n\nAll you know is that it's been days since you've seen<<replace " a friendly face.">> anyone at all. \n\n<<timedinsert 1s>> <<becomes>>It's all a bit of a blur, really.<<endtimedinsert>><<endreplace>>
Wikifier.formatters.push({name:"char",match:".",handler:function(a){insertElement(a.output,"span",null,"char",a.matchText);\n}});Wikifier.formatters.forEach(function(e){if(e.name=="emdash"){e.handler=function(a){var b=insertElement(a.output,"span",null,"char",String.fromCharCode(8212));\n};}else{if(e.name=="prettyLink"){e.handler=function(a){var b=new RegExp(e.lookahead,"mg");\nb.lastIndex=a.matchStart;var c=b.exec(a.source);if(c&&c.index==a.matchStart&&c[2]){var d=Wikifier.createInternalLink(a.output,c[1]);\nsetPageElement(d,null,c[1]);a.nextMatch+=c[1].length+2;}else{if(c&&c.index==a.matchStart&&c[3]){var f;\nif(tale.has(c[4])){f=Wikifier.createInternalLink(a.output,c[4]);}else{f=Wikifier.createExternalLink(a.output,c[4]);\n}setPageElement(f,null,c[1]);a.nextMatch=c.index+c[0].length;}}};}}});\n\n(function(){version.extensions["replaceMacrosCombined"]={major:1,minor:0,revision:0};\nvar nullobj={handler:function(){}};function showVer(n,notrans){n.innerHTML="";\nnew Wikifier(n,n.tweecode);n.setAttribute("data-enabled","true");\nn.style.display="inline";n.classList.remove("revision-span-out");\nif(!notrans){n.classList.add("revision-span-in");if(n.timeout){clearTimeout(n.timeout)\n}n.timeout=setTimeout(function(){n.classList.remove("revision-span-in")\n},1)}}function hideVer(n,notrans){n.setAttribute("data-enabled","false");\nn.classList.remove("revision-span-in");if(n.timeout){clearTimeout(n.timeout)\n}if(!notrans){n.classList.add("revision-span-out");n.timeout=setTimeout(function(){if(n.getAttribute("data-enabled")=="false"){n.classList.remove("revision-span-out");\nn.style.display="none";n.innerHTML=""}},1000)}else{n.style.display="none";\nn.innerHTML=""}}function tagcontents(b,starttags,desttags,endtags,k){var l=0,c="",tg,a,i;\nfunction tagfound(i,e){for(var j=0;j<e.length;j++){if(a.indexOf("<<"+e[j],i)==i){return e[j]\n}}}a=b.source.slice(k);for(i=0;i<a.length;i++){if(tg=tagfound(i,starttags)){l++\n}else{if((tg=tagfound(i,desttags))&&l==0){b.nextMatch=k+i+tg.length+4;\nreturn[c,tg]}else{if(tg=tagfound(i,endtags)){l--;if(l<0){return null\n}}}}c+=a.charAt(i)}return null}var begintags=[];var endtags=[];\nfunction revisionSpanHandler(g,e,f,b){var k=b.source.indexOf(">>",b.matchStart)+2,vsns=[],vtype=e,flen=f.length,becomes,c,cn,m,h,vsn;\nfunction mkspan(vtype){h=insertElement(m,"span",null,"revision-span "+vtype);\nh.setAttribute("data-enabled",false);h.style.display="none";h.tweecode="";\nreturn h}if(this.shorthand&&flen){while(f.length>0){vsns.push([f.shift(),(this.flavour=="insert"?"gains":"becomes")])\n}}else{if(this.flavour=="insert"||(this.flavour=="continue"&&this.trigger=="time")){vsns.push(["","becomes"])\n}}if(this.flavour=="continue"&&flen){b.nextMatch=k+b.source.slice(k).length;\nvsns.push([b.source.slice(k),vtype])}else{becomes=["becomes","gains"];\nc=tagcontents(b,begintags,becomes.concat(endtags),endtags,k);\nif(c&&endtags.indexOf(c[1])==-1){while(c){vsns.push(c);c=tagcontents(b,begintags,becomes,endtags,b.nextMatch)\n}c=tagcontents(b,begintags,["end"+e],endtags,b.nextMatch)}if(!c){throwError(g,"can't find matching end"+e);\nreturn}vsns.push(c);if(this.flavour=="continue"){k=b.nextMatch;\nb.nextMatch=k+b.source.slice(k).length;vsns.push([b.source.slice(k),""])\n}}if(this.flavour=="remove"){vsns.push(["","becomes"])}console.log(JSON.stringify(vsns));\ncn=0;m=insertElement(g,"span",null,e);m.setAttribute("data-flavour",this.flavour);\nh=mkspan("initial");vsn=vsns.shift();console.log(e+" "+vsn[0]);\nh.tweecode=vsn[0];showVer(h,true);while(vsns.length>0){if(vsn){vtype=vsn[1]\n}vsn=vsns.shift();h=mkspan(vtype);h.tweecode=vsn[0]}if(typeof this.setup=="function"){this.setup(m,g,f)\n}}function quantity(m){return(m.children.length-1)+(m.getAttribute("data-flavour")=="remove")\n}function revisionSetup(m,g,f){m.className+=" "+f[0].replace(" ","_");\nshowVer(m.firstChild,true)}function timeSetup(m,g,f){function cssTimeUnit(s){if(typeof s=="string"){if(s.slice(-2).toLowerCase()=="ms"){return Number(s.slice(0,-2))||0\n}else{if(s.slice(-1).toLowerCase()=="s"){return Number(s.slice(0,-1))*1000||0\n}}}throwError(g,s+" isn't a CSS time unit");return 0}var fl=this.flavour;\nvar tm=cssTimeUnit(f[0]);setTimeout(function timefn(){var done=!revise("revise",m);\nif(!done){setTimeout(timefn,tm)}},tm)}function hoverSetup(m){m.onmouseover=function(){revise("revise",m)\n};m.onmouseout=function(){revise("revert",m)}}function mouseSetup(m){var fl=this.flavour;\nm.onmouseenter=function(){var done=!revise("revise",m);if(done){this.onmouseenter=null\n}}}function linkSetup(m,g,f){var fl=this.flavour,l=Wikifier.createInternalLink(),p=m.parentNode;\nl.className="internalLink replaceLink";p.insertBefore(l,m);l.insertBefore(m,null);\nl.onclick=function(){var p,done=false;if(m&&m.parentNode==this){done=!revise("revise",m);\nscrollWindowTo(m)}if(done){this.parentNode.insertBefore(m,this);\nthis.parentNode.removeChild(this)}}}function visitedSetup(m,g,f){var i,done,shv=state.history[0].variables,os="once seen",d=(m.firstChild&&(this.flavour=="insert"?m.firstChild.nextSibling:m.firstChild).tweecode);\nshv[os]=shv[os]||{};if(d&&!shv[os].hasOwnProperty(d)){shv[os][d]=1\n}else{for(i=shv[os][d];i>0&&!done;i--){done=!revise("revise",m,true)\n}if(shv[os].hasOwnProperty(d)){shv[os][d]+=1}}}[{name:"insert",flavour:"insert",trigger:"link",setup:linkSetup},{name:"timedinsert",flavour:"insert",trigger:"time",setup:timeSetup},{name:"insertion",flavour:"insert",trigger:"revisemacro",setup:revisionSetup},{name:"later",flavour:"insert",trigger:"visited",setup:visitedSetup},{name:"replace",flavour:"replace",trigger:"link",setup:linkSetup},{name:"timedreplace",flavour:"replace",trigger:"time",setup:timeSetup},{name:"mousereplace",flavour:"replace",trigger:"mouse",setup:mouseSetup},{name:"hoverreplace",flavour:"replace",trigger:"hover",setup:hoverSetup},{name:"revision",flavour:"replace",trigger:"revisemacro",setup:revisionSetup},{name:"timedremove",flavour:"remove",trigger:"time",setup:timeSetup},{name:"mouseremove",flavour:"remove",trigger:"mouse",setup:mouseSetup},{name:"hoverremove",flavour:"remove",trigger:"hover",setup:hoverSetup},{name:"removal",flavour:"remove",trigger:"revisemacro",setup:revisionSetup},{name:"once",flavour:"remove",trigger:"visited",setup:visitedSetup},{name:"continue",flavour:"continue",trigger:"link",setup:linkSetup},{name:"timedcontinue",flavour:"continue",trigger:"time",setup:timeSetup},{name:"mousecontinue",flavour:"continue",trigger:"mouse",setup:mouseSetup},{name:"cycle",flavour:"cycle",trigger:"revisemacro",setup:revisionSetup},{name:"mousecycle",flavour:"cycle",trigger:"mouse",setup:mouseSetup},{name:"timedcycle",flavour:"cycle",trigger:"time",setup:timeSetup}].forEach(function(e){e.handler=revisionSpanHandler;\ne.shorthand=(["link","mouse","hover"].indexOf(e.trigger)>-1);\nmacros[e.name]=e;macros["end"+e.name]=nullobj;begintags.push(e.name);\nendtags.push("end"+e.name)});function reviseAll(rt,rname){var rall=document.querySelectorAll(".passage ."+rname),ret=false;\nfor(var i=0;i<rall.length;i++){ret=ret||revise(rt,rall[i])}return ret\n}function revise(rt,r,notrans){var ind2,curr,next,ind=-1,rev=(rt=="revert"),rnd=(rt.indexOf("random")>-1),fl=r.getAttribute("data-flavour"),rc=r.childNodes,cyc=(fl=="cycle"),rcl=rc.length-1;\nfunction doToGainerSpans(n,fn){for(var k=n-1;k>=0;k--){if(rc[k+1].classList.contains("gains")){fn(rc[k],notrans)\n}else{break}}}for(var k=0;k<=rcl;k++){if(rc[k].getAttribute("data-enabled")=="true"){ind=k\n}}if(rev){ind-=1}curr=(ind>=0?rc[ind]:(cyc?rc[rcl]:null));ind2=ind;\nif(rnd){ind2=(ind+(Math.floor(Math.random()*rcl)))%rcl}next=((ind2<rcl)?rc[ind2+1]:(cyc?rc[0]:null));\nvar docurr=(rev?showVer:hideVer);var donext=(rev?hideVer:showVer);\nif(curr){if(!(next&&next.classList.contains("gains"))||rnd){docurr(curr,notrans);\ndoToGainerSpans(ind,docurr,notrans)}}if(next){donext(next,notrans);\nif(rnd){doToGainerSpans(ind2+1,donext,notrans)}}return(cyc?true:(rev?(ind>0):(ind2<rcl-1)))\n}macros["revert"]=macros["revise"]=macros["randomise"]=macros["randomize"]={handler:function(a,b,c){var l,rev,rname;\nfunction disableLink(l){l.style.display="none"}function enableLink(l){l.style.display="inline"\n}function updateLink(l){if(l.className.indexOf("random")>-1){enableLink(l);\nreturn}var rall=document.querySelectorAll(".passage ."+rname),cannext,canprev,i,ind,r,fl;\nfor(i=0;i<rall.length;i++){r=rall[i],fl=r.getAttribute("data-flavour");\nif(fl=="cycle"){cannext=canprev=true}else{if(r.firstChild.getAttribute("data-enabled")==!1+""){canprev=true\n}if(r.lastChild.getAttribute("data-enabled")==!1+""){cannext=true\n}}}var can=(l.classList.contains("revert")?canprev:cannext);(can?enableLink:disableLink)(l)\n}function toggleText(w){w.classList.toggle(rl+"Enabled");w.classList.toggle(rl+"Disabled");\nw.style.display=((w.style.display=="none")?"inline":"none")}var rl="reviseLink";\nif(c.length<2){throwError(a,b+" macro needs 2 parameters");return\n}rname=c.shift().replace(" ","_");l=Wikifier.createInternalLink(a,null);\nl.className="internalLink "+rl+" "+rl+"_"+rname+" "+b;var v="";\nvar end=false;var out=false;if(c.length>1&&c[0][0]=="$"){v=c[0].slice(1);\nc.shift()}switch(c[c.length-1]){case"end":end=true;c.pop();break;\ncase"out":out=true;c.pop();break}var h=state.history[0].variables;\nfor(var i=0;i<c.length;i++){var on=(i==Math.max(c.indexOf(h[v]),0));\nvar d=insertElement(null,"span",null,rl+((on)?"En":"Dis")+"abled");\nif(on){h[v]=c[i];l.setAttribute("data-cycle",i)}else{d.style.display="none"\n}insertText(d,c[i]);l.appendChild(d)}l.onclick=function(){reviseAll(b,rname);\nvar t=this.childNodes,u=this.getAttribute("data-cycle")-0,m=t.length,n,lall,i;\nif((end||out)&&u==m-(end?2:1)){if(end){n=this.removeChild(t[u+1]);\nn.className=rl+"End";n.style.display="inline";this.parentNode.replaceChild(n,this)\n}else{this.parentNode.removeChild(this);return}}else{toggleText(t[u]);\nu=(u+1)%m;if(v){h[v]=c[u]}toggleText(t[u]);this.setAttribute("data-cycle",u)\n}lall=document.getElementsByClassName(rl+"_"+rname);for(i=0;i<lall.length;\ni++){updateLink(lall[i])}};disableLink(l);setTimeout(function(){updateLink(l)\n},1)}};macros["mouserevise"]=macros["hoverrevise"]={handler:function(a,b,c,d){var endtags=["end"+b];\nvar t=tagcontents(d,[b],endtags,endtags,d.source.indexOf(">>",d.matchStart)+2);\nif(t){var rname=c[0].replace(" ","_"),h=insertElement(a,"span",null,"hoverrevise hoverrevise_"+rname),f=function(){var done=!reviseAll("revise",rname);\nif(b!="hoverrevise"&&done){this.onmouseenter=null}};new Wikifier(h,t[0]);\nif(b=="hoverrevise"){h.onmouseover=f;h.onmouseout=function(){reviseAll("revert",rname)\n}}else{h.onmouseenter=f}}}};macros["endmouserevise"]=nullobj;\nmacros["endhoverrevise"]=nullobj}());
<<revision closer>><<timedcycle .5s>><<randomp 4 "a" 3 "b" 4 "c" 4 "d" 4 "e" 3 "f" 4 "g" 4 "h" 3 "i" 4 "j" 4 "k" 4 "l" 4 "m" 4 "n" 4 "o" 4 "p" 3 "q" 4 "r" 4 "s" 4 "t" 4 "u" 4 "v" 4 "w" 4 "x" 4 "y" 4 "z">><<endtimedcycle>> <<becomes>> text<<endrevision>>\n\n<<revise closer "Look closer">>\n
The Ruins
You stand in the center of the ruins. The fog is making it hard to see anything, but you can see some letters <<revision closer>>that read <<timedcycle .5s>><<randomp 4 "a" 3 "b" 4 "c" 4 "d" 4 "e" 3 "f" 4 "g" 4 "h" 3 "i" 4 "j" 4 "k" 4 "l" 4 "m" 4 "n" 4 "o" 4 "p" 3 "q" 4 "r" 4 "s" 4 "t" 4 "u" 4 "v" 4 "w" 4 "x" 4 "y" 4 "z">><<randomp 4 "a" 3 "b" 4 "c" 4 "d" 4 "e" 3 "f" 4 "g" 4 "h" 3 "i" 4 "j" 4 "k" 4 "l" 4 "m" 4 "n" 4 "o" 4 "p" 3 "q" 4 "r" 4 "s" 4 "t" 4 "u" 4 "v" 4 "w" 4 "x" 4 "y" 4 "z">><<randomp 4 "a" 3 "b" 4 "c" 4 "d" 4 "e" 3 "f" 4 "g" 4 "h" 3 "i" 4 "j" 4 "k" 4 "l" 4 "m" 4 "n" 4 "o" 4 "p" 3 "q" 4 "r" 4 "s" 4 "t" 4 "u" 4 "v" 4 "w" 4 "x" 4 "y" 4 "z">><<randomp 4 "a" 3 "b" 4 "c" 4 "d" 4 "e" 3 "f" 4 "g" 4 "h" 3 "i" 4 "j" 4 "k" 4 "l" 4 "m" 4 "n" 4 "o" 4 "p" 3 "q" 4 "r" 4 "s" 4 "t" 4 "u" 4 "v" 4 "w" 4 "x" 4 "y" 4 "z">><<endtimedcycle>> <<becomes>>in some ancient script that you can't make out.<<endrevision>>\n\n<<revise closer "Look closer">>
.revision-span-in {\n opacity: 0;\n}\n.revision-span:not(.revision-span-out) {\n transition: .5s; -webkit-transition: .5s;\n}\n.revision-span-out {\n position:absolute;\n opacity: 0;\n}\n\n#passages {font-family:"Courier New", monospace} \n\n#share, #credits { display: none !important; }\n.passage {\n color:rgba(0,0,0,0) !important;\n text-shadow: #bbb 0 0 0.05em, #bbb 0 0 1em;\n}\n#passages {\n border-left: 0;\n border-left: 0;\n margin-left: 18em;\n margin-top: 6em;\n}\nhtml {\n height:100%;\n height:100vh;\n}\nbody {\n font-size: 0.9em;\n background-repeat: no-repeat;\n background-image: -webkit-linear-gradient(top, #000000 0%,#353535 57%,#1e1e1e 64%,#000000 100%);\n background-image: linear-gradient(to bottom, #000000 0%,#353535 57%,#1e1e1e 64%,#000000 100%);\n}\na.internalLink, a.externalLink {\n color:rgba(0,0,0,0);\n text-shadow: silver 0 0 1em, silver 0 0 1em;\n-webkit-transition: 1s ease-in; \ntransition: 1s ease-in; \n}\na.internalLink:hover, a.externalLink:hover {\n color:rgba(255,255,255,0.5) !important;\n text-shadow: silver 0 0 0.3em, silver 0 0 1em;\n text-decoration:none;\n}\n#sidebar {\n top:0;\n left:0;\n padding-top: 4.2em;\n padding-left: 4.2em;\n width: 16em;\n height: 100%;\n background-image: -webkit-linear-gradient(left, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%);\n background-image: linear-gradient(to right, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%);\n}\n#sidebar, #sidebar #title, #sidebar a {\n color: rgba(0,0,0,0);\n text-shadow: #555 0 0 0.1em, #555 0 0 1em !important;\n}\n#sidebar #title:hover, #sidebar a.hover, #sidebar li:hover {\n color:rgba(255,255,255,0.25) !important;\n}\n#sidebar li {\n text-align: left;\n}\n@media screen and (max-width: 960px) {\n body {\n font-size: 0.8em;\n }\n #sidebar {\n padding-top: 3em;\n padding-left: 3em;\n width: 9em;\n }\n #passages {\n margin-left: 15em;\n }\n}\n@media screen and (max-width: 640px) {\n body {\n font-size: 0.8em;\n }\n #sidebar, #sidebar:hover {\n width: 100%;\n height: 6em;\n padding: 2em 1em 2em 2em;\n text-align:center;\n background-image: -webkit-linear-gradient(top, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%);\n background-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%);\n }\n #sidebar li { display:inline; margin-right: 2em; }\n #passages {\n margin: 14em 0 0 0em;\n }\n}