Hello all,
I just started experimenting with Twine/Harlowe and noticed that a variable that is set in a particular passage seems to be forgotten after the player hits the 'back' arrow (Harlowe's CSS back arrow, not the browser back button). The execution flow is as follows:
(set: $bool_var to false) //this occurs in the start passage, and should be the default value
*user clicks link to a passage that presents them with a set of navigation choices, one of which will set $bool_var to true*
*user clicks link to the passage that sets $bool_var to true*
(set: $bool_var to true)
*user hits 'back' arrow*
*user clicks link to a different passage in which $bool_var is read*
(if: $bool_var is false)[bool_var is false](else:)[bool_var is true]
*user sees "bool_var is false"*
I tried adding a path from the passage where $bool_var is set true directly to the passage where it is read, and that resulted in the expected "bool_var is true" output.
I thought variables throughout Twine projects were global unless specifically attached to a passage, but this result suggests that hitting the back arrow somehow reverts the previous assignment. I guess that could be either a matter of scope or a function of the back arrow that I'm not familiar with. Anyway, what explains this behavior and how can I make my variables (and modifications to those variables) persist through user navigation using back/forward arrows?
I just started experimenting with Twine/Harlowe and noticed that a variable that is set in a particular passage seems to be forgotten after the player hits the 'back' arrow (Harlowe's CSS back arrow, not the browser back button). The execution flow is as follows:
(set: $bool_var to false) //this occurs in the start passage, and should be the default value
*user clicks link to a passage that presents them with a set of navigation choices, one of which will set $bool_var to true*
*user clicks link to the passage that sets $bool_var to true*
(set: $bool_var to true)
*user hits 'back' arrow*
*user clicks link to a different passage in which $bool_var is read*
(if: $bool_var is false)[bool_var is false](else:)[bool_var is true]
*user sees "bool_var is false"*
I tried adding a path from the passage where $bool_var is set true directly to the passage where it is read, and that resulted in the expected "bool_var is true" output.
I thought variables throughout Twine projects were global unless specifically attached to a passage, but this result suggests that hitting the back arrow somehow reverts the previous assignment. I guess that could be either a matter of scope or a function of the back arrow that I'm not familiar with. Anyway, what explains this behavior and how can I make my variables (and modifications to those variables) persist through user navigation using back/forward arrows?