Having successfully used Leon's <<replace>> macro set with Twine 2, Sugarcube 1 for a previous project, I upgraded to Sugarcube 2 for what I'm working on now, but find myself unable to use the Sugarcube 2 <<replacelink>> macro set.
I'm using the downloaded version of Twine 2.0.8, and a local/offline version of SugarCube 2 (2.0.0-beta.7), with a freshly downloaded copy of the <<replacelink>> macro set from
http://www.motoslave.net/sugarcube/2/, which I dropped into my story using Edit Story Javascript. It's the only thing I've added to my story's Javascript, so it's not a conflict, at least.
When I try to use any of the macros in the <<replacelink>> set, I get an "undefined is not a function" error. For example, both of the following fail:
<<replacelink "Start">>Finish<<endreplacelink>>
<<replacelink>>Start<<becomes>>Finish<<endreplacelink>>
...with the message, "Error: cannot execute macro <<replacelink>>: undefined is not a function". (The "Start" links appear, but do nothing when clicked).
Likewise, attempting to use this:
<<revision changethis>>Start<<becomes>>Finish<<endrevision>>
<<reviselink changethis "Click me to change it!">>
...results in the message, "Error: cannot execute macro <<reviselink>>: State is not defined"
So I'm guessing I've made some really fundamental mistake somewhere, but I can't figure out what I might be doing wrong. Thank you for any guidance you can provide.
Comments
So you may need to update to the latest SugarCube 2, because I tested you code with beta.8 and they worked correctly.
If you only recently downloaded the <<replacelink>> macro set, then the version you have is only compatible with SugarCube v2.0.0-beta.8 and onward, so you'll need to grab beta.8 as well.
Thank you so much!