A pastebin command with variables for the second half

hi can someone help me with this command i found and worked on

!editcom !battle A wild $(user) appears & attacks $(touser)! $(user) uses $(eval a=$(urlfetch json https://pastebin.com/raw/Ap6zNgF3);a[Math.floor(Math.random()*a.length)]). $(eval var a=[“It misses…”,“It’s super effective! $(touser) faints”,"It’s not very effective… "]; a[Math.floor(Math.random()*a.length)];)!

The command works all the way to the link. But the rest doesnt work out

Hey @Duckyy360!

If you use more than one $(eval) you’re doing something wrong, everything can be contained in one, and it also helps speed up the execution of your code, here’s a fix:

!addcom !battle $(eval u = '$(user)'; t = '$(touser)'; r = a => a[Math.floor(Math.random() * a.length)]; s = $(urlfetch json https://pastebin.com/raw/Ap6zNgF3); o = [`It misses...`, `It's super effective! ${t} faints`, `It's not very effective...`]; `A wild ${u} appears & attacks ${t}! ${u} uses ${r(s)}. ${r(o)}`;)

I think your issue with the second part of the command was that you were using the wrong quotation marks: “” instead of "", '' or ``.

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