0 votes
by (120 points)
retagged by
Hello everyone!

I have a little bit of a complex issue, so I'll try to explain it as best I can. I'm using the browser-based Harlowe and am fairly new to this all.

I'm trying to replicate a side-scrolling game in a text format. Each 'level' will be made of a number of passages which link to each other linearly. I.e. Players can go 'right' and 'left' between the passages. Each passage has seven 'atmospheric conditions' and is randomly assigned a 'landscape feature' from a pre-written bank; each feature changes the atmospheric conditions for that passage and remains constant for the play-through of that level.

For example, 'Passage 1' is assigned 'bonfire' which amends $Passage1Temperature to +3, $Passage1Sound to +1, $Passage1AirQuality to -2 etc. Ideally there'd be a little description that could be displayed as well.

My question is: can assign the 'amendments' each landscape feature enacts once, or would I have to do it for each passage?

I've currently been working under the impression that I might have to write out the variable amendments for each possible landscape feature every single time. I.e. Every single passage would start with (If: $Feature is "Bonfire") [(amendments)] (if: $Feature is "Barrel") [(amendments)](if: $feature is "Boulder")([amendments)].

What I'm hoping is possible is to be able to have a 'set-up' passage where all of the amendments are laid out for each 'landscape feature', so that when they're selected for the passages in the 'level' those amendments are automatically enacted. Is that possible?

Hopefully I've been clear enough with my description of the issue!

1 Answer

0 votes
by (63.1k points)
edited by

Thank you for providing your story format, but it's also helpful to know the version number. Twine 2.1.3 comes with two versions of Harlowe, v1.2.4 (for older projects started before v2 came out) and v2.0.1, and that information can be important as it lets us know which features we have access to. 

There's a lot of information in your passage, which is good. However, I don't know exactly what you mean by amendments, and I'm not sure how you plan to implement a side scroller, which makes answering this difficult. From the other parts of your answer, though, it seems you want to develop little "packages" of variable changes to use throughout your story. My suggestion would be to leverage Twine's passage structure for that. 

For example, if you want a passage to have the "bonfire" trait as you describe, create a passage, and name it something, like "trait-bonfire", then place the code you need in that passage; 

:: trait-bonfire 
(set: $temperature to it + 3)
(set: $airQuality to it + 1)

Then, to apply that trait and its code in a passage, use a (display:) macro. 

(display: "trait-bonfire")\
There's a bonfire here! 


  • Raising variables in this way (by adding or subtracting) can be risky in some cases, since if a player can return to that passage, they could "cheat" by going back and forth between two passages and gaining a lot of bonuses. There are many ways to solve this issue, but without knowing more about your game, it's hard to offer specifics. 
  • You should declare your variables to a starting value (we call this initializing them) in a passage with the tag "startup". 
by (120 points)

Hi - thanks for the reply. Sorry about omitting the version number there. I'm using the browser version primarily, am I correct in thinking that's 2.1.3?

Apologies for the complexity of the issue here as well! Probably best to ignore what I said about 'side-scroller'; I meant it more as the players would be encountering a linear sequence of 'landscape features', each of which would have their own characteristics.

What you've recommended with starting a new passage for each landscape feature is perfect - I've just tried it and it's working really well. I do have just another related question though. I'll try and explain it as simply as possible:

Currently, I have a 'start-up' passage that sets Ambient Temperature and the features for the current play-through. The player can then advance to LandscapeFeatureOne (and then the second and so-on) and each of these features might then amend this initial AmbientTemp as per their feature, but only for their feature.

So, for example:

  • The ambient temperature starts as 5. 
  • FeatureOne is a bonfire which is +5 to AmbientTemp, to make 10 for that Feature.
  • FeatureTwo might then be a puddle, which doesn't add anything to AmbientTemp. so that feature is still 5.
  • FeatureThree might then be another bonfire, which is +5 to AmbientTemp, but only for that Feature. So again, it would be 10 for that feature.
Is there a way I might write each feature's 'trait' passage - or the associated coding - that might facilitate this?
Thanks for your help!
by (120 points)


I think I'm partway to what I'm looking for. I've got the following codes (note: I'm using 'card numbers' to determine how far along the 'level' the player is). 

:: Trait-Bonfire
(set: $FeatureTemp to 5)

:: Trait-Generator
(set: $FeatureTemp to 10)

(Set: $CardOneFeature to (Display: "Trait-Bonfire"))
(Set: $CardTwoFeature to (Display: "Trait-Generator"))

(Set: $AmbientTemp to 5)

[[Card One]]

:: Card One
(set: $CardOneTemp to $AmbientTemp + $FeatureTemp)
Card Temp: $CardOneTemp

[[Card Two]]

:: Card Two
(set: $CardTwoTemp to $AmbientTemp + $FeatureTemp)
Card Temp: $CardTwoTemp
[[Card One]]

Each CardTemp certainly seems correct when navigating back and forward between the two cards, in any case.
The next step is to work out a way of allowing players it interact with each feature in a way that would change each card's statistics again!