Howdy, Stranger!

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

How to disable back button after one use, and then re-enable it after moving a page forward?

I am creating a Choose Your Own Adventure game, and the javascript I have set up now limits the player to three save files and disallows the use of the back button (through the use of config.history.controls = false;). I did this in order to discourage players from hopping into different routes through save scumming and to encourage them to replay the game in order to get the different endings. However, I've found that this can lead to an awkward problem where a player may start a new game, rapid-fire click their way through the beginning dialog that they've already read, and then accidentally choose a path that they already completed. Without the back button, they would either have to reload a save or start the game over again.

Is there a way to gray out the back button after one use while leaving the forward button in place, and then re-enable it when the players moves forward a page? I'm using Twine 2 with the latest version of Sugarcube 2.

Comments

  • If you're using the SugarCube 2, then you should probably be spelling its Config object correctly—note the capital C.


    As to your question. Instead of disabling the history controls, which is what you're doing now, try setting a low limit upon the maximum number of moments kept within the history. For example:
    /* Leave the history controls on and limit the history instead. */
    Config.history.maxStates = 2; /* Suggest: 2—5 */
    
  • Thank you, this was exactly what I was looking for. You are the best!
Sign In or Register to comment.