09. Wildcards use for more variety - jptrrs/SpeakUp GitHub Wiki
Consider this example:
<li>r_logentry(INITIATOR_animals_passion==Major)->I just love bunnies!</li>
If you just use this, it gets repetitive very quickly. We need some variety. So we might code:
<li>r_logentry(INITIATOR_animals_passion==Major)->I just love bunnies!</li>
<li>r_logentry(INITIATOR_animals_passion==Major)->I just love kitties!</li>
<li>r_logentry(INITIATOR_animals_passion==Major)->I just love puppies!</li>
<li>r_logentry(INITIATOR_animals_passion==Major)->I just love parrots!</li>
<li>r_logentry(INITIATOR_animals_passion==Major)->I just love chickens!</li>
<li>r_logentry(INITIATOR_animals_passion==Major)->I just love ponies!</li>
As you can see, most of this snippet is repetitive. Can we avoid this? Yes - again, wildcards are our friends:
<li>r_logentry(INITIATOR_animals_passion==Major)->I just love [colony_animals]!</li>
<li>colony_animals->bunnies</li>
<li>colony_animals->kitties</li>
<li>colony_animals->puppies</li>
<li>colony_animals->parrots</li>
<li>colony_animals->chickens</li>
<li>colony_animals->ponies</li>
Again, as in the previous page, this coding strategy allows us to save time and guarantee consistency whenever we wish to alter the main sentence.
Also, we can easily update the animals list as we wish.
In theory, we could use wildcards for all the parts of the sentence - but then, we should guarantee that all the possible options work well with all the other wildcards. Risky, but it hugely pays off if you can make it work! Here's a shortened, commented, heavily wildcard reliant example:
<li>r_logentry(INITIATOR_animals_passion==Major)->[passion_major_animals]</li>
<li>passion_major_animals-> [love] [colony_animals]! [comment]</li>
<!--LOVE-->
<li>love->I just love</li>
<li>love->I simply adore</li>
<li>love->I really fancy</li>
<!--ANIMALS-->
[... insert here the animals list as in the previous example ...]
<!--COMMENT-->
<li>comment->I find them so cute!</li>
<li>comment->I think they're great to have around.</li>
<li>comment->Having them around makes me smile.</li>
<li>comment->I wish I could hug one right now!</li>
<li>comment->I'll try and buy one when the next caravan passes by.</li>
<li>comment->I'll try and tame one for me.</li>
For sufficiently long options lists, generating the same sentence twice will be quite rare - and this is very desirable, since it provides variety that in turn guarantees a more lifelike conversation.
Moreover, you can use all the aforementioned tricks. For instance, do you remember that wildcards are recursive? So we can code:
<li>love->I [love_adverb][love_verb]</li>
<li>love_adverb->just </li>
<li>love_adverb->simply </li>
<li>love_adverb->really </li>
<li>love_adverb->do </li>
<li>love_adverb-></li>
<li>love_verb->love</li>
<li>love_verb->adore</li>
<li>love_verb->like very much</li>
<li>love_verb->think the world of</li>
Note: the love_adverb-> empty option is on purpose. We might simply want an alternative where no adverb is used.
Also, we can condition wildcards:
<!--COMMENT-->
<li>comment->I find them so cute!</li>
<li>comment->I think they're great to have around.</li>
<li>comment->Having them around makes me smile.</li>
<li>comment->I wish I could hug one right now!</li>
<li>comment(INITIATOR_social_level>=5)->I'll try and buy one when the next caravan passes by.</li>
<li>comment(INITIATOR_animals_level>=5)->I'll try and tame one for me.</li>
And for the "love_verb" and "love_adverb" sections (if my knowledge of spoken English is right):
<li>love_verb(INITIATOR_intellectual_level>=5)->think the world of</li>
<li>love_adverb(INITIATOR_intellectual_level>=5)->do </li>
This is to portrait a more "posh" (?) speaker, imagining a more intellectual pawn would speak in a more fancy way (but, you might disagree and use the Social skill instead for this, as you wish).
In the end, by providing good alternatives, we can have a huge variety of sentences, consistent with the situation at hand.
Some of the many possible outcomes are:
- I just adore ponies! I find them so cute!
- I really love chickens! I wish I could hug one right now!
- I simply adore bunnies! Having them around makes me smile.
- I love parrots! I think they're great to have around.
For a pawn with high Intellectual and Social skills, we could have:
- I do think the world of kitties! I'll try and buy one when the next caravan passes by.
As you can see, we have some nice variety here, by using a short list of options. Imagine what happens, then, if you write a long list!
Of course the more you risk it with wildcards, the more you can end up with weird sentences (e.g. chicken-hugging is not a very common practice, as far as I know) - but then, you can tailor XML so as to exclude these strange sentences from the possible outcomes.
For instance, you could exclude chickens from this example and write a chicken-only XML section, where pawns can express all their love for chickens - but without any awkward hugging.