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!
I started getting an error again, so took a bunch out until it worked again.
Slowly adding them back in and saw I missed an uptick, which is probably what caused it.
Yeah, these are the common mistakes, also pay close attention to the Note section in the post I linked.
Glad you figured out the issue by yourself though, not many do, good job!
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...`)
ah thanks, yeah wasn’t sure if it was possible, so made something that I think does the same thing as what you put, though probably in a more sloppy way
$(user) threw a pokeball at $(eval a=$(urlfetch json LINK;a[Math.floor(Math.random()*a.length)]) The wild pokémon $(eval R=[was caught!,escaped!];R[Math.floor(Math.random()*R.length)])
all the pokemon in the pastebin I made had ! after their name, so made this one work around that