View Single Post
  #8  
Old 09-02-2007, 12:59 AM
sfisque
Hill Giant
 
Join Date: Oct 2006
Posts: 248
Default

Quote:
Originally Posted by sonicintuition View Post
Hmm ..seems that using string operators makes no difference either.

Example:


According to you guys, this should work ..but it still doesn't work. I hailed this npc with a wizard and the npc said both lines. I hailed her with a rogue, and she said both lines ...I'm stumped? I'm going to try adding the other parenthises to see if that helps.. will post back here if it does.

Regards,
Sonic
logic failure. && has higher precedence than ||. you basically want, in this case:

Code:
if($text=~/hail/i && ( $class eq 'Rogue' || $class eq 'Warrior') )
you need to group the two class comparisons because if you dont, the logic says:

if the text contains "hail" and class eq 'Rogue'

OR

class eq 'Warrior'

whereas you want:

if the text contains 'hail'

AND

the class is either Rogue or Warrior

== sfisque
Reply With Quote