So I'm writing a passage in sugarcube that essentially just edits a whole bunch of data, then returns to where the story was before.
I'm wondering if there's a way to make
<<goto previous()>>
work or if I'm going to have to add a $variable to memorize where I just came from and return there with a goto $variable.
That code returns an Error: <<goto>>: passage "previous()" does not exist error message, so it seems that the <<goto>> macro does not evaluate the value of the previous() function.
If you don't wish to use a temporary variable then you can use a <<print>> macro to dynamically create your <<goto>> macro like so:
That code returns an Error: <<goto>>: passage "previous()" does not exist error message, so it seems that the <<goto>> macro does not evaluate the value of the previous() function.
If you don't wish to use a temporary variable then you can use a <<print>> macro to dynamically create your <<goto>> macro like so:
<<print '<<goto "' + previous() + '">>'>>
Wow, I didn't know that it evaluates code in <<print>>. That's both neat and weird.
Still, this works like a charm. Thanks a lot.
Comments
If you don't wish to use a temporary variable then you can use a <<print>> macro to dynamically create your <<goto>> macro like so:
Wow, I didn't know that it evaluates code in <<print>>. That's both neat and weird.
Still, this works like a charm. Thanks a lot.