You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
Matt Peterson edited this page Dec 8, 2013
·
1 revision
This code creates what is called a weighted switch. It picks an action randomly. Actions with a higher weight have a higher chance of being executed.
- 'set.$choice': 'roll(5)' # this 5 should be the total of all the weights
#first action
- 'if $choice >= 0 and $choice < 3':
- 'do whatever you want here'
- 'set.$choice': '$choice - 3' # same as weight above
#second action
- 'if $choice >= 0 and $choice < 2':
- 'do whatever you want here'
- 'set.$choice': '$choice - 2' # same as weight above