Author Topic: Saving And Loading Vars  (Read 2344 times)

If all works correctly, you shouldn't have to. You manage the variables in the game, and only load them on first startup so the information is ready. Of course, if you have enough people, individual files might be better, but you can't expect that many. You might want to export maybe every time people leave to make sure a server crash doesn't lose as much information, though. Just execute the file on server startup, export in joins or leaves or something, and once more for regular closing. Stuff like that.
If enough people go to the server and it saves their variables will it not eventually crash from too many variables?

I would rather make it so each person has their own txt file so it only executes their own variables when they join.
« Last Edit: December 08, 2011, 09:31:24 AM by jes00 »

If enough people go to the server and it saves their variables will it not eventually crash from too many variables?

I would rather make it so each person has their own txt file so it only executes their own variables when they join.

I doubt there would be enough people playing an individual server within a reasonable time to create a large enough list that would break the game. Age of Time is set up like that, but the files track tons of information.

I doubt there would be enough people playing an individual server within a reasonable time to create a large enough list that would break the game. Age of Time is set up like that, but the files track tons of information.
Ok.

I know the function for someone leaving the game but what are the functions for the game ending, for the game beginning and for someone entering the game?

Ok.

I know the function for someone leaving the game but what are the functions for the game ending, for the game beginning and for someone entering the game?

You don't need functions for the "game ending/beginning".

package this

function gameConnection::autoAdminCheck(%client)
{
     parent::autoAdminCheck(%client);
}
« Last Edit: December 08, 2011, 02:43:51 PM by Superb »

You don't need functions for the "game ending/beginning".

package this

function autoAdminCheck(%client)
{
     parent::autoAdminCheck(%client);
}


Change function autoAdminCheck to function gameConnection::autoAdminCheck.

Change function autoAdminCheck to function gameConnection::autoAdminCheck.

Oops, silly mistake lol.

And don't change the parent, as it will work.

If I use the auto admin check will it not be called every time someone joins the server?

If I use the auto admin check will it not be called every time someone joins the server?

Every time someone joins your server it checks to see if the client who is connecting deserves admin. So yes it is always called when someone joins.

Every time someone joins your server it checks to see if the client who is connecting deserves admin. So yes it is always called when someone joins.
Which is bad because it would execute the file every time someone joins and spam the console.

Which is bad because it would execute the file every time someone joins and spam the console.

You specifically asked for individual files to be loaded for each player. That will always spam console. That's why I suggested saving information for everyone in one file so it's only loaded and saved under less frequent situations.

You specifically asked for individual files to be loaded for each player. That will always spam console. That's why I suggested saving information for everyone in one file so it's only loaded and saved under less frequent situations.
I suppose it would either have to load individual files or load when anyone joins because if someone new joins, leaves, and comes back it would need to reload it to get the new info. In this case it would need to be saving whenever a players vars are changed, which is why I think individual files would be better.

What you do is keep saving them to a file, but keep the actual data live on the game. Then all you worry about is reloading the saved information on startup. You could create periodic save everyone's info. You wouldn't need to load it every join.

What you do is keep saving them to a file, but keep the actual data live on the game. Then all you worry about is reloading the saved information on startup. You could create periodic save everyone's info. You wouldn't need to load it every join.
Why would I not need to load it every join?

Why would I not need to load it every join?

What makes you think exporting the variables removes them from the games memory? They're still there, you don't need to reload them.