Recently been working on a Pokédex commands. It randomly generates Pokémon stats. I was wondering if there was a way to also have a feature to choose specific Pokémon from the list as well. $(eval a=$(urlfetch json https://pastebin.com/raw/example).split(,);a[Math.floor(Math.random()*(a.length-1))])
Help With A Command :)
11 replies
As far as I know you can only use .split on strings so try
$(eval var a="$(urlfetch json https://pastebin.com/raw/example)";var b=a.split(",");b[Math.floor(Math.random()*b.length)]
As for the pastebin file write it like this:
Pokemon1,Pokemon2,Pokemon3,etc.
Sorry I didn’t see the second part how would you want that to look ?
If someone types !command followed by a pokemon name it should pull up that Pokémon?
But if they just type !command it would pull up a random one?
If that’s what you want try this
$(eval var a="$(urlfetch json https://pastebin.com/raw/example)";var b=a.split(",");var c="$(query)";c=="null"?b[Math.floor(Math.random()*b.length)]:c in b?c:"Pokémon “"+c+"” does not exist.")
Also how are you writing the Pokémon’s names in the list all lowercase, all capital, first letter capital?
Anyways hope this helps.
Didn't find your answer? The community is on Discord.
Ask on Discord