So I need to make a command that is something like this
If user rolls >10 then post “text1” or if user rolls <=10 then post “text2” (and if possible change role of the user on discord).
it has been years since i last used a programming language so it is hard for me to do it.
Just set a variable equal to the random number output and check what that variable equals.
You don’t need to check what it’s equal to the second time as text_1 is anything above 10 and anything else will be text_2 all you van to do is set random equal to the random number
My current command looks like this :
$(eval Math.floor(Math.random() * 10) == 0 ? “text1” : “text2”)
but i need to have the RNG number shown to make it feel more like a mini game, rather than a Russian roulette command. So this is a response command to this one :
$(user) text $(eval Math.floor((Math.random() * 20) + 1)) text
so i need to show if the number the other person rolls is higher or lower than 10 in chat, instead of just showing the outcome without the number.
And i also wanted to make it so that if you roll lower than 10 to change your role on Discord. (again not sure how to do this part at all)
Like a time-out or mini ban gamble game.
Ok try this:
$(eval var a=(Math.floor(Math.random()*20)+1);a>=10?“You rolled a “+a+”. Oh well better luck next time.”:“You rolled a “+a+”! Congratulations!”)
As for auto changing their role I do not know of a way.(Atleast via nightbot)
i get this “Invalid or unexpected token” message.
Sorry bout that I think that’s due to the way the quotes are try this:
$(eval var a=(Math.floor(Math.random()*20)+1);a>=10?`You rolled a `+a+`. Oh well better luck next time.`:`You rolled a `+a+`! Congratulations!`)
You can replace the messages inbetween the ``s
This couldn’t work either but i changed the " and absence of them with ’ and now works, so it turned into this:
$(eval var a = (Math.floor(Math.random() * 20) + 1); a <= 10? ‘You rolled a ‘+a+’. Oh well better luck next time.’ : ‘You rolled a ‘+a+’! Congratulations!’)
Thanks a lot!
Yeah I’m sorry bout the confusion it wasn’t sending my “`”s the second time but glad you got it working
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.