Help with if/if/else command (multiple responses)

Hey everyone,

I could use some help wit a command I’m trying to make. I have a command that gives a user a percentage for something. Now I’d like to make it so that the responses Nightbot gives are different depending on which percentage is the outcome. So for example: <25% response 1 is added, >75% response 2 is added, else response 3 is added.

More than 3 responses would be preferable, but three is the minimum I need for what I have in mind. I’ve searched around online and found some pages on the subject but none that could help me get it into a working command.

The command I have now (without the added responses) is: $(user) is $(eval Math.floor(Math.random() * 101))%

If anyone could help me out or point me in the right direction it would be greatly appreciated!

Hey @twitch!

Save the value of the random number in a variable and test against it to display various replies:

$(eval r=Math.floor(Math.random()*101) if (r<25) {UNDER_25%_RESPONSE} else if (r>75) {ABOVE_75%_RESPONSE} else {BETWEEN_25%_AND_75%_RESPONSE}
$(eval r=Math.floor(Math.random()*101) r<25?UNDER_25%_RESPONSE:r>75?ABOVE_75%_RESPONSE:BETWEEN_25%_AND_75%_RESPONSE;

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.