Randomization
Executing the same commands every time something triggers can become stale. Randomization introduces unpredictability and can make interactions more engaging.
Random choices
Section titled “Random choices”To choose randomly between commands, put the commands on one line, separate them with commas, and enclose the whole group in square brackets:
[say Hi there. , say How are you?]Used as a mob’s entrance reaction, this gives the mob an equal chance of saying “Hi there.” or “How are you?” whenever a player enters the room. Randomization works in any command field, not only mob reactions.
When a command itself contains a comma, wrap each choice in angle brackets so that its internal commas remain part of the command:
[<say Hello, John> , <say How are you, John?>]Probability
Section titled “Probability”Choices have equal probability by default. Three commands each have approximately a 33% chance; four commands each have a 25% chance.
For a two-outcome weighted choice, use:
[<probability>, <if-true command>, <else command>]For example, this echoes Correct 70% of the time and Incorrect 30% of the time:
[70, /echo Correct , /echo Incorrect]Omit the else command to do nothing when the probability is not met:
[70, /echo Correct]The weighted if/else form covers two outcomes. To weight one choice more heavily in a list with several outcomes, repeat that command in the list.
For example, a spin-the-wheel item can award 1,000 gold 25% of the time, award 100 gold 50% of the time, and award nothing 25% of the time:
[/award {{ actor }} gold 1000 , /award {{ actor }} gold 100 , /award {{ actor }} gold 100 , /send {{ actor }} You receive nothing.]Combining randomization with semicolons
Section titled “Combining randomization with semicolons”Semicolons work outside randomization brackets. This arrow trap always announces that it fired, then has an equal chance to hit or miss:
/echo An arrow fires. ; [/damage {{ actor }} 100 An arrow hits , /echo The arrow misses!]You can join more than one random choice with semicolons. A randomized fishing action might be:
[/echo You feel a tug on the fishing rod. , /echo A fish takes the bait.] ; [/load item 1 give it:1 {{ actor }}, /load item 2 give it:2 {{ actor }}]Semicolons can also appear inside the brackets, letting each random outcome contain a sequence of commands. Delays can make that sequence behave like commands entered on separate lines.
For example, a prayer action can choose between two multi-step outcomes:
[/echo You pray. ; /delay 3 /echo The ground rumbles. ; /delay 6 /load item 1 give it:1 {{ actor }} , /echo You pray. ; /delay 3 /echo The place is silent. ; /delay 6 /echo Nothing seems to happen.]Each branch chains commands and delays them by three seconds, recreating the normal pause between commands placed on different lines.