Making a random percentage command better. need help

Asked Dec 22, 2020·5 replies·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

So im a moderator for a twitch channel and we've got a command that i want to make better.

currently you type the command "!happy" and it will say you are a random (0-100%) happy.

Is it possible to expand on the idea and for nightbot to categorize certain percentage groups with a different msg?

for example if you get 100% you will receive a special msg. Or perhaps a different msg if you land between 25%-50% etc.

5 replies

This handles cases, and you can add more cases as shown.

$(eval a=Math.floor(Math.random()*101);if(a<25){`msg1`;}else if(a>=25&&a<=50){`msg2`;}else if(OTHER CONDITION){`etc`;}else{`fallback msg`;})

How do i get the command to show what percentage that it pulled? I got this string to work properly but its only showing the msg, not the reason for the specific msg (the specific percentage)

This shows the # and related msg.

$(eval a=Math.floor(Math.random()*101);if(a<25){b=`msg1`;}else if(a>=25&&a<=50){b=`msg2`;}else if(OTHER CONDITION){b=`etc`;}else{b=`fallback msg`;}`$(user) is ${a}% happy. ${b}`)

May I ask what the command is now? I’m looking to do something similar but cannot find an example of it. Thank you.

Hey @Gleeful Turkey!

I mean, is the example above not enough?

Didn't find your answer? The community is on Discord.

Ask on Discord