I've been using the standard link replace which I love once I got the hang of it. But I was wondering how I could go about modifying the contents of an element during render.
What I mean is say I'm hoping to accomplish something like the following:
<p>This is just a simplified example of the coding scenario.</p>
<p id="action-text"></p>
Select an option:
<hr style="padding:0px; margin:0px" />
<br />
<ul style="padding-top:0px; margin-top:0px">
<<if random(1) eq 0>>
<<replace "#action-text">>
Hello World!
<</replace>>
<<else>>
<<replace "#action-text">>
Goodbye World!
<</replace>>
<</if>>
<li>
<<link "Brush your teeth (0:05)">>
<<replace "#action-text">>
scrub scrub scrub
<</replace>>
<<addmins 5>>
<</link>>
</li>
</ul>
However I understand that won't work because the macros will be processed before the html is rendered. I saw in the manual the task objects and a postrender which I'm assuming is something I would need to use in a situation like this. But I'm not sure where to start.
Any suggestions, dumbed down examples, or general hand holding would be appreciated.
Edit:
I just came across
twinery.org/forum/discussion/comment/15366/#Comment_15366. I'm not sure how crazy the situation still is, but what I'm hoping to accomplish is to group together like content, in this case content that takes place in a single room for ease of organization and updating. It doesn't feel like it would make sense to use a link replace and I was trying to keep the html generic with replaces to keep the code from bloating or being overly complicated.
In my current layout I have a set place where text is displayed to the player and I'd like to keep re-using it if possible so long as the player is in that passage.
Comments
For now it's not really an issue. I just hope it doesn't become one down the road.
For example:
Anything option to consider is the <<include>> macro:
This will take the contents of RandomPassage and insert it into the action-text.