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 ➜ Running the server ➜ Problem with MUD progs

Problem with MUD progs

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


Pages: 1 2  

Posted by Kris   USA  (198 posts)  Bio
Date Wed 21 Mar 2001 11:57 AM (UTC)
Message
The problem is with the Rupina mob, in the fight 99 prog. The intent is to have her difficulty based upon the level of the player she's fighting. Also, against higher levels that do more damage, I want her to restore herself every round. However, she's not restoring herself, and some of the commands don't seem to be getting executed. I've been testing her with a level 20 character. It gave me error messages about needing brackets so, at least as far as I assumed, I went ahead and put in opening and closing brackets to the if statements. That only made things worse. These mob progs don't seem to conform to any programming language I've ever heard of. And there are no help files whatsoever that specifically deal with syntax such as this. Could you take a look at this for me please? It's been bugging me for weeks. Thanks :)


mpechoat $n Rupina looks at you with her sad, lonely, silent eyes......
mpechoaround $n Rupina gazes into $n's eyes......
mpechoat $n
mpechoaround $n
mpechoat $n A horrible feeling of guilt passes over your soul.....
mpforce $n yell I do not deserve to live anymore!  Forgive me, Rupina!
mpecho
mpechoat $n You scream with emotional agony!!
mpechoaround $n $n sobs like a little girl....
if level($n) <= 5
{
mpdamage $n 5 15 lethal
endif
}
if level($n) <=10
{
if level($n) > 5
{
mpdamage $n 15 30 lethal
endif
}
endif
}
if level($n) <= 20
{
if level($n) > 10
{
mpdamage $n 30 60 lethal
mprestore rupina 80
endif
}
endif
}
if level($n) <= 30
{
if level($n) > 20
{
mpdamage $n 60 100 lethal
mprestore rupina 100
endif
}
endif
}
if level($n) <= 40
{
if level($n) > 30
{
mpdamage $n 100 200 lethal
mprestore rupina 100
endif
}
endif
}
if level > 40
{
mpdamage $n 500 2000 lethal
mprestore rupina 100
endif
}
mpechoat $n You scream with emotional agony!!
mpechoaround $n $n sobs like a little girl....
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 21 Mar 2001 12:02 PM (UTC)
Message
There seem to me to be three problems with this fight program:

If does not use curly brackets

This IF statement ends with an ENDIF. The braces are not used, unlike C.

Blank lines cause the program to terminate

I found that if I left blank lines in the program anything after the blank line would not be executed.

mpdamage has a different syntax

As far as I can tell from the code, mpdamage simply specifies who to damage and by how many HP, eg.


mpdamage $n 60


Here is my amended program that appears to work:


mpechoat $n Rupina looks at you with her sad, lonely, silent eyes......
mpechoaround $n Rupina gazes into $n's eyes......
mpechoat $n
mpechoaround $n
mpechoat $n A horrible feeling of guilt passes over your soul.....
mpforce $n yell I do not deserve to live anymore!  Forgive me, Rupina!
mpecho
mpechoat $n You scream with emotional agony!!
mpechoaround $n $n sobs like a little girl....
if level($n) <= 5
  mpdamage $n 5
endif
if level($n) <=10
 if level($n) > 5
   mpdamage $n 15
 endif
endif
if level($n) <= 20
 if level($n) > 10
   mpdamage $n 30 
   mprestore rupina 80
 endif
endif
if level($n) <= 30
  if level($n) > 20
    mpdamage $n 60 
    mprestore rupina 100
  endif
endif
if level($n) <= 40
  if level($n) > 30
    mpdamage $n 100 
    mprestore rupina 100
  endif
endif
if level($n) > 40
  mpdamage $n 500
  mprestore rupina 100
endif
mpechoat $n You scream with emotional agony!!
mpechoaround $n $n sobs like a little girl....

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kris   USA  (198 posts)  Bio
Date Reply #2 on Wed 21 Mar 2001 01:31 PM (UTC)
Message
I don't get it. I'm totally lost. Now, with the code you provided, -nothing- happens, save that "Rupina looks at you with her blah blah lonely blah eyes...."
I also had a test mob prog on there, which was intended to see if mprestore really works. It used to work, but now, even though I didn't alter it in ANY way, it just returns "Huh?" when it reaches the mprestore command. I have no idea what's going on, save that something is really really screwed up.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 21 Mar 2001 01:57 PM (UTC)
Message
Well, I don't know what you have done, but here is my log:


