Pls help me make this command

Asked May 20, 2024·2 replies·Last activity 2 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.

Im trying to make a percentage command
but cant figure it out. I'm trying to make it so the command will give a different answer baswd on the percentage. ${touser} has ${random.1-100}% skills with a sword.' '${eval ${random.1-100} >= 55 ? 'They are praised by the clan leaders!' : 'They are shunned by the clan leaders!'} I hope someone can help.

2 replies

uh, u're pretty close actually, just gotta remember that in nightbot the command variables use ( ) instead of { } like this...

js
$(touser) has $(eval `${Math.floor(Math.random()*100)+1}% skills with a sword. ${Math.floor(Math.random()*100)+1 >= 55 ? `They are praised by the clan leaders!` : `They are shunned by the clan leaders!`}`)

but um, i notice that it uses 2 different random numbers, but it looks like u might wanna use the same random number to determine both the % of skills and whether they r shunned or praised... if that's the case... use this one instead...

js
$(touser) has $(eval r=Math.floor(Math.random()*100)+1;`${r}% skills with a sword. ${r >= 55 ? `They are praised by the clan leaders!` : `They are shunned by the clan leaders!`}`)