05. Conditioned lines - jptrrs/SpeakUp GitHub Wiki

Consider this example:
<li>r_logentry->What a nice sunny day!</li>
This line will be spoken no matter what. There is no condition for it. It would be spoken even if it rained.
Yet, we actually need it to be spoken only if the weather is clear.

How can we do this? Here's the answer:
<li>r_logentry(WEATHER==clear)->What a nice sunny day!</li>

Also, we might want to condition it to the pawn's mood, as a furious pawn would never use those happy words. So we can code:
<li>r_logentry(WEATHER==clear,INITIATOR_mood>=0.25)->What a nice sunny day!</li>

Finally, if this line needs a reaction, we must include a "tag" condition, as shown earlier in the wiki. So we should code:
<li>r_logentry(WEATHER==clear,INITIATOR_mood>=0.25,tag=SunnyDay)->What a nice sunny day!</li>

Here's another example:
<li>r_logentry(INITIATOR_thought=AteFineMeal,tag=FineMeal)->I had a fine meal.</li>

And another:
<li>r_logentry(RECIPIENT_thought=AteFineMeal,tag=RecipientFineMeal)->You had a fine meal.</li>

IMPORTANT: the conditioning section between brackets must not contain any space, except for spaces in the parameters (if any).
Good example: (INITIATOR_trait==annoying voice)
Bad example: (INITIATOR_trait==annoying voice, DAYPERIOD=morning, WEATHER=clear)

We can use the following operators:
a) ==
Example: WEATHER==clear

b) > or >=
Example: INITIATOR_mood>=25

c) &lt; or &lt;=
This is more tricky. It actually represents "<" and "<=". But since using "<" would stop XML from working, we use &lt; instead.

d) !=
This one is tricky too. It means "NOT", but it can only be used for specific parameters - generally those having just one possible value at a time.

Good example: INITIATOR_gender!=Male
This works, because a pawn has only one gender at any time.

Bad example: INITIATOR_trait!=ascetic
This doesn't work, because a pawn can have multiple traits.

We can fix this shortcoming by using the priorities mechanism, which will be shown later in this wiki.

Unfortunately there is no "OR" operator, but again we can bypass this by using Wildcards, which will be shown in the next page.

As for what you can use as parameters, the wiki Appendix contains a partial list of them.
For now, let's just try to remember this key detail: all pawn-related parameters start with INITIATOR_ or RECIPIENT_.

⚠️ **GitHub.com Fallback** ⚠️