<52hp 100m 120mv>
kill rupina
You miss Rupina.

<52hp 100m 117mv>
You wound Rupina!
Rupina scratches you.
Rupina looks at you with her sad, lonely, silent eyes......

A horrible feeling of guilt passes over your soul.....
You yell 'I do not deserve to live anymore! Forgive me, Rupina!'

You scream with emotional agony!!
You scream with emotional agony!!

<46hp 100m 114mv>
You injure Rupina!
Rupina grazes you.
Rupina looks at you with her sad, lonely, silent eyes......

A horrible feeling of guilt passes over your soul.....
You yell 'I do not deserve to live anymore! Forgive me, Rupina!'

You scream with emotional agony!!
You scream with emotional agony!!

<40hp 100m 111mv>


You can see that Rupina's HP is going down about 6 each time (one for the fight, and 5 from the mob prog I imagine).


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kris   USA  (198 posts)  Bio
Date Reply #4 on Wed 21 Mar 2001 10:43 PM (UTC)
Message
When I copied your example, I forgot to delete the spaces between each line (didn't even notice they were there). Like you said, it stopped execution after the first blank line, and worked after I fixed that.
How do I get the mobhere if statement to work? Here is a test greet prog I have for Rupart:
if mobhere(Rupina)
say Ruuuuppppiiiinnnnaaaaa!!!!
endif
It gives me the following error message when the greet prog activates:
Log: [*****] BUG: Unknown ifcheck, Mob #20101.
I've tried as many variations on the "if mobhere(Rupina)" line as I could possibly think of, but again the mob progs.doc file isn't very helpful at all. This is the information it provides:
"mobhere name Is a NPC with this name in the room"
Ok, so I know what mobhere does. Kinda funny how it assumes that you don't know what it is, yet you would know how to use it. I have no idea how to get the syntax on that to work.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 22 Mar 2001 01:16 PM (UTC)
Message
Try:


if mobinroom(99)
.. blah blah ..
end if


Where 99 is your mob vnum.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kris   USA  (198 posts)  Bio
Date Reply #6 on Thu 22 Mar 2001 04:40 PM (UTC)
Message
Still won't work.... It doesn't give me the error message now, but the if statement still isn't firing. Rupina's mob vnum is 20102, and this is my code:

if mobinroom(20102)
say Ruuuuppppiiiinnnnaaaaa!!!!
endif

What am I doing wrong?
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #7 on Thu 22 Mar 2001 06:28 PM (UTC)
Message
Ah I see. I didn't actually test it. :)

You need to say:


if mobinroom(20102) >= 1


The if check "mobinroom" returns the number of mobs in that room.

Type "help ifchecks" into SMAUG and you will see what all the if checks do. Here is an extract from it:


IFCHECKS
VALUE CHECKS (If check == #/string/vnum)
Ifcheck        Question                      Ifcheck    Question
------------   ---------------------------   ---------  ------------------
Hitprcnt       Percentage of hit/max_hit?    Sex        Sex?
Deity          Name of deity?  (STRING)      Name       Name?  (STRING)
Level          Experience level?             Inroom     Room #?  (VNUM)
Objtype        Type of Object?               Str        # of strength?
Objval#        Value# equal to this?         Int        # of intelligen
Number         Is its vnum equal to this?    Wis        # of wisdom?
Position       Position #?                   Dex        # of dexterity?
Clan           Clan name?  (STRING)          Con        # of constituti
Race           Race name?  (STRING)          Cha        # of charisma?
Mobinarea      Is mob in area?               Mobinworld Does mob exist?
Mobinroom      How many of mob?  (VNUM)      Lck        # of luck?
Guild          Guild name?  (STRING)         Goldamt    # of gold ya go
Class          Class name?  (STRING)         Favor      # of favor?
Mobinvislevel  Level of invis?               Economy    # of economy?
Council        Member of council?            Hps        # of hps?
Mana           # of mana?                    Mortal      *Not In Use*
------------   ---------------------------   ---------  ------------------
 
Value checks can use == (equals) > (greater than) < (less than) 
and ! (not).  Combine for:  != (not equal) >= (greater than or equal).


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kris   USA  (198 posts)  Bio
Date Reply #8 on Fri 23 Mar 2001 01:53 PM (UTC)
Message
WOOHOO! It works now! :)
......
......
Now, how do I put delays in the mob programs? I.E. I can get Rupina to respond to what Rupart may say, but it's kinda dumb if suddenly the screen is spammed with like a 5 minute conversation all in the period of a millisecond or so. Like, maybe a second or three after one action, before the other mob's action will fire? That would allow me to have various mobs discussing the weather too, which would be kinda fun :)
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #9 on Sun 25 Mar 2001 02:48 AM (UTC)

