You can do that, right? Can't find it in the wiki, but I'm sure I read about it somewhere. To be clear, I want to refresh a passage after changing some variables when a <<replace>> link is clicked. Because it's in a <<replace>> I don't think I can link back to the passage normally... I guess <<timedgoto>> might work... but is there an existing tidy solution, something like <<passageupdate>>?
Thanks for reading!
Comments
If there's a better way to do it than reloading the entire page or using jQuery to rewrite the innerHTML of specific IDs, I'd be interested to know, because I've had to code my way around a lot of issues that come from having to use state.display().
But it doesn't. It says you have 1 every time. Am I misunderstanding what this does?
As for Sugarcube, Thomas and I briefly spoke about this issue here and he seemed to be indicating to me that either targeting divs with jQuery or reloading the passage entirely with state.diplay("Passage", null, "back") was the way to go. If he made a macro he didn't bring it up.
1. By redisplaying the entire passage using a little JavaScript, via state.display().
An example passage: ($carrots was previously initialized elsewhere) What the third parameter to state.display(), "back", actually means is: display the given passage without altering the state history (i.e. just display the given passage).
2. By using two passages with <<display>> and <<replace>>. (I'm referring to SugarCube's <<replace>> macro here, not Leon's)
For example:
Passage "Carrot": (you link to this one) Passage "Display Carrots": (you don't link to this one)
Thank you for this tip. I'm using this to turn a debugging variable on and off, and then refresh the passage so the debugging data is displayed or removed.
Possibly, depending on exactly what you're doing, but it's probably more trouble than it's worth.
The basics would be that you'd need to add a class to #passages (or something like that), which would disable the passage transition animation for the call to state.display(), and then remove the class afterwards. Timing issues could make that hairy though.