Nightbot Command. Random Number Generator to display a specific answer for a range of numbers

I’m trying to make a game with my nightbot and i want to use a random number generator to pick a number from 1-1000 for a hammer strength test and from a certain range 1-99 i want to return something that says your hammer strength was #randomnumber and display #specified command.

For example 705 - Great swing almost there.
100 - weak throw lets try again!!

Ranges : 1-100 - Try again
101 -250 - Getting there
251-500 - Almost there
ETC… is there a good command to do for that? I do not want to create a pastebin file with 1000 lines repeating… there would be 10 different commands for different number ranges.

This should be pretty simple the only reason you would need to use pastebin is if your reply’s go over the command length limitation
Regardless here is the command I think you want I’m not sure if this is it exactly but let me know:

$(eval r=Math.floor(Math.random()*100+1);
r<(One greater than the highest number of the first range if it’s 1-99 it will be 100)?`response for lowest range`:
r<(One greater than the highest number in second range 100-199 will be 200 etc.)?`response for second lowest range`:
r<X+1?`Response for nth lowest range`:
`Response for highest range`)

I formatted it such that it saves as many characters as possible and if you wish to show the score they got include ${r} in the response portion wherever you want it.
If you have any questions or need further guidance please ask.
I do suspect that if you want ten responses though you will likely need to use pastebin but don’t worry you won’t need to write out 1000 items

1 Like

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