Howdy, Stranger!

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

Accessing variables within browser javascript

Well I'm testing and balancing my "game" and trying to access variables using the console directly in my browser. I saw a lot of places saying to use state.active or history[0].variables... but I can't get to it... the variable "state" doesn't exist.. :/

Comments

  • You need to state which Story Format you are using when you ask a question, as answer can be different for each one.

    The state.history[0].variables object is how you access variables in Javascript if you are using one of the (vanilla) story formats that come with Twine 1.

    The state.active.variables object is how you access variables if you are using SugarCube 1.x or 2.x

    Harlowe does not have a documented Javascript API, and it's engine has been deliberately designed/implement to make it difficult to access it's internals.
  • greyelf wrote: »
    The state.active.variables object is how you access variables if you are using SugarCube 1.x or 2.x
    Correction. For SugarCube 1, yes. For SugarCube 2, however, you really should use State.active.variables or, preferably, State.variables—the state object alias has always been deprecated.
Sign In or Register to comment.