Error with code, maybe?

Asked Feb 26, 2022·2 replies·Last activity 4 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.

I'm trying to create a command that 80% of the time comes back with one answer and 20% a dfifferent answer. Is this the right code?

$(eval Math.floor(Math.random()*100)==80?'$(user)'s pp is so large, Nightbot has run for cover!':'Sorry, $(user)'s pp not found. Try using a magnifying glass!')

It works in chat, but I want to be sure that the 20% answer will show up. I had it run about 20 times and all were the 80% answer. I want the "run for cover" to be 20% of the time.

Thanks!

2 replies

It should be <=79 not ==80 as that will only trigger 1/100 times

oh oh oh!! Thank you!

EDIT: It works! This has been resolved! Thank you again!!!