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, 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.
 Entire forum ➜ SMAUG ➜ Running the server ➜ What's wrong with this prog?

What's wrong with this prog?

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


Posted by Zeno   USA  (2,871 posts)  Bio
Date Thu 28 Jul 2005 09:36 PM (UTC)

Amended on Thu 20 Jul 2006 09:32 PM (UTC) by Zeno

Message
>speech_prog "test 1"
if iscarrying($n) == 154
else
if iscarrying($n) == 14
if iscarrying($n) == 1011
if iscarrying($n) == 15
if iscarrying($n) == 20
mpforce $n give arm Slooguntitsu
mpjunk arm
mpforce $n give leg Slooguntitsu
mpjunk leg
mpforce $n give wood Slooguntitsu
mpjunk wood
mpforce $n give mushroom Slooguntitsu
mpjunk mushroom
mpoload 151
give crystal $n
endif
endif
endif
else
mea $n Slooguntitsu says "You do not have the items! Go get them!"
endif
endif


If I have the wood, arm and leg, and say the syntax, the mob will do nothing at all.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #1 on Fri 29 Jul 2005 02:07 AM (UTC)
Message
I don't think you are supposed to put quotes around the syntax you want it to match. Test it with the quotes and see what he does.

~Nick Cash
http://www.nick-cash.com
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Fri 29 Jul 2005 02:09 AM (UTC)
Message
No, heh, the prog works fine else if you have the all the items etc. Quotes are fine.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Raz   (32 posts)  Bio
Date Reply #3 on Sat 30 Jul 2005 05:24 AM (UTC)
Message
>speech_prog "I have the items"
if iscarrying($n) == 154
else
if iscarrying($n) == 14
if iscarrying($n) == 1011
if iscarrying($n) == 15
if iscarrying($n) == 20
mpforce $n give arm Slooguntitsu
mpjunk arm
mpforce $n give leg Slooguntitsu
mpjunk leg
mpforce $n give wood Slooguntitsu
mpjunk wood
mpforce $n give mushroom Slooguntitsu
mpjunk mushroom
mpoload 151
give crystal $n
endif
endif
endif
else
mea $n Slooguntitsu says "You do not have the items! Go get them!"
endif
endif


Meh. This is ugly formatting. Let us do it the Python way to show you your problem:

>speech_prog "I have the items"
if iscarrying($n) == 154
else
> if iscarrying($n) == 14
    if iscarrying($n) == 1011
      if iscarrying($n) == 15
        if iscarrying($n) == 20
          mpforce $n give arm Slooguntitsu
          mpjunk arm
          mpforce $n give leg Slooguntitsu
          mpjunk leg
          mpforce $n give wood Slooguntitsu
          mpjunk wood
          mpforce $n give mushroom Slooguntitsu
          mpjunk mushroom
          mpoload 151
          give crystal $n
          endif
         endif
       endif
   else
      mea $n Slooguntitsu says "You do not have the items! Go get them!"
      endif
   endif


If you look at the program, I think the last else is tied to the if statement that I marked with an ">". Your problem should be there.

Test your program out without whatever object is vnum 14. If it displays the correct error message, then you have a problem with the logic of the code.

-Raz
C++ Wiki: http://danday.homelinux.org/dan/cppwiki/index.php
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Sat 30 Jul 2005 05:31 AM (UTC)
Message
How would I have the prog require all the items then? This actually isn't a prog I did, but I'm wondering.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Raz   (32 posts)  Bio
Date Reply #5 on Sun 31 Jul 2005 05:23 AM (UTC)
Message
Isn't there some conjuction or union operator in SMAUG mobprogs? Cannot you go something like:

if hasobj(1) && hasobj(2) ...

?

-Raz
C++ Wiki: http://danday.homelinux.org/dan/cppwiki/index.php
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #6 on Sun 31 Jul 2005 06:06 AM (UTC)
Message
Not that I know of. I know you can do something with or:
if hasobj(400)
or
if hasobj(401)

But that's it. Let me know if there's an and statement I don't know about.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #7 on Mon 01 Aug 2005 07:06 PM (UTC)
Message
SMAUG mobprogs are extremely limited. If you go look at the code, you'll see that it's not really a programming language at all. There is an 'or' but I don't believe there's an 'and'.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Ralf   (1 post)  Bio
Date Reply #8 on Thu 20 Jul 2006 07:22 PM (UTC)
Message
I realize this is an old post and you've probably already discovered your mistakes by now. Still, it turned up in my search from Google, so I'll go ahead and answer it.

The way your original program is written, you will only get the success actions if you have ALL 4 items, and you will only get the fail message if you are missing the item numbered 14.

I'm not terribly familiar with mob progs, but if you put the else mea ... after each if clause and then break, it should work. This means a total of 4 else statements, not counting the first one.

The other possibility is if mob progs have a negation ability, so that you could ask if a player doesn't have 14, or a player doesn't have 1011, or ... then fail else success.
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.


23,246 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.