It looks like you're new here. If you want to get involved, click one of these buttons!
(set: $days to 0) (set: $turn to 0) (if: $turn >= 8)[ (set: $day to $day + 1) (set: $turn to 0) (print: "It's getting late so you decide to go home and get some rest.") (goto:Home)]
(if: $turn is 1) [(set: $time to "Dawn")] (if: $turn is 2) [(set: $time to "Early Morning")] (if: $turn is 3) [(set: $time to "Morning")] (if: $turn is 4) [(set: $time to "Afternoon")] (if: $turn is 5) [(set: $time to "Evening")] (if: $turn is 6) [(set: $time to "Evening")] (if: $turn is 7) [(set: $time to "Sunset")] (if: $turn is 8) [(set: $time to "Midnight")]
(if: (passage:)'s name is "inventory")[<!--Do nothing-->] (else-if: (passage:)'s tags contains "donotshowinventory")[<!--Do nothing-->] (else:)[ [[Inventory|inventory]] [[Relationships]] [[Stats]] [[Tablet]] (print: $time) ]
Comments
This is significantly more complicated than it needs to be. Generally, if you have hooks whose job is to do nothing, there's a better way to do it. It doesn't matter all that much, but it is wasteful and confusing to have empty conditions. Why not just:
As to the main issue, it might be a few things:
1. Could it be that $turn is 0? I imagine you're setting it to 1 in the 'Home' passage, but we're not seeing that here.
2. You say that a separate passage called 'time' takes the $turn variable and sets the $time value accordingly. I imagine you're (display:)ing that passage somewhere, but where? That code needs to run for $time to be anything--maybe display it in a header-tagged passage?
3. The code in your startup-tagged passage has a similar problem. Is it being called anywhere else? Passages sort of behave like functions--they need to be invoked for their code to run.
4. Minor issue: why aren't you using (elseif:)s?
My suggestion would be to try something like this:
This code is in Twee format; '::' denotes a passage, and the format is ::(passage name) [(tags in the brackets)].
@deadcheese & @Chapel: Instead of using Collapsing whitespace markup to reduce any unwanted output generated by a startup tagged special passage you should use CSS like the following in your Story Stylesheet area to hide it completely. note: the above technique also works for the Harlow 2.x series.
At a guess (I'm not a Harlowe coder):
Might need a -1 in there if the arrays are zero based. You'll also need to range check $turn before you make the lookup (setting it to 1 if it's set to 9).
Noted. Thanks for the tip.