[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Running the server
. . -> [Subject]  What's wrong with this prog?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: What's wrong with this prog?
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Ralf   (1 post)  [Biography] bio
Date Thu 20 Jul 2006 07:22 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Mon 01 Aug 2005 07:06 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Sun 31 Jul 2005 06:06 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Raz   (32 posts)  [Biography] bio
Date Sun 31 Jul 2005 05:23 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Sat 30 Jul 2005 05:31 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Raz   (32 posts)  [Biography] bio
Date Sat 30 Jul 2005 05:24 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Fri 29 Jul 2005 02:09 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Fri 29 Jul 2005 02:07 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Thu 28 Jul 2005 09:36 PM (UTC)  quote  ]

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
[Go to top] 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.


2,637 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]