Twine Version: 2.3.9
Story Format: Sugarcube 2.31.1
Sorry about this extremely new-to-coding question, but I’m stuck on the logic of how to make something particular happen.
I’m trying to add a scavenger element to my game. Here’s the scenario (using apples as an example):
When a player goes to a passage (sceneA here) with an apple, I’ve written:
<<if visited("sceneA") is 1>><<set $apples to $apples + 1>><<endif>>
If it’s the first time visiting the passage, they add one apple to the pile. If it’s less than 1 or more than 1, no apple gets added to the pile. So far so good. I mean, maybe it’s not, but this seems to be functioning correctly when I test.
My problem is, some apples you can find in multiple passages. Since you can find the SAME apple in sceneA and sceneB, I want to make it so $apples only increases once when you visit EITHER sceneA or sceneB for the first time.
<<if visited("sceneA", "sceneB") is 1>><<set $apples to $apples + 1>><<endif>>
seems wrong, as does
<<if visited("sceneA", "sceneB") lt 2>><<set $apples to $apples + 1>><<endif>>
What am I missing? Am I way off base? I swear I tried to google this, but I wasn’t getting anywhere. Thanks a bunch.