Is an infinite <<replacelink>> macro possible using this macro set? As in it forms a loop, so that once you get to the third choice, it cycles back to the first choice. A player can then continuously click on the macro to set a state.
I can do this with a widget stored inside a <<click>> macro, and then put the looping code inside the widget, but the problem that poses is the click does not animate, so there's no visual feedback for the player. What I really want is the behaviour of a permanent <<click>> macro with the animation of a <<replace>> macro.
Comments
Create two widgets, one is a replacelink macro that leads to a second widget, and the second widget has a replacelink macro that leads back to the first widget.
They'll keep replacing each other forever.
Couldn't you do something like the following: Usage:
I realize that's probably not as sexy as your <<replacelink>> version, but your players also won't end up buried in nested markup.
It doesn't show on screen, so is it just a backend function that could impact performance?
This is basically the widget I was using:
Run through several cycles and check the generated markup in your browser's inspector. As an example, it will look something like the following:
During the first cycle: During the second cycle: During the third cycle:
If a player cycles that thing a lot, then yes you might see some issues (though it would likely need to be a very large number; then again, you can't predict what a player will do). I'm unsure if that will get reset occasionally, but if it does not, then the player wouldn't even need to cycle it all at once, since it would continue to build over time.
I did some tests using the developer tools. I can see what you mean about nested elements, though it also seems to reset and clear them if I leave the passage. I.e. nest a few, then leave passage, then return, and the stack is reset.
I'll still use your widget if I can get it to work, though.
Okay then, simply changing from the custom style markup () to a <span> should make it SugarCube 1.x compatible. For example (you only need to change the starter widget):
Or, as another example, something closer to your example:
But with that small alteration it works.
Any way to add this in to make it have animation like the <<replacelink>> macro?
I believe this is the css that does that macro's animation:
For example (reuses the .revision classes):