0 votes
by (150 points)
edited by

Disclaimer: I don't really know how the "programming" side of Twine works, but so far I've been able to correct everything that's gone wrong and troubleshoot it using fixes provided in this forum.

The game I'm making has variables (erosion, pesticide, fire, and fog), and once any of them reach a certain level, you die and go to the End passage.

However, I've noticed that once the last passage ("end") is reached, it keeps hitting it over and over again (the turns go up rapidly without end, but all the variables are the same). It makes it impossible to read the text.

If I test it by putting the max value into my startup passage (for example $erosion is 100), and then test directly from the End passage, it works. But if I play through normally it doesn't. I thought it was a problem with my header having a loop, but when I try to eliminate the header by only running it if it's true, and making it false in End, it still doesn't work. (I also have the no-header tag, but from what I can gather the header still runs with the no-header tag, it's just not visible?)

This is my header:

(if: $header is true)[(if: $erosion >=100)[(go-to: "end")]
(else-if: $fog <=0)[(go-to: "end")]
(else-if: $pesticide >=100)[(go-to: "end")]
(else-if: $fire>=89 and <99)[(if:(random: 1, 100) <=50)[(go-to: "Fire.")]]
(else-if: $fire >=100)[(go-to: "Fire.")]
(else:)[(if: $sitka is true)[(set:$fog to $fog-10)The salty air stings your bark.]
(if: $weed is true)[(set:$erosion to $erosion+10)(set:$pesticide to $pesticide+10)The covert growing operation continues to impact you.]
(if: $homes is true)[(set:$erosion to $erosion+10)The building project grows.]
(display:'stats') (set: $fog to $fog-10)(set: $fire to $fire+10){
(print: "<script>$('html').removeClass(\)</script>")
(if: (passage:)'s tags's length > 0)[
(print: "<script>$('html').addClass('" + (passage:)'s tags.join(' ') + "'\)</script>")

and this is my last passage:

(set: $header to false)
you died of (if: $pesticide >=100)[pesticides.](else-if:$erosion >=100)[erosion.](else-if:$fog <=0)[dehydration](else-if:$fires)[fire]

Is there something wrong with these? I'm using the default Harlowe 2.1.0.

1 Answer

0 votes
by (63.1k points)
selected by
Best answer
The passage is never run. (See below for explanation.) Try moving the (set: $header to false) part from the passage to the header, right before the (goto:). Also you don't need to use that hack for tag based styles anymore. Second to last post here explains it: https://twinery.org/forum/discussion/4797/basic-harlowe-passage-tag-based-styling

The passage itself is meant to stop the header from running its code via the $header variable. But every time the (goto:) is run, the passage navigation system starts again. That system runs the header first, then the passage. When it runs the header, it trips the (goto:), starting the navigation again... So the part where the header is stopped from running is unreachable. This is because unlike other formats, Harlowe's goto macros terminate the rendering process. If you did this in, say, SugarCube, it would run the navigation an extra time, but it wouldn't result in infinite recursion.

You need to be extremely careful with goto-style macros regardless of the format, though, as passage navigation has all sorts of side effects to consider.
by (150 points)
That makes a lot of sense re: when the $header to false is run. It works perfectly now, thank you!

And good to know about the tag based styles.