Yeah, a combination of *if statements with multireplace is possible, but I’d be looking for something more like
@{damage+1 You miss.|You do 1 damage with your @{weapon sword|dagger|mace|carrot}.}
Totally fake example, but yes I’m dealing with a lot of ifs that could be much more elegant with nested (or nested in nested—a girl can dream, right?) mutireplace.
Nice idea, I’ll have to check if that would help with any of my code. I’ve mostly ended up either combining with *if statements or separating the multireplaces across multiple variables.
Haha, perhaps too much nesting would get a little out of hand. Seeing how much more compact my code is thanks to multireplace, though, I’d imagine that 1 nested level could actually still make the code clearer. But I could be wrong!
Sure, it’s not at all a necessary feature, but then neither are many of the more programming-heavy features, yet they can be really helpful to people who do choose to utilize them. Anyway, it’s just me dreaming!
It would be @{(languages <= 59) the foreign tongue | Deeplandish} in this case. You want the first part to be something an *if will see as either true or false, whereas language + 59 is just a number.
I’d been using multireplace properly for variables where, for instance, biting_daisies = 1 (or 2, 3, 4, etc.) but then it occurred to me that multireplace would be really useful for some of my on/off *if flavour text. But I nearly implemented it all wrong, because my way would have only worked if the player had exactly 60 or 61 in languages. I hadn’t thought it through properly; too excited about ending the endless string of *if statements, I suppose.
Actually, it would’ve thrown an error. I drew up a little test file while I was composing my reply (which then got ninja’d to the point I didn’t need to post anymore.) My code looked like this:
*create languages 50
You hear people conversing in @{(languages + 59) the foreign tongue|Deeplandish}.
It gave me the following error: line 7 of startup: invalid @{} at letter 31; ‘languages + 59’ is equal to 109 but there are only 2 options
So here 1 means she has daisies and 2 means she has sunflowers, right? If you wanted to replace flowers, you’d use:
A girl and her @{girl daisies|sunflowers}.
At least, if I’m understanding correctly. Then if you wanted her to have other flowers for values of 3 and 4 and what have you, as long as one keeps track of what number equates to what state, it’s possible to just expand into
A girl and her @{girl daisies|sunflowers|nasturtiums|Venus flytraps}.
I’ve mentioned this elsewhere, but if you set a character’s gender variable as numeric instead of a string, you can simplify plural-variant verbs for “they/them” pronouns. For example:
*fake_choice
#Non-binary.
*set gender 1
*set they "they"
#Female.
*set gender 2
*set they "she"
#Male.
*set gender 3
*set they "he"
Then you can insert things like @{gender teach|teaches|teaches} or @{gender go|goes|goes} inline instead of breaking your sentences apart to use structures things like:
I’ve just added a variation of @Minnow’s suggestion over on the Wiki.
The only difference is that instead of a numeric gender variable (they = 1, she = 2, he = 3), I’m suggesting a Boolean, “plural,” to keep things simpler. In English, I don’t think there are any verbs that conjugate differently for he and she. So it could work like this:
My preferred pronoun is
*fake_choice
#They.
*set plural true
*set they "they"
#Royal We.
*set plural true
*set they "we"
#She.
*set they "she"
#He.
*set they "he"
and then inside the multireplace brackets, we only need: @{plural go|goes} without the need for a third option.
Feel free to suggest edits to the Wiki. I’m still new to multireplace, and to coding for nonbinary characters.