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

Gammon 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?

What's wrong with this prog?

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


Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] 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
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] top

Posted by Raz   (32 posts)  [Biography] 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
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] top

Posted by Raz   (32 posts)  [Biography] 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
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] 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
[Go to top] top

Posted by Ralf   (1 post)  [Biography] 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.
[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.


5,733 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]