I’m basically trying to make a “Who’s that Pokemon” command for a friend, but because of character limits could only get 30 in.
So was looking to use something like Pastebin to list them all and then nightbot select from there.
I’m completely new to this kind of thing, so will need help put as simply as possible.
$(eval a=$urlfetch json mylink);a[Math.floor(Math.random()*a.length)]) is what I had been trying with, but get unexpected identifier and then the math bit.
Am completely new to this kind of thing, so will need it explained very bascally
That said, I’m not sure this will give you the desired result, as this will pick a random item of your array every time, and not give you specific information on the Pokemon you may be looking for, for that have a look here:
The only limit that applies here is the total length of the response, the length of the JSON file doesn’t matter, so if you only use the JSON to generate an output, you have up to 400 characters per Pokemon description, which should be enough, haha!
Ah, now I see what you want to do.
You want the first command to give you the description of one specific command, and then you want to type !catch to try to catch it, right? So that won’t be possible if you want the response to be “$(user) caught POKEMON_NAME”, as Nightbot won’t remember the state of the previous command, or doesn’t read its previous message either, and this is not what aliases are for, they don’t work this way.
The closest response you can get is “$(user) (didn't) caught it!” or something like that.
So here’s a draft of what the command could be:
$(eval r=Math.floor(Math,random()*2); r==1?`$(user) succesfully managed to catch it, congratulations!`:`Unfortunately, $(user) wasn't so lucky this time...`)