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
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jun 12, 2008 2:01 am   

A small item to be added to wish list
 
I think that an onReconnect native event would be very nice indeed.
_________________
Sic itur ad astra.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Jun 12, 2008 2:07 am   
 
Why? If I can ask. I know my onConnect activates when it reconnects.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jun 12, 2008 2:26 am   
 
How do you know you are re-connecting? There are things one wants to do on re-connect that may be different from the original connect, since you may already be live in the MUD. Right now I keep a flag that I reset on quit so I know whether this is the first time or not. An onReconnect event would be a lot cleaner.

EDIT: an onReconnect event would fire if CMUD detected a connection loss and then re-established then connection. The connection loss could be due to the user quitting the MUD or the connection dropping. This event would not fire if the application were closed and reopened before an attempt at connection.
_________________
Sic itur ad astra.

Last edited by Anaristos on Thu Jun 12, 2008 2:32 am; edited 1 time in total
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Thu Jun 12, 2008 2:27 am   
 
theres some things you might want to do only onreconnect versus on a initial connect
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Jun 12, 2008 2:31 am   
 
Anaristos wrote:
How do you know you are re-connecting? There are things one wants to do on re-connect that may be different from the original connect, since you may already be live in the MUD. Right now I keep a flag that I reset on quit so I know whether this is the first time or not. An onReconnect event would be a lot cleaner.


Hmm, yes it would. Good thought.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Jun 12, 2008 9:13 am   
 
Make it a parameter! true if it's the first connection, false if it's any other connection :D
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jun 12, 2008 9:38 am   
 
I am already doing that. I have an ONINPUT trigger monitoring "quit" to reset the parameter. I must say that this type of methodology is rather kludgy, though effective. As I said, onReconnect would be be much cleaner. I don't think that it would take much to implement it. In fact, what would happen is that CMUD would be taking care of the flag, rather than my trigger, which would make running the application the tiniest bit faster.
_________________
Sic itur ad astra.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Jun 12, 2008 10:54 am   
 
Why's it kludgy? The intention would be to allow the functionality you want (detecting when a connection is a reconnect) without changing the current functionality (OnConnect is raised every time it connects). Having a separate onReconnect would break scripts that're intended to be run every connection regardless of when during the session they are, and would require having two events with the exact same code. Seems perfectly sensible to me to use a single event for this purpose.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jun 12, 2008 5:17 pm   
 
I think a parameter is a good idea. I'm already thinking of adding some more useful parameters to various events. I don't think the distinction between onConnect and onReconnect is enough to warrant an entirely new event type.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jun 12, 2008 11:52 pm   
 
I understand what you are saying, Zugg. It was only a small wish.

As for what you said, Fang, it wouldn't break anyone's code. The onReconnect event would fire and then the onConnect event would fire, in that order. So if you didn't care about reconnection, then you just would abstain from having any thing coded for it. That's how events are handled in most systems.
However, using a native parameter on the onConnect event works just as well. Kludgy refers to my managing the parameter not CMUD.
_________________
Sic itur ad astra.
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