Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Mob Prog syntax question.. please help!

Mob Prog syntax question.. please help!

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gatewaysysop2   USA  (146 posts)  Bio
Date Tue 01 Apr 2003 08:40 PM (UTC)
Message
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!

"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #1 on Wed 02 Apr 2003 12:24 AM (UTC)
Message
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

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


9,489 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.