for(var/v in l)
world << "Hit check [v]"
switch(v)
if("Fly")
msg(a, b, " - [a.name] could not be hit")
return
if("Dig_Attack")
msg(a, b, " - [a.name] could not be hit")
return
if("Bounce_Attack")
msg(a, b, " - [a.name] could not be hit")
return
for(var/v in l)
world << "Hit check [v]"
switch(v)
if("Fly" || "Dig_Attack" || "Bounce_Attack")
msg(a, b, " - [a.name] could not be hit")
return
Problem description:
The first example of code displays "Bounce_Attack" to the world, and stops the person from being hit.
The 2nd example of code show "Bounce_Attack" but does not prevent the person from being hit.
Why is if(value || value || value) not a valid way of checking if the switch value is the same as 1 or more other values?
Thanks
"fly" is true, "dig_attack" is true, and "bounce_attack" is true, so you've got the equivalent of:
I believe you're looking for commas, but I'm not certain - look up the switch statement in the DM reference. It should have some mention of them.