Mob Prog syntax question.. please help!

Posted by Gatewaysysop2 on Tue 01 Apr 2003 08:40 PM — 2 posts, 11,923 views.

USA #0
Perhaps I'm just not understanding the documentation or all the examples I've seen myself, but can someone please tell me why this particular greet program is causing the mobs that use it to attack evil pcs who are NOT pkillers?


if isevil($n)
and isnpc($n)
or ispkill($n)
say Death to thee $n!
murder $n
endif

My thinking is that this should attack only evil NPCs and ALL pkillers, no one else. But as I said, I'm getting this to attack evil PCs who are not flagged as pkillers. While this isn't a *big* issue, I was hoping to leave evil peacefuls alone when it came to using this program.

Does anyone have a clue at all why this would attack evil peacefuls? Any suggestions on a fix? It does not touch non-evil NPCs or Peaceful PCs if that helps.

Thanks!
USA #1
Quote:

if isevil($n)
and isnpc($n)
or ispkill($n)
say Death to thee $n!
murder $n
endif

My thinking is that this should attack only evil NPCs and ALL pkillers, no one else. But as I said, I'm getting this to attack evil PCs who are not flagged as pkillers. While this isn't a *big* issue, I was hoping to leave evil peacefuls alone when it came to using this program.


Ok, best way to fix this would be nested if statements. It has been my repeated experience that AND and OR in mprogs are more trouble than theyre worth since the mprog engine seems to guess at which conditions you want to meet. Try using the following and see if it clears the problem.

if isevil ($n)
     if isnpc($n)
        say Death to thee $n!
        murder $n
     if ispkill ($n)
        say Death to thee $n!
        murder $n
else
     break
endif


However the seemingly desired effect of attacking just pkill chars may not be met with that particular mprog. For that goal, you may need to use something more like this.


if isevil ($n)
     if isnpc($n)
         say Death to thee $n!
     else
         break
endif

if ispkill ($n)
say Death to thee $n!
endif