Hello,
I'm running into quite a bit of trouble while trying to do some coding in Harlowe. So, what I'm trying to do is create a time system where I count hours and increments of 15 minutes that passes by each time you move to a different page. Because of how complex it is, I have set up multiple pages of pure coding that is displayed on the bottom of non-coding pages.
In the "first room" there is text, and then two displayed pages at the bottom. It goes something like:
(set: $location to "first room")
Text text text text
(display: "code")
(display: "navigation")
The "code" page would do something like this:
(if: $location is "first room")[
(set: $1Appear to true)
(set: $1Desciption to "Go to the left room")
(set: $1Code1 to (set: $15Passed to 1))
(set: $1Code2 to (display: "timePassCalc"))
(set: $1Code3 to (goto: "second room"))
(set: $2Appear to true)
(set: $2Description to "Go to the right room")
(set: $2Code1 to (set: $hourPassed to 1))
(set: $2Code2 to (display: "timePassCalc"))
(set: $2Code3 to (goto: "third room"))]
And then the "navigation" page would be:
(if: $1Appear is true)[(link: $1Description)[$1Code1 $1Code2 $1Code3]]
(if: $2Appear is true)[(link: $2Description)[$2Code1 $2Code2 $2Code3]]
There is nothing wrong with the "timePassCalc" page. The problem here, is that if you choose one of those options, a total of 1 hour and 15 minute passes because it has set BOTH $15Passed and $hourPassed to 1, when I only want them to run when the link is pressed. Preferably, I want to keep all the code and navigation on one page so that it would save space. Can anyone see a work around the current system? Any help would be appreciated... thank you!
Comments
Your main issue is an assumption that you can store (set: $15Passed to 1) inside the $1Code1 variable as a macro and that it delays the assignment of the $15Passed variable, which the following test shows is incorrect:
What you need to do is store the inner set macro as a String value, which will execute when printed.
note: you may need to use the same technique for the (display:) and (goto:) macros in the Code2 and Code3 related variables.
One thing I forgot to mention was that you can use a footer tagged passage to automatically append content to the bottom of the current passage.