2 responses percentage command? help

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))%:speak_no_evil: lying ;random>=65?“Message One”:“Message Two”

Update: started trying a new code so the “%” and the":speak_no_evil: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)

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: @Cyrensy is message 2

I wanted to Say @Cyrensy is 65% :speak_no_evil: 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

1 Like

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

1 Like

Got it, Thank You! for helping me out

1 Like

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