Location bar & undo

The location bar doesn't update when the player enters 'undo'. Any idea why this is? Can it be fixed? Or is this a flaw with Quest?

Any advice would be appreciated. Thanks.


There's a few possible issues where the javascript front end doesn't sync with what's happening in Quest after an undo. If you're using any complex JS, you need to be aware of this.

For the location bar, it's fairly simple. You need to find the script for the undo command, and add a line to it:

undo
game.suppressturnscripts = true
if (GetBoolean (game, "gridmap")){
  Grid_DrawPlayerInRoom (game.pov.parent)
}
JS.updateLocation(CapFirst(GetDisplayName(game.pov.parent)))

The undo script command resets all object attributes back to what they were the last time the start transaction command was used (which is immediately before running any command that doesn't have an isundo attribute). It doesn't affect javascript variables, or change any of the content on the player's screen.

The code to roll the map back is already there, you just need to include an extra line to fix the location bar. If you show or hide the sidebar for different parts of the the game, or anything like that, you will also need to include javascript to make sure the display matches the game. Any javascript that you use during the game may also need lines added to an 'undo'.


If you're using the web editor, you can't directly edit the built-in commands. So instead you'll put this in your start script:

undo.script => {
  undo
  game.suppressturnscripts = true
  if (GetBoolean (game, "gridmap")){
    Grid_DrawPlayerInRoom (game.pov.parent)
  }
  JS.updateLocation(CapFirst(GetDisplayName(game.pov.parent)))
}

Log in to post a reply.

Support

Forums