mob/verb |
Problem description:
So, sometimes, when I log in the server, my save have just "gone", and I log like this:
Luan12(Luan12) have logged in the server.
then my verbs, my char, everything is just GONE
Code:
Problem description: So, sometimes, when I log in the server, my save have just "gone", and I log like this: Luan12(Luan12) have logged in the server. then my verbs, my char, everything is just GONE | ||
#1 Feb 20 2012, 1:58 am
|
|
the problem describtion didn't give me much information though.
| |
#2 Feb 20 2012, 5:14 am
|
|
Ok, you have the save right? YOur character, your verbs, your vars saved...
BUT, sometimes in the server, I don't know why god in a beautifull morning you enter in the server and: PÁ, you lose your save! And in the server, when you enter appears this: YourKey(YourKey) has logged in the server instead YourName(YourKey) has logged in the server, you know? | |
#3 Feb 20 2012, 8:08 am
|
||
First off, you should not be calling Read() and Write() directly, and you are saving incorrectly.
| ||
#4 Feb 20 2012, 8:48 am
|
||
You can't use F["x"] and such directly. Those need to be loaded into local vars before you use them in locate().
Otherwise though you're quite correct, it's a bad idea to call Read() or Write() directly. | ||
What's wrong with using F["X"], F["Y"], and F["Z"] directly as it pulls the data from the savefile? I would assume it's better than creating 3 new variables to load what could be done directly.
| |
Which proc I call to save and load?
To Save -> only Save or Save and write? like this: usr.Write() usr.client.Save() To Load -> only Load or Read too? like this: usr.Read() usr.client.Load() | |
#8 Feb 20 2012, 10:42 am
|
||
Do not call them at all (Read()/Write()), they call themselves automatically.
| ||
With your SAVE System, i create the char, when I relog appears the same bug...
You're in the first screen of the server, your name and your status are just gone... | |
Neimo wrote:
What's wrong with using F["X"], F["Y"], and F["Z"] directly as it pulls the data from the savefile? I would assume it's better than creating 3 new variables to load what could be done directly. Unless I'm way out of date on this, it can't be done directly; a savefile does not actually work like an associative list, and needs the << and >> operators to function correctly. | |
#12 Feb 20 2012, 12:18 pm
|
|
Well what Neimo was saying was that you shouldn't be calling Read() and Write() directly, with which I agree; you should do the location saving/loading inside those routines. The only correction I had was that the way he implemented the Read() won't work. You need to load the x,y,z coords into local vars and then use locate().
| |
You must be out of date then, you can check for yourself; receiving data directly doing F["x"] is possible.
Luan12 wrote: With your SAVE System, i create the char, when I relog appears the same bug... Have you tried using client/New() and client/Del() for saving and loading? Are you logging in twice? Does it actually create the savefiles? | |
#14 Feb 20 2012, 12:38 pm
|
|
Yes, I recreated the char. NO, i'm not loggin in twice
| |
Yes to what? Show everything that you have dealing with your saving/loading system.
| |
#16 Feb 20 2012, 1:00 pm (Edited on Feb 20 2012, 1:38 pm)
|
||
I recreated it. Ok, i'll show:
| ||
I hope you still aren't having any problems and that you can read English pretty well. (from your game's language)
I just wrote this and did not test anything -- I compile tested -- so if any bugs report let me know. | ||
#18 Feb 23 2012, 8:55 am
|
|
Another way to go, as a nicer option, is you can look at whether the file exists before presenting the new/load/delete options, and hiding or disabling those that don't apply.
| |