Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

goto previous - Is it possible?

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.

Comments

  • 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() + '">>'>>
    
  • greyelf wrote: »
    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.
Sign In or Register to comment.