So I am trying to make a !slap command. I want it to read as follows. User slaps user with weapon and it was (randomeffectiveness)
I have the first part working fine. it picks a random weapon and life is great.
its part 2 (the random effectivness) that im struggling with.
Current command:
$(user) has slapped $(touser) $(eval var weapon=[“with a cactus.”,“with a frying pan.”,“with a brick.”,“with common sense.”,“with heavy sarcasm.”,“with a raw fish?”]; weapon[Math.floor(Math.random()*weapon.length)] $(eval a=[“It was super effective!”,“It was not very effective.”,”It does not affect $(touser).”]; a[Math.floor(Math.random()*a.length)]
Also those emojis should not be there. Its supposed to be a semicolon followed by a )
Uhm is it outputting an error for the second part of the command at all? Cause I don’t seen anything wrong with the second eval that would make it not work.
I think it’s because the second array uses wrong quotation marks, here’s a fix:
$(eval w=[`with a cactus.`,`with a frying pan.`,`with a brick.`,`with common sense.`,`with heavy sarcasm.`,`with a raw fish.`]; a=[`It was super effective!`,`It was not very effective.`,`It had no effect.`]; `$(user) has slapped $(touser) ${w[Math.floor(Math.random()*w.length)]} ${a[Math.floor(Math.random()*a.length)]}`)
And to post code lines like this ↑ add four spaces before the line, if you want to post more structured code put it between two set of three backticks: ```