Howdy, Stranger!

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

How to do delete all "visited passages" history when clicking the RESTART link

Hello,

I am new to Twine (1.4.2) and I am using the Sugarcane format to create my first story.

I have two questions:

1) I added a 'Restart Story' link to the sidebar menu, and I wrote the following code:

[[Restart Story|Start][state.restart()]]

However, I noticed that when I restart the story, the history of previously visited passages is not cleared!
How could I achieve that?

2) I would to try and disable the browser's Back button. I went to Story Settings and unchecked ' Let the player undo moves'. When I rebuild the story, the back is disabled, but the story no longer moves forward and it is stuck in the Start passage even when I click the links to the next passages! I am not sure why it is not working as it should!

Thanks a lot in advance :)!

Comments

  • tripleaaa wrote:

    I am new to Twine (1.4.2) and I am using the Sugarcane format to create my first story.


    Thank you for including the Twine version and story format used.


    tripleaaa wrote:

    1) I added a 'Restart Story' link to the sidebar menu, and I wrote the following code:

    [[Restart Story|Start][state.restart()]]

    However, I noticed that when I restart the story, the history of previously visited passages is not cleared!
    How could I achieve that?


    Why are you adding another story restart menu item to the menu, when there is already one by default (named: Restart)?

    Beyond that, which "history" are you referring to, the browser's window history or the story's state history?
    • If you are referring to the browser's window history, then it is not cleared because it cannot be.  The relevant browser APIs, which are used by the story formats, do not expose that capability for security reasons.
    • If you are referring to the story's state history, then your example code should work as expected.  After clicking on it, the state history should contain only two states (the Start passage and the initial empty/null state).  If that's not the case, then something very odd is going on.
    tripleaaa wrote:

    2) I would to try and disable the browser's Back button. I went to Story Settings and unchecked ' Let the player undo moves'. When I rebuild the story, the back is disabled, but the story no longer moves forward and it is stuck in the Start passage even when I click the links to the next passages! I am not sure why it is not working as it should!


    I cannot replicate this issue (I just tried and it works as expected for me).  More details or an example of what you're trying would help.
  • Thanks for your reply!

    [quote]Why are you adding another story restart menu item to the menu, when there is already one by default (named: Restart)?

    The default Restart is just reloading the current page, which is not the effect I want. I want it to go back to the start passage and delete the story history. That's why created a new link in the sidebar menu.

    [quote]Beyond that, which "history" are you referring to, the browser's window history or the story's state history?

    Sorry that was not clear in my post. I was referring to the story's state history.

    [quote]If you are referring to the story's state history, then your example code should work as expected.  After clicking on it, the state history should contain only two states (the Start passage and the initial empty/null state).  If that's not the case, then something very odd is going on.

    Then something odd must be going on because when I get the passage where I used some if visited() statements, it is remembering the choice that was selected on the first round (before the restart). I really need this to work but not sure what is wrong!

    The code I have in one of my passages is:
    <<if visited("No")>>

    She is Yelling

    [[Drive to the farm|farm]]
    <<else if visited("Maybe")>>
    She is insisting

    [[Go back to your computer|Twitter]]

    <<else>>
    She is happy

    [[Go Home|House]]
    <<endif>>
    so here let's say I choose "Maybe" the first round, the next passage should be "Twitter", and it is! Now when I restart the story, I choose "No" this time, the next passage is still "Twitter" when it should be "farm". Note that the linking works perfectly with the if statements as long as I don't restart the story. I hope that it is cleared now.

    [quote]I cannot replicate this issue (I just tried and it works as expected for me).  More details or an example of what you're trying would help.

    I am just trying to disable the browser's back button. I followed the instructions in the wiki by going to story setting and unchecking 'let the player undo moves'. Now when I build, I get the start passage in the browser. Then I try to click on the link to go to the next passage, but it doesn't go anywhere. It just stays at the start passage no matter what I click. Looking at it more closely, it seems that it is following the link to the next passage but the new passage only appears for less that a second and it's back to Start.


    I have one more question regarding images in Twine, I used [img[image name]] to add an imported image to the story. What CSS can I use to make this image a certain width, height and alignment?

    Thanks a lot!

  • The Restart menu item does, by default, exactly what you want (that is, in fact, it's sole purpose).  Between that and the irregular behavior you note when disabling undo, there is definitely something untoward going on.  There are missing pieces to this puzzle.
    [list type=decimal]
    Is this the default version of Sugarcane that comes with Twine 1 (1.4.2)?
    Are you loading any scripts?
    Browser and version?
    I've attached an example TWS based on what you've described.  Is it more or less what you're doing?  What happens when you build it, does it exhibit the same symptoms?


    tripleaaa wrote:

    I have one more question regarding images in Twine, I used [img[image name]] to add an imported image to the story. What CSS can I use to make this image a certain width, height and alignment?


    If you want to set the style of a specific embedded image, rather than all images, then you'll either have to:

    A. Wrap the wiki image markup in an HTML tag (e.g. &lt;div&gt;).  For example:

    <div id="blue-dog">[img[IMAGE PASSAGE TITLE]]</div>
    And the accompanying CSS:

    /* Apply your desired styles to the specific image */
    #blue-dog > img {
    width: ;
    height: ;
    /* etc */
    }
    B. Use the &lt;img&gt; tag, with the data-passage attribute, instead.  For example:

    <img id="blue-dog" data-passage="IMAGE PASSAGE TITLE">
    And the accompanying CSS:

    /* First, we need to patch a bug in Sugarcane's CSS */
    img[data-passage] { cursor: default; }

    /* Apply your desired styles to the specific image */
    img#blue-dog {
    width: ;
    height: ;
    /* etc */
    }
  • Thank you sooo much for all you time and help!

    [quote]1.Is this the default version of Sugarcane that comes with Twine 1 (1.4.2)?
    Yes it is.

    [quote]2.Are you loading any scripts?[quote]
    No Scripts.

    [quote]3.Browser and version?
    I was using internet explorer (version 11.0.9600.17498) on windows . When you noted the browser to me, I tried using Firefox (21.0) and Google chrome (Version 39.0.2171.95 m) and both the "default restart" and disabling "browser undo" works perfectly now! I wonder what's the issue with internet explorer. But no problem, since it's working on other browsers now, that should work for me :) I just need to make Twine build and view into a different browser now.

    [quote]4.I've attached an example TWS based on what you've described.  Is it more or less what you're doing?  What happens when you build it, does it exhibit the same symptoms?[/
    Thanks a lot for sending the example.. Yes it does exhibit the same weird symptoms on internet explorer only!

    Thanks again you help is greatly appreciated :)


  • Ouch, yes.  Of the vanilla formats, both Sugarcane and Responsive are failing badly in IE at the moment.  The other vanilla format, Jonah, and SugarCube seem to be unaffected.  Since, Jonah seems fine and both Sugarcane/Responsive are failing, I'm going to assume that it's an issue in the code they share (that Jonah does not).

    Normally, I don't self-promote, however, under the circumstances.  If you like Sugarcane, you might want to give SugarCube a try.
  • I want to give Sugarcube a try -- I keep seeing it mentioned.

    Are there step-by-step instructions on installing it?  I'd probably want to use it with 2.0.  Or are there instructions for adding it to 1.4.2?
  • Twine 1: The instructions for Twine 1 are straightforward:
    [list type=decimal]
    Download SugarCube for Twine/Twee 1.4+ & TweeGo.  It comes in a ZIP archive.
    Unzip the archive into your targets directory (in Twine 1's install directory), which should place a sugarcube directory in alongside those of the other story formats.
    Open Twine 1 (if it was already open, then close and reopen it).  Go to: Story menu > Story Formats > select Sugarcube.


    Twine 2: There's a SugarCube in Twine 2 guide under its documentation, which covers how to install SugarCube in Twine 2 and how its behavior is different from when used with Twine 1 (which the regular documentation also notes, but the differences are small, so it made sense to note them there as well).
  • Thank you!  Got it downloaded for 1.4.2 now.  Moving on to downloading 2.0, etc.  Will that replace my 1.4.2 file, or will I have two copies of Twine on the computer?  I sort of want both copies of Twine for the time being.
  • If you download Twine 2 (v2.0.1, as I write this), then you should install it into its own directory, separate from Twine 1.  Since the download for Twine 2 is just a ZIP archive, you'll have to put it someplace manually, so this shouldn't be an issue.

    As for usage, they won't interact, so there's nothing to fear there.
  • Thank you so much!
Sign In or Register to comment.