Howdy, Stranger!

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

Basic logic problem

Hi, all!
I have this very basic problem (Harlowe 1.4):

$grille01 is set to zero in the header passage. The current passage is Grille01.
(print: $grille01)
(if: $grille01 < 2)[The grid is rusty, so much so that you'll have to push it.
(set: $grille01 to it + 1)Do you want to [[push the grid|Grille01]] ou [[stop the game|Abandon]] ?]


When I click "push the grid" I go back to Grille01 as designed, but $grille01 is not increased by 1!



  • Okay, I've got it. Having a basic problem is despicable. So, topic closed.
  • The following is for those that may be interested in why this issue was happening.

    The output of a header tagged passage is appended to the start of the output of the current Passage content being shown, and each time passage traversal occurs the current passage's output is deleted from the page so that the output of the next Passage can be inserted in its place. This results in the header (and footer) output also being deleted, which means the related content needs to be executed again.

    Because the $grille01 variable was being set to zero in the header passage, which was being executed each time a passage was displayed, by the time the (if:) macro was evaluated it would be always be zero.

    To solver this issue the initialisation of the $grille01 variable needs to occur in a passage that gets executed some time before the Grille01 passage is shown, an idea place to do that initialisation is within your story's startup tagged passage.

    note: This would of also been an issue if using Harlowe 2.x and the solution would of been the same as well.
  • Thanks, greyelf.
Sign In or Register to comment.