Howdy, Stranger!

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

"Return" or "Reload" function for passage destination?

Using Sugarcube, is there a code to make a passage destination something like reload so it brings you back to the same passage? I get I can enter the same information, like if I'm in passage Apple, I can just type [b]Apple[/b] and that will reload the page, but I'm going to be doing a lot of these, so I was wondering if there was a more efficient piece of code I could use that just reloads the same passage when you click it. I have information updating upon opening the passage, so it updates more and more the more it's "reloaded" or "returned to" until the conditions are met to continue.

If anyone can offer help, I'd greatly appreciate it.

Comments

  • If you look at SugarCube's History API you will see that you can get the title of the current passage using state.active.title

    So you could use a markup link like the following:
    [[Go forth|state.active.title]]
    

    Warning: One downside of reloading the same passage over and over like this is that the passage gets added to the end of the Passage History again and again. So if the Reader decides to use their web-browser's Back button to a previous passage they will need to click on the Back button the same number of times they clicked on your "Go forth" link.
  • greyelf wrote: »
    If you look at SugarCube's History API you will see that you can get the title of the current passage using state.active.title

    So you could use a markup link like the following:
    [[Go forth|state.active.title]]
    

    Warning: One downside of reloading the same passage over and over like this is that the passage gets added to the end of the Passage History again and again. So if the Reader decides to use their web-browser's Back button to a previous passage they will need to click on the Back button the same number of times they clicked on your "Go forth" link.

    Hi greyelf, thank you for responding. Unfortunately, when I tried implementing the code
    state.active.title
    into the passage, right below my text, it simply created a link to a passage named state.active.title
  • The automatic create new passage feature of the Twine 2 editor only supports basic markup links, which your "Go forth" link is no longer because of the use of state.active.title

    Just delete the new passage that was automatically created.
  • greyelf wrote: »
    The automatic create new passage feature of the Twine 2 editor only supports basic markup links, which your "Go forth" link is no longer because of the use of state.active.title

    Just delete the new passage that was automatically created.

    This answers my question perfectly fine, at the cost of having a broken link warning in my document and leaving the cell red in color. I don't suppose there's a fix for that, but I thank you anyways for your answer.
  • The broken link warning feature pretty much works under the same conditions as the automatic create new passage feature. Neither really supports anything more than the basic markup link which is common between the three different story formats.
Sign In or Register to comment.