Trying to make an IF this Then This + Random Query

Hello! so I’m trying to make it 50/50 chance to hit or miss. if you hit then it pulls a random lure and a random trap that $(user) is doing to $(touser) and if it misses they fail. I am just going with the querys i know so this is what i have:

!editcom !lure $(eval Math.floor(Math.random() *100);a<50? “$(user) has successfully lured $(touser) with a $(eval const responses = [‘$1 Bill’, ‘Small Magnet’, ‘$5 Bill’, ‘Big Magnet’, ‘$10 Bill’, ‘Hypno-Goggles’, ’ Presentation’]; responses[Math.floor(Math.random() * responses.length)]; ) into a $(eval const responses = [‘Banana Peel’, ‘Rake’, ‘Marbles’, ‘Quicksand’, ‘Trapdoor’, ‘TNT’, ‘Railroad’]; responses[Math.floor(Math.random() * responses.length)]; ) trap!”:“$(user) failed to lure $(touser)!”)

please help!

not bad, bot bad, u’re almost there… there’s no need for nested evals on this one and u forgot to define “a”… just a few tweeks like this…

!editcom !lure $(user) $(eval let a=Math.floor(Math.random()*100),b=[`$1 Bill`,`Small Magnet`,`$5 Bill`,`Big Magnet`,`$10 Bill`,`Pair of Hypno-Goggles`,`Presentation`],c=[`Banana Peel`,`Rake`,`Marbles`,`Quicksand`,`Trapdoor`,`TNT`,`Railroad`];a<50?`has successfully lured $(touser) with a ${b[Math.floor(Math.random()*b.length)]} into a ${c[Math.floor(Math.random()*c.length)]} trap!`:`failed to lure $(touser)!`)

note: i also made a small tweek to the grammar from “a Hypno-Goggles” to “a Pair of Hypno-Goggles”

Thank you!!! I could not figure it out for the life of me!

1 Like

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