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
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Sat Jul 26, 2008 10:00 pm   

[2.33] Alarm firing to more than 1 window. *SOLVED*
 
When, for instance, a onminute alarm fires like #ALARM {*:10} {#SAY test} that is in a module and you have more than 1 window open the alarm fires in ALL the windows at each minute.

If you watch the script debugger, its actually firing the alarm 2 times or once for each window open. This is causing major problems with duplicate info being sent to the main window... For instance if your alarm calls an alias, that alias then reports something to your main window... since the alarm fires 2 or more times it replicates the firing of the alias 2 or more times as well.

This was tested in a blank session and reproduced easily.


Last edited by Toxic on Mon Jul 28, 2008 5:37 pm; edited 1 time in total
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jul 26, 2008 11:01 pm   
 
To clarify what Toxic is talking about (and a bit more step-by-step instruction):

Create a module with the following alarm:

#ALARM 10 {#SAY This alarm fired.}

Save that module (I suck at saving modules, so don't ask me how.

Go to a new blank session.
At the command line, type "#WIN test1"
Go to package editor, install the module you just saved.
When your alarm fires, it'll fire twice (once for test1 window and once for main window), but all output will be put in the main window.

This is relative to the post I had made earlier about my alarm double firing sometimes. I have four windows open, but my triggers are under a class in the window, not a module. Still haven't figure out why it's firing twice, though...

Charneus
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jul 27, 2008 3:15 pm   
 
This is actually by design, and was the result of many discussions in earlier betas.

A global module containing such an alarm will fire the alarm in all windows that can see it. If you use the '-' instead of '*' to specify the alarm as a connection based alarm, then it will only fire in windows that can see it and actually have a connection.

If you consitently use alarms with an * base then adjust the position of them to a module that is appropiately scoped to only the windows you want it to fire in, or place the alarm directly in the window it should interact with. That was part of the point of the scoping discussions that went on through numerous betas. When the alarm is in a window it only fires in that window, and when a script is in a global module, but run from that window it can see the alarm and interract with it. This allows multiple alarms with the same name in multiple windows, with a single control alias in a global module to work properly.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Mon Jul 28, 2008 1:44 pm   
 
So your saying if I use .... #ALARM {-*:00:00} {bleh} it would work only for the window showing connection?
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Mon Jul 28, 2008 5:34 pm   
 
Oh I see... so then it only uses the connection timer... Which is NO good for onhour alarms. So basicly the only way to tie an alarm to the main window only is by putting it under that window in the class tree?
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jul 28, 2008 6:50 pm   
 
Yes, the alarm should be within the window that you want it to fire in. Or, if you must use an external module, put it in it's own package and then disable that package for the windows that you don't want the alarm to fire in.

Or, in your alarm script, you could test the current window using the %curwin variable and only execute the script if the window name is equal to whatever window you want it to fire in.
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