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
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Wed Nov 07, 2007 2:21 am   

Change the Use Default for variables to not reset variables at reconnect?
 
I've never been a huge fan of defaults for variables for the following reason - they get reset when you reconnect to the mud. So if you lose your connection to the MUD due to some network issue, or you have to drop link for a minute for whatever reason, all your variables get reset when you reconnect. It was also like this in zMUD, but the documentation never made this clear:
zMUD and CMUD Manuals wrote:
If a defaultval is specified, the variable is initialized to that value when the settings are loaded or the #RESET command is used.

I would have taken that to mean that the variables are reset when you *open* your session.

Now, as Zugg has suggested on many occasions since he implemented variables with defaults not getting saved to the database in CMUD 2.0, we should be using defaults for much better performance. Fang describes his system:
Fang Xianfu wrote:
My combat system never ever makes changes to the database, except in an OnDisconnect event for things that simply must be kept between sessions (like a database of how many times I've died and what to). Things like current and max stats, affliction lists and whatnot can all be safely marked as Use Default (with nothing in the default box - in the future, I'll just use Lua variables for this, which're never automatically saved) and given a value when you start the client.

I like the *idea* of this, but I don't want to lose the contents of my variables when I reconnect - that could kill me. There are many variables that I don't need saved between sessions, but I do need saved across link failures!
Reply with quote
Tech
GURU


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

PostPosted: Wed Nov 07, 2007 4:59 am   
 
I don't think this should change.

The settings are loading when you *connect*. Consider this you open your session offline, maybe do some testing or tweak and you defaults variables have funky values. You then go online , if you didn't reload your variables your then you'll have unexpected results.

What it boils down to, when you disconnect, and reconnect CMUD really has no idea how much time has passed. I have kept my session open for 10+ hours disconnecting and reconnecting and without know what your variables are used for (and how long between connections) CMUD wouldn't know what to do.
_________________
Asati di tempari!
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Nov 07, 2007 6:01 am   
 
I can see both sides of this one. There certainly isn't any technical reason why there can't be a "nosave" variable that doesn't reset upon connection. Reconnecting doesn't cause the package files to be reloaded or anything like that. I'll give this some thought. Maybe the "nosave" option needs to be separated from the "use default" option so that you can make them different when desired.
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Wed Nov 07, 2007 2:01 pm   
 
After reading about how database saving affects our script times I've got to admit, I'd be moving a whole lot more of my database variables to USE Default if I didnt know that if my network connection died for any reason I'd need to repopulate them again, If I've forced a #dis followed by a #CON to flush remaining commands out of my character in the mud I've not got a whole lot of time to stop my character from dieing and the information stored in those constantly changing variables could very easily be the key to making the difference between whether or not I have to start my level over.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Nov 07, 2007 5:45 pm   Re: Change the Use Default for variables to not reset variables at reconnect?
 
Seb wrote:
There are many variables that I don't need saved between sessions, but I do need saved across link failures!

Another reason why Lua variables are better ;) They're only lost when the program exits.

Vijilante brings up a good point in another thread though - if you want your variables reset each connection, you can create an OnConnect event to run #reset. There's no similar method to stop your use default variables from resetting.
_________________
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: Wed Nov 07, 2007 6:07 pm   
 
I think I'm going to change the Use Default so that it only resets variables when the package is loaded and *not* when you reconnect. As Vijilante mentioned in another thread, it's easy for someone to put a #RESET command in the onConnect event if they really want to do that. So hopefully this will be fixed in v2.11.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Thu Nov 08, 2007 2:21 am   
 
Zugg wrote:
As Vijilante mentioned in another thread, it's easy for someone to put a #RESET command in the onConnect event if they really want to do that.

Just what I was going to suggest after just reading Tech's post! #RESET is so easy to type, you can also do it from the command line if you have been testing your variables with "funky" values. Smile And if you don't know about the #RESET command and have been testing offline, you can still close and reopen your session to reset the variables.

[Edit: Heh, exactly 24 hours to the minute since my last post in this thread.]
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