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 Goto page Previous  1, 2
graywolf Posted: Sun Aug 26, 2001 2:34 pm
String lists and pattern matching
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Fri Aug 31, 2001 4:58 pm   
 
Hmm...must've skipped that post for some unknown reason. Sorry about that. When you say it only happens when you use a path, do you slow walk the path? Do you use the #step command? The #pause command to stop in a room for a sec? Can you give us a basic rundown of the WHOLE script. I think it goes like this: You've got a path that you're gonna walk through to kill things. You start walking the path. When you get to a new room, your room triggers will go off to check for killable NPCs and if no one else is in the room, you'll kill all the killable monsters until there are none left. Then you go on to the next room in the path. Is this how you do it?

Again, I apologize for not reading more carefully. Maybe that bug does exist and since there are other loop structures to use instead of #until it's never showed up until now. If you can give us the steps on how you've got the script set up, we can test the #until command to see what the problem is with that command.

Iljhar
Reply with quote
graywolf
Apprentice


Joined: 21 Jul 2001
Posts: 116
Location: USA

PostPosted: Fri Aug 31, 2001 6:39 pm   
 
When I say i use the path i am simply typing

.guardhouse

the build in zmud path commands.

To Explain ...

My bot is kinda complicated..
i have a class called equipment
in that class I have a classes called gloves, boots, ring, body, bag, etc...
in each of these classed i have an alias called Start which runs and alias called Arrive then i call an alias called Attack, which checks to see if there are any Player charactors in the, then I check to see if the monster carring the specific piece of equipment i am looking for is in the room, then check to see if anyone else has claimed the monster, then kill the monster if all those checks are satisfactory. When the specific monster dies i get the equipment and call an alias called Leave which brings me back to a central location that i run all my scripts from then i disable the class i am in and enable the next class and call the alias Start in the new current class. I left out some of the other features that i have like auto healing and wimpying stuff etc...

anyways ...

When I walk thru many rooms quickly my DeleteAcceptableItems was being called numerous times, i believe the problem was happening because it was not having time to finish running before it got called again, then the until check would just freak out and quit checking at all Zmud would get a little glitch at this point, I assumed this was because of the fact that it was doing so many calculations it just wasn't having time to do the basic stuff like refresh the screen quickly and the sort. I have found away around this BUG by only calling the deleteacceptableitems alias when i want those things deleted as opposed to doing it on every room i enter, even while speedwalking from one place to another. I hope that this explains the problem better. Please Let me know if you need further explination.

Graywolf
Reply with quote
sunshine
Newbie


Joined: 17 Feb 2002
Posts: 1

PostPosted: Mon Feb 18, 2002 1:40 am   
 

If you're still working on that code, or want to find out what is really happening, there's a hint:

That looks like a concurrent programming problem: i.e. the same code/data is run/accessed at the same time by multiple "threads". Usually systems that have parallel processing also provide synchronization solutions (semaphores, mutexes), which is not the case of Zmud. You might already know all of this, but if you don't, here is how it works: a flag (called a mutex) is set when a certain routine or data is accessed. When the thread finsihes with that routine/data, the flag is cleared. If any other thread tries to access it while the first thread is still working, it will be stopped by the mutex.

You won't be able to emulate that somehow, since you'll have to perform two operations (test the value of the flag, and then set it, if the resourece is free) in one *atomic* (uninterruptible) operation. (Why uninterruptible? Imagine that a thread is interrupted just after it has seen that the resource is free, but before it manages to set the mutex. Meanwhile, another thread might come in and find out that the resourece is not used, and set the mutex. When the fist thread comes into turn again, it won't check the mutex, because it already has done that, and it was free (at that time). So you'll end up with a conflict.)

But at least you can find out if that's the problem. Set up a variable (e.g. @mutex ) to have the value of 0 at the beggining of the script. Then, add these lines to the DeleteAcceptableItems alias:

#ALIAS DeleteAcceptableItems {
#show Mutex is: @mutex
mutex=1
...
// the body of the alias goes here....
...
mutex=0
}

Needless to say, you should *never* see a "Mutex is: 1" message.


Sunshine.

- A day without fusion is like a day without sunshine.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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