2 outputs in eval

Asked Oct 4, 2020·2 replies·Last activity 5 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.

Hi, I'm trying to make a command with a 2 randomized numbers. First number is in range 1-10, second is depends on first (if a=1 then b=0-100, if a=2 then b=101-200 etc).
I'm new to js and don't know how to properly show output, nightbot only shows number b.
Output should be like: LVL is "a", EXP is "b".

My code:
$(eval
a=Math.floor(Math.random() * 2+1);
a == 1 ?
b=(Math.floor(Math.random() * (100 - 1) ) + 1):
a == 2 ?
b=(Math.floor(Math.random() * (200 - 100) ) + 100):
document.write())

2 replies

$(eval a=Math.floor(Math.random()*10+1);b=Math.floor(Math.random()*101)+(a*100-100);`Lvl is ${a}, Exp is ${b}`)

Thanks, your code helped a lot :)