Howdy, Stranger!

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

[Harlowe] Variable Calculation Testing

edited December 2015 in Help! with 2.0
Hello all,

I'm wondering if there is a better than just simply combing through the possible combinations of a variable throughout the story and simply having the engine calculate the range of possible outcomes instead?

In context here is essentially what I have;
The story can progress more or less linearly, and time is a factor in the game and for the player. Depending on the choices the player makes how much time elapses for the in-game character with vary. However, I need to know when the sun will be down inside the game, and according to what the player has experienced, to then display the passage where the sun is down, or where the sun is still up.

Right now I have a variable in all passages where time is accumulated called $wta (wait time accumulated).

And it's usually something like this:
(set: $wta to $wta + 1500)

I was thinking about putting something into the game like this (all wait times are in seconds):
(if: $wta > 50400)[Sun is down.](elseif: ($wta < 50400) and ($wta > 48600))[Sun is setting.](else:)[Sun is up.]

However, I have no way of testing that it works without playing the whole game up until this point. Which, would be a huge waste of time and really annoying if that's the only way to test it.

Is there a way to make the game chose passages on its way from a selected passage to another to calculate possible variable amounts up until that point? Perhaps with a min and max?

Is there a better way to do what I've described to begin with?

Thanks in advance!

Comments

  • You may know that Harlow has a special startup tag which can be used to initialize your variables.

    eg. Create a passage (the name is not important but I name mine Startup) and assign it a tag of startup (all lowercase) and added the following content:
    (set: $wta to 0)
    

    Harlowe also has a special tag named debug-startup which works similar to the startup tag but the passage it is assigned to only gets processed if you are using the Test option. It can be used to initialize a variable to a different value to that done in the startup tagged passage.

    eg. Create a passage (the name is not important but I name mine Debug Startup) and assign it a tag of debug-startup (all lowercase) and added the following content:
    (set: $wta to 45000)
    

    If you did both of the above then if you use the Play option to test your story then the $wta variable will start with a value of zero 0 but if you use the Test option to test your story then the $wta variable will start with a value of 45000

    If you have something that appear or needs to be process for all or a set of passages then you may want to also looks at the special header and footer tags, and / or think about using custom passages tags to mark which passages you want generic code to be run on.
Sign In or Register to comment.