Comparing Multiple Results

I need some help with a comparison between multiple values.
I’m creating a command for my friend and they want a command that will measure ‘rizz’. I managed to make it so that it will compare for a value higher than ‘x’ amount but how would I make a separate segment that would maybe be lower than like ‘y’ amount?
For instance:

!commands edit -cd=5 !rizz $(eval a=Math.ceil(Math.random()*100);b=a>70? Dangg you have W rizz.:``;$(touser)'s rizz is ${a}%. ${b})’

This command will generate a random number between 1-100 and check if it’s greater than 70, but is there a way I could have it check if it’s below say, 30? Thank you for your time!

Hey @J_C!

Please use the search bar before opening a new topic:

Hmmm. But with that, it’ll end up with the result responseIfBetween70And89Included, as the majority of the results are below that, and it doesn’t set a limit/a minimum. Unfortunately, most of my knowledge is C++ so I’m not sure whether the same rules would apply, but I should be right in what I said.

1 Like

Is there any way to set a limit with intervals through this?

You are correct, the else if only executes if the previous if wasn’t truthy, thank you for pointing it out, I hadn’t noticed the issue when I wrote this code years ago (neither have the people who used that code apparently), and I haven’t taken the time to read it back since, I barely use else nowadays; it’s now fixed in the original topic, I appreciate your keen eyes.

The easiest fix is simply to remove the else, but here are other suggestions:

!addcom !rizz $(eval const r = Math.ceil(Math.random() * 100); let o = `$(touser)'s rizz is ${r}%`; if (r > 70) { o = 'Dangg, you have W rizz!'; } if (r < 30) { o = 'I\'m sorry, you failed the rizz test'; } o;)

Or as you wished to use ternary operators, it’s a bit different:

!addcom !rizz $(eval const r = Math.ceil(Math.random() * 100); r > 70 ? 'Dangg, you have W rizz!' : r < 30 ? 'I\'m sorry, you failed the rizz test' : `$(touser)'s rizz is ${r}%`;)

You can chain them, but it may make things more difficult to read/understand.

Hmm… these don’t quite work. It seems that that code is setting “o”, which was being used for the initial statement, and rewriting it with the other statements, getting rid of the initial “your rizz is __ percent.” Is there any way around this?

I ended up figuring it out.

!commands edit !rizz $(eval const r = Math.ceil(Math.random() * 100);o=Average.; if (r > 70) {o= Dangg, you have W rizz!; }else if (r < 40) {o = L rizz LMAO; } $(touser)'s rizz is ${r}%. ${o};)

It got rid of all my `'s but I’m sure you understand.

I didn’t understand you wanted to keep the percentage amount in every answer, my code reflected that (though it still worked as I expected it), my bad.

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