|
kjaerhus Magician
Joined: 18 Dec 2006 Posts: 317 Location: Denmark
|
Posted: Sun Jan 14, 2007 2:04 pm
Scripts stopping/pausing when changing active window |
Most actions in the game I play have a roundtime, for instance appraising your weapon make take 8 seconds.
Ok, so I have scripts that combine a number of such actions. I capture the amount of seconds to wait and then wait that amount before continuing.
I have several windows open and have triggers filtering certain output from the mud to these windows.
This worked nicely in zMud, but in CMUD it seems the script just stops or pauses when I activate another window than the script is running in.
This must be a bug or what? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Jan 14, 2007 2:44 pm |
Are you using #WAIT? Because that can cause all kinds of problems when scripts are trying to run at the same time if you put it in a trigger. Use #alarm instead.
|
|
|
|
kjaerhus Magician
Joined: 18 Dec 2006 Posts: 317 Location: Denmark
|
Posted: Sun Jan 14, 2007 3:03 pm |
I am using #WAIT. I'll take a look at #ALARM instead then. It did work fine in zMUD though.
Thanks for the quick reply. |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Mon Jan 15, 2007 4:29 pm |
zMUD is single-threaded and uses a processing loop trick to emulate multiple thread execution (from what I gather) to prevent #WAIT from interfering with other scripts (as it once did).
CMUD is multi-threaded and capable of executing multiple operations in parallel. However, this makes CMUD considerably more complex internally.
In my opinion, #WAIT should be removed from CMUD entirely as it's not needed for anything, only encouraging less-than-optimal script writing. There are a few other ways to handle delays or queues in CMUD/zMUD. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jan 15, 2007 4:57 pm |
Agreed. A newbie would (and rightly so) see the #wait command and go "ah, that's perfect!" without considering how or why it works. Finding #alarm isn't much more complicated.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Jan 15, 2007 7:46 pm |
I'm in agreement also.. but I say deprecate (and use at your own risk). Much like the venerable GOTO it served its purpose well but caused no end of headaches. There are those rare few things though, where only a GOTO will suffice. (Admittedly I can't think of an analogous one for #WAIT)
|
|
_________________ Asati di tempari! |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Tue Jan 16, 2007 1:09 am |
#WAIT has its uses, mostly inside loops to slow down output where alarms wouldnt be the best.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jan 17, 2007 11:02 pm |
There is also a known bug that causes alarms to stop counting when you click on other MUD windows (or child capture windows).
But yes, #WAIT is a real problem because it's so attractive to new users. Tech's comparison with "GOTO" is a really good one. A long time ago people thought that getting rid of "GOTO" was going to be the end of the world. And yet most people can program perfectly well (and better!) without it. I'm still hoping that I can someday fix #WAIT to work for normal situations, but it's always going to leave dangling threads which is never a good idea. |
|
|
|
|
|