Hi,
I'm working on a project where the "Undo" button is useful for moving in passages, but I don't want the memory erased from visiting, as a player would trigger certain variables by visiting those passages and I don't want that event removed when they go back.
Can I disable the "Undo" effect and turn the back arrow into an "go back" function instead, much like what the back and forward keys did in Twine 1.0?
Comments
Method A:
Changing the tool-tip of the Undo button to "Go Back" can be done using the following code within a header tagged passage:
You could even potentially change what happens when the Undo button is clicked by changing the above to something like the following: The issue is that Harlowe currently does not have a Javascript API, so unfortunately there is no documented method for an Author to use to programmatically navigate the story to another passage.
Method B:
Another option would be to hide the existing Undo button and replace it with your own, the hiding part can be accomplished by adding the following to your Story Stylesheet area. ... and placing the following code within a header tagged passage would create the replacement button: The issue this time is the CSS needed to position the new button so that it appears where the old Undo button did. Harlowe uses percentages (both hard-wired and dynamically calculated) to define where the contents of the current passage is displayed which in turn defines where the sidebar (containing the Undo/Redo buttons) appears, and this makes it difficult to precisely position your replacement button.
Someone else may be able to supply you with a working solution.
Method B is interesting. Unfortunately, it only goes one step back, unlike the undo and redo which can follow your entire history and recall it from a save or load in the project.
The following CSS is based on the sidebar's selector, the only difference is I have added a top attribute to move the header link down below the existing undo/redo 'buttons'. Add both the CSS and the header based link to a story project consisting of at least two connected passages: ... as you can see the header based link appears in the sidebar area below the undo/redo buttons. You may of also noticed the short delay between the link first appearing at the start of the passage text area and the link appearing in the sidebar area, and that is the issue that I personally have not worked out how to overcome.
Maybe a more experienced CSS coder knows how to fixed the problem of the header based link appearing twice.
Ok. Thanks for the quick reply. I'll have to experiment around to see if any alternatives come to mind for all of this.