2 responses percentage command? help

Asked Aug 2, 2020·10 replies·Last activity 6 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.

percentage command if it's higher or = then 65% nightbot will respond with a message and if it's lower then 65% nightbot will respond with another message.

!addcom lie -cd=5 $(touser) is $(eval var random=(Math.floor((Math.random() * 100) + 1))%🙊 lying ;random>=65?"Message One":"Message Two"

Update: started trying a new code so the "%" and the"🙊lying" text are not displaying

!addcom -cd=5 !lie $(eval Math.ceil(Math.random()*100)>65?$(user) why u always lying!:$(user) is not lying)

10 replies

Ok try this

!addcom lie -cd=5 $(touser) is $(eval random=Math.floor((Math.random()*100)+1);var randomPercent=random+"% 🙊 lying";random>=65?"Message1":"Message2")

Note: anywhere you want the random variable to show in a message just do it like this
``
"This is a "+randomPercent+" test message."
``

This doesnt show me the % it just says the night bot message

Show me what your command looks like

I did a !test command using the code

So it just shows

!test Nightbot: @Tidy Snail is message 2
I wanted to Say @Tidy Snail is 65% 🙊 lying , nightbot response

Ok for response 1 which is greater than or equal to 65 put

randomPercent+" Nightbot_Response"

Make sure it’s after the question mark “?”

And as for the second response do the same thing but after the colon “:”
The second response includes all numbers below 65.

Can you show me what your command looks like?
Like the actual “code” behind it

!editcom lie -cd=5 $(touser) is $(eval random=Math.floor((Math.random()*100)+1);var randomPercent=random+"% 🙊 lying ";random>=65?randomPercent+"Message1":randomPercent+"Message2")

Type this in your chat but fill in message1 and message2 with what you want it to say

Thank You!! Potato

Is there a way to put a coma to separate the message here

;random>=65?randomPercent+"Message1":randomPercent+"Message2")

Yes you can’t put a comma after the first double quote like this:
", Message1"
I’m assuming that’s what you are asking

Got it, Thank You! for helping me out

Didn't find your answer? The community is on Discord.

Ask on Discord