Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Nemireck
Beginner


Joined: 15 Feb 2009
Posts: 10

PostPosted: Sun Feb 15, 2009 10:46 pm   

Anyone that can help me fix my combat script?
 
Hey there,

I've been playing a MUD called "Tharsis Gate" for a few years now using Zmud version 4.62. For YEARS I have used a simple combat script to run me through areas killing mobs, looting coins, etc. All the fun stuff a "Sit and stare at the screen" bot should have. I got ZMud 7.21 the other day, and lo and behold, my scripts no longer work! I'll take a moment to lay out how my trigs are set up, then describe the problem that keeps occuring, and HOPEFULLY, someone here can help me with my problem and get me back on track!

Ok, so I'll use the simplest bot I have. It's for an area that's a 3X4 grid that loops through itself (ie. 4-east, will return you to the room you began moving east in to begin with, vice versa for 5-south). The way I I set it up in ZMud 4.62 is that there's a core set of triggers, and then a seperate Movement trigger for each Mob, or each room that I need to attempt to kill a mob in, so it ends up looking like this:

CORE SET:

#CLASS {srb} {disable}
#TRIGGER {no imp here} {
kill warrior
}
#TRIGGER {no warrior here} {
kill harpy
}
#TRIGGER {no harpy here} {
kill mage
}
#TRIGGER {no mage here} {
#echo nextroom
}
#TRIGGER {meditation falters} {dec}
#TRIGGER {breo what} {kill imp}
#TRIGGER {You feel revitalised by the energy from the corpse} {dec}
#TRIGGER {The dark mage leaves} {
stop
kill imp
}
#TRIGGER {The flying harpy leaves} {
stop
kill imp
}
#TRIGGER {You do not have enough guild points to minordamage} {#tim}
#TRIGGER {Gp: (%d)/(%d)} {
#math shp (%1 - %2)
#if (@shp = 0) {#tim}
}
#TRIGGER {The impling leaves} {
stop
kill imp
}
#TRIGGER {Woops, you drew a square around the corpse instead of a circle} {dec}
#TRIGGER {The demon warrior leaves} {
stop
kill imp
}
#TRIGGER {died} {dec}
#TRIGGER {You do not have enough guild points to breo} {dec}
#CLASS 0


MOVEMENT:

#CLASS {s1} {disable}
#TRIGGER {nextroom} {
n
#wait 500
kill imp
#t- s1
#t+ s2
}
#CLASS 0

#CLASS {s2} {disable}
#TRIGGER {nextroom} {
e
#wait 500
kill imp
#t- s2
#t+ s1
}
#CLASS 0

Simply put, I run into a room, attempt to kill an imp. If no imp in the room, I attempt to kill a warrior, then harpy, then mage, if none of those options are in the room, I move on to to the next room. It's been working for the last 5 years in ZMud 4.62.

But in ZMud 7.21, when I run this exact script. Then THIS starts happening:

LOG:


Northeast square (east, north, west, south).
>srstart
> kill imp
No imp here!
kill warrior
> No warrior here!
kill harpy
> No harpy here!
kill mage
> No mage here!
nextroom
n
>
Northeast square (gates, east, north, west, south, door).
> kill imp
No imp here!
kill warrior
> No warrior here!
kill harpy
> No harpy here!
kill mage
> No mage here!
nextroom
e
>

*Working fine so far! But THEN*

Northwest square (east, northwest, north, south, west).
A demon warrior is here.
> The demon warrior dodges your attack.
Hp: 1457/1500 Gp: 869/1185
The demon warrior missed you.
kill imp
n
No imp here!
kill warrior
>

*BOOM, for some reason it starts entering directions BEFORE I echo another "nextroom", You'll notice there's a warrior in the room, in ZMud 4.62, it would have ran: kill imp -> kill warrior, then since no trigger pattern would be received, my character would stop and kill the warrior, when the warrior died, it would run through the sequence of kills again until "no mage here" is received, and it's time to move to the next room. INSTEAD, it made it to "kill imp" then started moving my character around some more! WTF is going ON?! It continues...*

Southwest square (east, north, west, south, door).
> No warrior here!
kill harpy
> No harpy here!
kill mage
> No mage here!
nextroom
> kill imp
No imp here!
kill warrior
> No warrior here!
kill harpy
> No harpy here!
kill mage
> No mage here!
nextroom
e
>
Southwest square (east, north, west, south).
A demon warrior is here.
> You missed.
You missed.
kill imp
n
No imp here!
kill warrior
>
Southwest corner (east, north, west, south).
> No warrior here!
kill harpy
> No harpy here!
kill mage
> No mage here!
nextroom
> kill imp
No imp here!
kill warrior
> No warrior here!
kill harpy
> No harpy here!
kill mage
> kill imp
No imp here!
> You missed.
Hp: 1461/1500 Gp: 875/1185
The demon warrior missed you.
You block the demon warrior's attack.
You graze the demon warrior.
A demon warrior arrives.



Anyway, that's my problem, sorry for the long post, but I've been using these for years in my old ZMud and now they're clearly broken. If anyone knows what's different about ZMud 7.21 that I need to adapt for my hunting script, please help me out!!!
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Mon Feb 16, 2009 12:10 am   
 
Usage of #wait is pretty much discouraged as you can live through a lot of unpleasant stuff with it as pretty much your log shows, too.

My advice would be to use #alarm instead.

So...

Code:

#CLASS {s1} {disable}
#TRIGGER {nextroom} {
n
#alarm +0.5 {
kill imp
#t- s1
#t+ s2
}
}
#CLASS 0

#CLASS {s2} {disable}
#TRIGGER {nextroom} {
e
#alarm +0.5 {
kill imp
#t- s2
#t+ s1
}
}
#CLASS 0


Here I used temporal alarm, indicated by the + sign at the front of the time interval (#alarm works with Seconds, so 500 ms with your #wait would equate to 0.5). You could also use a named alarm (indicated by * sign before time interval and usually preceeded by it's name in quotes), but judging by your code, that may be not what you're after.

As an aside, a lot of your triggers would also need a shake-up, it's usually a good practice to use as exact patterns as possible. I'd say even more in this case because it's a bot. But the patterns aren't your problem so I'm not commenting on that any longer.

Long story short - take a look at help #ALARM
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
Nemireck
Beginner


Joined: 15 Feb 2009
Posts: 10

PostPosted: Mon Feb 16, 2009 2:57 am   
 
Beautiful man, thanks.

My patterns are specific as they need to be for the game I'm playing, but I'll keep an eye on those too if any other problems occur.

The only reason I was using #wait was because without ANYTHING to stall, I would just run through every direction instantly and not stop to kill a thing, it was the first thing I tried in 4.62 and it worked so I went with it. I knew that #wait was causing the problems, just had NO idea what to do to fix it. So far I've been running for 15 minutes without problem so it looks like you hit the nail on the head. Awesome :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net