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

Quote:
Originally Posted by sonicintuition View Post

So ....I'll hail the NPC with a rogue, and get "You are not a caster! You are a caster!" ....

Code:
sub EVENT_SAY
{
if($text=~/hail/i && ($class eq 'Warrior' || $class eq 'Rogue'))
{
quest::say("You are not a caster!");
}
if($text=~/hail/i && ($class ne 'Warrior' || $class ne 'Rogue'))
{
quest::say("You are a caster!");
}
}
Sonic
broken logic. on the "second" if, if i'im a rogue, it will fire because, you're asking a different question:

if $text contains "hail"

and

the $class is either ( not warrior ) or (not rogue)

which is true if you're a rogue ( rogue != warrior ).

converse statements (ones containing "negations" ) are usually tricky and require some care. you're easiest bet would be to construct it like follows:

if( contains "hail" )
{
if( class1 ) { do something }
elsif (class2 ) { do something else }
elsif( class3 ) { do something else }
...
else { do the other thing }
}


hope this helps.

== sfisque
Reply With Quote