I need help with a command

!addcom !enamorar $(eval a=[$(user) tiene un $(customapi http://2g.be/twitch/randomnumber.php?=defstart=1&defend=40)% de probabilidades de enamorar a $(query) :( ,$(user) tiene un $(customapi http://2g.be/twitch/randomnumber.php?=defstart=41&defend=69)% de probabilidades de enamorar a $(query) :/,$(user) tiene un $(customapi http://2g.be/twitch/randomnumber.php?=defstart=70&defend=100)% de probabilidades de enamorar a $(query) <3];a[Math.floor(Math.random()*a.length)])

Hiya, can you explain what you are trying to create, what isn’t working?

2 Likes

If I understood, he wants to create a command of 3 different “fall in love to”
A chance until 40%
A chance of 40 - 69%
A chance of 69 - 100%

I took a look in the custom api, but in the 69-100, for example, still taking numbers less then 69.
And the command doest work exactly.

Something like:
Random user have 40 to fall in love with $(user), random user have 41-69 to fall in love with $(user) and random user have 70-100 to fall in love with $(user)

1 Like

Yeah, I’m just not sure of the use case here, there’s 3 options/ranges of numbers where 1 is randomly chosen, so why not just do a 1-100?
The API works, however the parameters are not provided correctly:
randomnumber.php?=defstart=1&defend=40 should be randomnumber.php?defstart=1&defend=40

However this can be done by javascript $(eval) as a whole:

!commands edit !enamorar $(eval var i = Math.floor(Math.random() * 100), t;  if(i < 41) { t= `:[`; } else if (i < 70) { t= `:/`; } else { t = `<3`;} `$(user) tiene un ${i} de probabilidades de enamorar a $(query) ${t}`)

Only change I made in the text is the sad smile, :[ instead of :( since I’m not sure how to escape the ( character, this will break the $(eval).

1 Like

YES YES YES! THIS WAS WHAT I WAS LOOKING FOR! Sorry for not explaining, I forgot, this command works perfect. Thank you very much and sorry again

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