1 Answer

WARNING: I strongly suggest anyone using any of the default Twine 1.4.2 story formats (generally called the Vanilla formats) to switch over to using one of the SugarCube (preferably 2.x but 1.x if necessary) instead.

The reason I strongly suggest this is because the Vanilla formats haven't been updated since mid 2014, and they contain known bugs as well as code that is no longer fully compatible with Modern web-browsers.

I believe that the PassageReady special passage only relates to the SugarCube story format, and isn't a feature of the Sugarcane story format.

By default conditional based code (like <<if>> macros) within either a Standard Passage or a Special Passage (like PassageReady) only gets executed during the process (known as Passage Rendering) that displays the contents of a Passage. This means that changing the value of a variable after that process has finished will not automatically cause the conditional based code to be executed again.

So if your variable changing event based code is executed either before or during the Passage Rendering process then code within either the Passage (or the PassageReady special passage) will be effected by it, however if that event based code is executed after the Passage Rendering process then it will not effect the conditional based code.

Similarly if your variable changing links cause a passage transition (moving for one Passage to another) then then any conditional based code within the next Passage (or a related PassageReady special passage) will be effected, if on the other hand the link does not cause a passage transition then the conditional based code within the current passage (or a related PassageReady special passage) will not be effected.

If you continue to use Sugarcane then you could replace the existing <<set>> macros that are decreasing the value of $counter with a customer macro that does that decreasing for you. This custom macro could also check the variable's resulting value and redirect the player to the randomly chosen Passage as required.NOTE: you would employ the same technique if you were using SugarCube.

So the question to you is will you be staying with Sugarcane or migrating to SugarCube? and if to SugarCube then which series (2.x or 1.x)?

I ask so that I don't have to create three different examples of the relevant customer macro.

I just migrated to SugarCube has you suggested (I prefer Twine 1 because I want to embed sounds and images in html without referring to an external link as in Twine 2).

Thank you for your explanation about the passage rendering, the way the conditional macros are affected could be ok for my needs. I just need to send the player to a passage if he dies (or goes insane).

NOTES:1. As explained in this documentation the HTML font element is obsolete and shouldn't be used.2. Generally there shouldn't be space characters between an element attribute name and the equals sign, nor between the equals sign and the value.3. You don't need to use the <<print>> macro to output the value of a variable if the reference to that variable is simple.

I tested the following passage content within Chrome on Windows 10 and the health label & $counter value appeared correctly

<font color="red">''health'' <<print $counter>></font>

There are a number of ways to achieve the same styling without using the obsolete font element, the following is one of them:

Any ideas on how to force player to a certain passage (i.e. "death") if the variable goes below a certain value?

Now I switched to Twine 2, Sugarcube v2.21.0 (sorry for the change but this story will be a downloadable Android app and it seems that it is better to store images in a separate folder inside the app).

Place this code in a passage named "PassageHeader". This means it will be run every time a passage is loaded. You can have as many bad ends and different variables as you like. I suggest placing new lines after each <</if>> and tagging the passage with the nobr special tag.