Help With a Custom Command Involving Custom APIs

So I’m trying to create a custom love and hate command using multiple custom APIs within it. It was going rather well and I have the format just the way I want it more or less. Unfortunately, since new users are not allowed to post more than two links in a single post I am unable to post the command in all it’s glory. However, here is an example command using only two links:

!commands add !feelings $(urlfetch http://2g.be/twitch/randomnumber.php?=defstart=0&defend=100)%
<3 and $(urlfetch http://2g.be/twitch/randomnumber.php?=defstart=0&defend=100)%
SMOrc

The real command is pretty ugly and involves a $(urlfetch) within a $(urlfetch). The example command suffices to work in its stead, though, as the problem I am asking for help with can be applied to it as well. This is what the example command would yield if typed in my chat:

8% <3 and 30% SMOrc

In essence, I’ve told it to do this:

(random number)% <3 and (random number)% SMOrc

Now that I have that format set up, I need the command to generate the same random number twice, or generate it once and then use that same number in two separate places in the command. This is more or less how I am picturing it:

X% <3 and X% SMOrc

Where X is a random number generated, but it is the same number throughout the command. I just don’t know how to do that is all. Any help is appreciated!

:smile:

In case you are wondering though, the real command uses a math API with a random number API as part of the function in question and can be formatted like this:

X% <3 and [100 - X]% SMOrc

That’s just not possible natively at this time, sorry. You would need to have a custom API created that returns the same value twice, or one that returns the expected output all in one response.

Oh, okay. Thanks for letting me know!

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