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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Jul 03, 2010 1:28 am   

[322B] onExit Event fires for all window closings.
 
I don't know whether this is a bug or a program feature, however, now when any window is closed the onExit event is raised.
_________________
Sic itur ad astra.
Reply with quote
Tech
GURU


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

PostPosted: Sat Jul 03, 2010 11:58 pm   
 
Can you be more specific? As I understand it's supposed to fire on clicking on the CMUD 'x', closing the session window, and going to the menu and choosing either File -> Close or File -> Close All.

Did you mean one of those?
_________________
Asati di tempari!
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sun Jul 04, 2010 3:12 am   
 
No, I mean that when I close any window during the session the event will fire. That is why my current onExit event code is like this:
Code:

<event event="onExit" priority="1250" id="125">
  <value>#IF (%window = @Windowname) {comreset} //To accomodate how onExit works at the present time.</value>
</event>

I verify that the main window is closing before I do anything.

(WindowName = %session.WindowName)

EDIT: Very easy to test. Put an #ECHO or #PRINT in your event script. Then create a window and close it. The string will be output to the screen. If you have an open window that you don't need, closing it will do the trick.
_________________
Sic itur ad astra.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jul 04, 2010 5:35 am   
 
Confirmed.
_________________
EDIT: I didn't like my old signature
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Jul 05, 2010 12:51 am   
 
Is anyone else having CMUD give them a crash error whenever they simply try to close the main session window?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Jul 05, 2010 4:50 am   
 
1)Chamenas should probably start a new thread

2)nope, but it might be related to the reconnect AV that's been reported
_________________
EDIT: I didn't like my old signature
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Wed Jul 07, 2010 9:41 pm   
 
It also seems that the only time this event won't fire is when the X on the upper right hand corner is clicked.
_________________
Sic itur ad astra.
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Jul 07, 2010 10:42 pm   
 
Well, technically this is correct. Events don't care who fires them. They are not aliases or triggers. For example, think about an "onPrompt" event. When this event is fired you want it to execute any onPrompt event defined in any window and any package.

So onExit is doing this too. When you close a window, the onExit window fires, which causes *any* onExit script to run. The only reason this didn't happen in the past was because onExit was not getting fired by closing a window (which was a bug).

I'm not sure how I can change this without adding some weird kludged exception to how onExit works compared to any other event.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jul 07, 2010 11:19 pm   
 
Does the onExit event include any parameters? Such as the window name? If so, users could test the name of the window. This would actually be useful be useful in several ways, I think.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jul 08, 2010 12:07 am   
 
When the onExit event fires, the %window variable will contain the window name.
_________________
Sic itur ad astra.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jul 08, 2010 12:23 am   
 
Anaristos wrote:
It also seems that the only time this event won't fire is when the X on the upper right hand corner is clicked.

I meant by this that the event will fire on all window closings but it won't fire if one exits the application completely either by the above method or by clicking on File|Exit. I am thinking this is still a bug.
_________________
Sic itur ad astra.
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jul 08, 2010 4:14 pm   
 
Quote:
I meant by this that the event will fire on all window closings but it won't fire if one exits the application completely either by the above method or by clicking on File|Exit. I am thinking this is still a bug.

There isn't much I can do about this. When you click the X button or use File/Exit you are telling Windows to immediately close the application. In fact, the X button bypasses many of the normal Windows messages that File/Exit normally executes. Running a script (like onExit) creates a thread, but Windows tries to close all threads when it exits an application. So to do this I would need to add a delay to wait until the script thread exits. I really hate adding any code to the application close routine that waits on anything. It would be really easy to screw up your script and cause CMUD to crash on exit or just hang.

I'm really going to need to think about all of this. I'm really starting to think that onExit is more trouble than it's worth for the vast majority of users.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jul 08, 2010 10:41 pm   
 
Well, any onExit event is better than no onExit event. I can live with the way it works now.
_________________
Sic itur ad astra.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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