Amended on Sun 25 Mar 2001 02:49 AM (UTC) by Nick Gammon

Message
Not sure about doing that.

One way is to do something like lower the probability a mob program will fire.

eg. rand_prog with a randomness of 20%


See the mob "Silvina" in the area newacad.are


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kris   USA  (198 posts)  Bio
Date Reply #10 on Fri 06 Apr 2001 07:42 PM (UTC)
Message
for some reason, mppeace doesn't seem to work on mobs at all. The mob in combat couldn't do it to anyone, so I had it force another mob to do it. The mob was able to get the player to peace, but the mob that he was fighting was not 'in that room'; in other words, not a valid target. So I tried mppurge and just have the mob invoke a copy of itself before it did so. However, this specific mob is a shop mob, and when you invoke it, it doesn't retain any of its special qualities. How should I tackle this problem?
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #11 on Fri 06 Apr 2001 08:52 PM (UTC)
Message
Did you try:


mppeace all



Apparently that stops all in the room from fighting.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kris   USA  (198 posts)  Bio
Date Reply #12 on Fri 06 Apr 2001 09:07 PM (UTC)
Message
Here is a copy of the mob prog:

yell I do not wish to fight you, $n! If you are troubled, just talk to me and we can try to work it out! :)
mprestore $n 100
mpechoat $n Eric chants some strange words and heals your wounds.
mpechoaround $n Eric chants some strange words at $n and an aura of healing briefly envelops $m.
mprestore self 4550
mpecho Eric mutters some strange words to himself and an aura of healing briefly envelops him.
tell $n Why did you attack me? Have I offended you somehow? If so, I hope we can work this out peacefully
mppeace all


Problem is, now Eric's the only one that sits down, and the fight continues until I die. I tried also putting in an mppeace $n, but then I was the only one who sat down. I tried just putting in like 10 mppeace things in hopes of one of them working, but no effect.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #13 on Fri 06 Apr 2001 11:13 PM (UTC)

Amended on Sat 07 Apr 2001 12:51 AM (UTC) by Nick Gammon

Message
Hmmm - that one had me puzzled for a while, but I worked it out.

The problem is, although you don't say it, I gather you have put this program into the "fight_prog".

Now if you look at the log carefully:


<2590hp 3000m 3090mv>
Your pierce misses Eric.
Eric brushes you.
You dodge Eric's attack.
Eric's kick misses you.
Eric brushes you.
You parry Eric's attack.
Eric brushes you.
Eric chants some strange words and heals your wounds.
Eric mutters some strange words to himself and an aura of healing briefly envelops him.
Eric tells you 'Why did you attack me? Have I offended you somehow? If so, I hope we can work this out peacefully '
Log: Eric: mppeace all
Eric sits down.

Eric brushes you.
Eric brushes you.
Eric's kick brushes you.
You dodge Eric's attack.
Eric's kick misses you.
Eric's kick scratches you.


The line I have put in bold shows that peace does briefly descend, but as it happens inside the fight program, that the fight must effectively start up again.

I have been trying to work out a way around this, which isn't too easy. One idea worth trying would be to have a second mob in the room (maybe invisible) that when it detects a fight does the "mppeace all".

It could have a rand_prog 50, and in it do:


if isfight(Eric)
mppeace all
endif


I haven't tested this, but something along those lines should work.

Instead of Eric you might have to put Eric's vnum.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kris   USA  (198 posts)  Bio
Date Reply #14 on Sat 07 Apr 2001 09:43 PM (UTC)
Message
I tried that, once with Eric and once with his vnum. Both times, whenever the rand_prog fired, I got
Log: [*****] BUG: Unknown ifcheck, Mob #20204.
(20204 is the vnum of the invissed mob you suggested I use)

I followed the exact syntax you specified.
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.


63,603 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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.