Hi, i'm having a problem that i don't know how to solve.
I am using sugarcube and i can't seem to convince it to refresh data immediately.
I have a passage with this in:
<span id="stats"><<display statspage>></span>
<span id="event"><<display forestevent>></span>
<<click "Explore Again">><<replace "#event">><<display forestevent>><</replace>><<replace "#stats">><<display statspage>><</replace>><</click>>
[[navigate]] [[debug]]
When this area is entered, it displays the stats at the top of the page (which is where i want them) and then causes a random event to happen. Unfortunately, the stats are before the event, and the event changes the stats, thus outdating them immediately. I have tried sticking a <<replace "#stats">><<display statspage>><</replace> in multiple locations, but it keeps telling me it is unable to find
#stats.
The "Explore Again" button, however, works as intended. It causes the events first before it replaces the stats. I don't understand why the Explore Again option updates the stats but the same code in the initial encounter can't.
I uploaded the file to dropbox if you want to take a look:
https://dl.dropboxusercontent.com/u/75787850/Adventure.html
What am i doing wrong?
Is there an easier way to do this?
Comments
The reason it works when you place it within a <<click>> or <<button>> macro is because by the time the player is able to click on them, the target elements are on the page.
Try placing something like the following in the PassageDone special passage: Also, note that I quoted the name of the passage there—you should be too.