intermediate ii: weighted choices

✎ what are weighted choices for?

  • by default, all choices listed in {choose:} have equal odds of being chosen.

{choose: jelly | ice cream | smoothie | cake | cookie}

  • to make certain choices more common, users can hypothetically repeat certain choices...

{choose: jelly | jelly | cake | cake | cake | cookie | cookie | cookie | cookie | cookie | smoothie | smoothie | ice cream}

because of the # of times each of the choice is repeated, it'll cause a change in rarity.

  • however, the above can get excessively verbose extremely fast for rarer options... so instead, it is better to use the weighted choose variable.

  • the {weightedchoose:} variable allows you to assign a weight to a choice, allowing you to skew the odds for common, uncommon and rarer choices, without repeating each choice over and over again.

✎ how do i use a weighted choose?

  • to assign a weighted choose, you would first need to decide how rare each option should be.

  • {weightedchoose:} allows you to select the weight of how much each item in the {choose:} will be. it will be assigned in order.

  • so "the" = 1%, "choices" = 9%, "always correspond" = 10%, "in chronological" = 50%, and "order" = 30% chance.

  • let's take an example, where you want the following items to have the below rarity:

prize
percentage chance

common

60%

rare

30%

super rare

8%

ultra rare

2%

/autoresponder add trigger: response:{choose: common | rare | super rare | ultra rare}{weightedchoose: 60% | 30% | 8% | 2%} you got a [choice] prize, congratulations!

✎ more traditional weights + decimals also OK!

  • if you don't want to use percentages, you can also use weights, such as the follows. let's go back to the jelly / cake / cookie / smoothie / ice cream example we had at the beginning (:

{choose:jelly|cake|cookie|smoothie|ice cream} {weightedchoose:2|3|5|2|1} [choice]

  • or even use decimals!

{choose:frog|cat|dog|fish|bear|bird|elephant}{weightedchoose:0.12|0.04|0.18|0.09|0.023|0.19|0.15} [choice]

Last updated

Was this helpful?