Eval Specific Result Conditions

I’m using the eval comand to generate a random number between 1-100, and I want to make so that on an specific number, let’s says 100, it says something diferent from the normal message. I have no experience with javascript so I don’t know how does it work.
The command I’m using for the Ranfom Number Generator is this:
$(eval Math.floor((Math.random() * 100) + 1))


$(eval r=Math.floor(Math.random()*100+1);r==100?`Custom Message`:`Normal Message`)

It works great, but I have 2 questions.
1.Is there a way to show the number that was generated?
2. I tried adding multiple conditions so that when you get, for example 100 it says nice!, but when you get 99 it says close one. I did it this way, but it didn’t seem to work:
$(eval r=Math.floor(Math.random()*100+1);r==100?Nice!:Not Bad;r=99?Close One!:Not bad)


$(eval r=Math.floor(Math.random()*100+1);r==100?`Nice`:r==99?`Close one!`:`Not bad`)

Put ${r} where you want the random number to show in the message in between the ``

It worked, Thanks alot!

I have similiar problem. I got the pass/fail condition but anything that isn’t 50 fails. I bet it’s an easy fix, I just don’t have much experience with things like this.

$(eval a=Math.ceil(Math.random()*10);@$(user)'s Sus Level is ${a}/100. $(user) Has ${a==50?Passed:Failed} the Sus Check.)

Instead of a==50 do a<=50
Also it should be 100 instead of 10 I think for the random number

1 Like

Thank you very much. I was soooooo close. :slight_smile:

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