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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: 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?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
kjaerhus
Magician


Joined: 18 Dec 2006
Posts: 317
Location: Denmark

PostPosted: 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.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: 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.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Jan 16, 2007 1:09 am   
 
#WAIT has its uses, mostly inside loops to slow down output where alarms wouldnt be the best.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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