Revision of Twine macro: << replace >> and << endreplace >> from Fri, 02/15/2013 - 00:58

What this macro does is create an internal link that, when clicked, vanishes and is replaced with whatever is between the << replace >> and << endreplace >> tags. This could be useful if (just for starters) you want to have a passage that can be modified by clicking specific details inside it.

Copy the code in here: http://www.glorioustrainwrecks.com/files/TwineMacro-Replace.txt

Here is a usage example: You see <<replace "a half-eaten cake">>a plate of crumbs<<endreplace>>

A short example program.

Some notes:
* Code inside << replace >> tags is only executed when you click the link. You may notice that the "mailbox" link in the example program produces different text if you click the "front door" link first.
* Note: due to the way the browser and Twine interact, any changes made by code inside a <<replace>> tag will be forgotten if you use the Back or Forward browser buttons. This means that if you put long-term variable changes that affect future passages inside one, you should disable the Back button.
* For those writing CSS: the <a> tag of the link has the class names "internalLink" and "replaceLink". It is immediately followed with a <span> tag with a class name of "replacement" and the style "display:none". Clicking the link removes the link, changes the span's display style to "inline", and sets it to fade in.

AttachmentSize
TwineMacro-ReplaceTest.html186.33 KB
TwineMacro-Replace.txt1.56 KB
pensive-mosquitoes