Twine Version: 2.3.8
Story Format: SugarCube v2.31.1
I have a few passages that make use of either(list...)
to randomly select a character to interact with in that passage.
Initially I did this in a pretty basic fashion because all of the characters would have identical dialogue, the only difference was the name. So by using the following code I could have a passage with one of six characters randomly.
In StoryInit:
<<set $tutorRandomSet to ["Holly", "Kayley", "Cheryl", "Frank", "Rob", "Griffon"]>>
In link to passage:
<<set $tutorRandom to either($tutorRandomSet)>>
In passage:
"Hi $tutorRandom, how are you?"
"I'm good!"
So the player gets some variation with very little reproduction of dialogue and code.
But now I’ve gotten to the point where I would like to make some slight changes to their dialogue based on other variables they’ve picked up. (They all have identical variables initialized, the only difference being the value.) For example, if the character Holly has texted you:
"Hi $tutorRandom, how are you?"
"I'm good! <<if $holly.text.1>>Did you get my text?"<</if>>
Now, this would work when $tutorRandom
is “Holly” but would give the wrong response whenever $tutorRandom
is anyone else. I could wrap that whole conversation in <<if $tutorRandom is "Holly">>
, but then, instead of having one piece of dialogue for 6 characters, I’d have to write out all of the dialogue for every one of the random characters.
Is there a way that I could do something like this:
"Hi $tutorRandom, how are you?"
"I'm good!<<if $tutorRandom.text.1>>Did you get my text?"<</if>>
Where the $tutorRandom.text.1
above gets it’s value from $holly.text.1
Or maybe I’m going about this all wrong. Any advice would be appreciated.