ID:151020
 
This is the code for my savefile stuff. It sucsesfuly saves the name of the character and loads it, but It won't save or load the HP, wealth, strength, MP, and inventory that the player has gained. Whats the use of it If those arn't saved? Some one please help me. (I got this from Deadrons tutorial)



mob
Login()
icon_state = gender
var/savefile/F = new("players.sav")
F.cd = "/[ckey]"
var/list/characters = F.dir
var/newCharacterChoice = ""
var/list/menu = new()
menu += characters
menu += newCharacterChoice
var/result = prompt("Who do you want to be today?", null, "Choose a charactor or create a new one") in menu
if (result == newCharacterChoice)
name = CreateNewCharacter()
else
F.cd = "/[ckey]/[result]"
F["full_name"] >> name
return ..()
CreateNewCharacter()
var/char_name = prompt("New character",null, "What is the character's name?") as text
SaveCharacter(char_name)
return char_name
SaveCharacter(char_name)
var/savefile/F = new("players.sav")
var/safe_name = ckey(char_name)
F.cd = "/[ckey]/[safe_name]"
F["full_name"] << char_name
F["/[ckey]/[safe_name]/full_name"] << char_name


client/proc/SaveMob()
var/savefile/F = new("players.sav")
var/char_ckey = ckey(mob.name)
F["[ckey]/[char_ckey]"] << mob
client/proc/LoadMob(char_ckey)
var/savefile/F = new("players.sav")
F["[ckey]/[char_ckey]"] >> mob




mob
var/tmp/Person

Write(savefile/F)
..()

F["/players/[ckey]"] << Person
return

Read(savefile/F)
..()

F["/players/[ckey]"] >> Person
return</<></<></<></<>
On 6/3/01 3:09 pm Kunark wrote:
mob
var/tmp/Person

Write(savefile/F)
..()

F["/players/[ckey]"] << Person
return

Read(savefile/F)
..()

F["/players/[ckey]"] >> Person
return

Remove the tmp from the Person var and it will be saved for you automatically, unless you have a reason for storing it elsewhere.

If the problem vars aren't in the Person object, then you'll need to list them.

I'd also recommend instead using the new Character Handling library, which has an updated approach to saving mobs:

byond://Deadron.CharacterHandling
In response to Deadron (#1)
On 6/3/01 3:43 pm Deadron wrote:
On 6/3/01 3:09 pm Kunark wrote:
mob
var/tmp/Person

Write(savefile/F)
..()

F["/players/[ckey]"] << Person
return

Read(savefile/F)
..()

F["/players/[ckey]"] >> Person
return

Remove the tmp from the Person var and it will be saved for you automatically, unless you have a reason for storing it elsewhere.

If the problem vars aren't in the Person object, then you'll need to list them.

I'd also recommend instead using the new Character Handling library, which has an updated approach to saving mobs:

byond://Deadron.CharacterHandling



I would like to visit the CharacterHandling Library, I'm sure that will help me alot, but my computer won't let me download it - when the .dm file coms up, its blank. Please, I would be most appreciative if you could reply to this and cut and paste the stuff thats in that .dm file for Character Handling and post it in the reply.
In response to Kunark (#2)
On 6/4/01 3:50 pm Kunark wrote:
byond://Deadron.CharacterHandling
I would like to visit the CharacterHandling Library, I'm sure that will help me alot, but my computer won't let me download it - when the .dm file coms up, its blank. Please, I would be most appreciative if you could reply to this and cut and paste the stuff thats in that .dm file for Character Handling and post it in the reply.

Is that the case with the latest version of BYOND? If so I'll try uploading a version again.

Since it's a library, it's not practical to copy and paste it, but we'll get it working.
In response to Deadron (#3)
It works now (:
In response to Kunark (#2)
On 6/4/01 3:50 pm Kunark wrote:
On 6/3/01 3:43 pm Deadron wrote:
On 6/3/01 3:09 pm Kunark wrote:
mob
var/tmp/Person

Write(savefile/F)
..()

F["/players/[ckey]"] << Person
return

Read(savefile/F)
..()

F["/players/[ckey]"] >> Person
return

Remove the tmp from the Person var and it will be saved for you automatically, unless you have a reason for storing it elsewhere.

If the problem vars aren't in the Person object, then you'll need to list them.

I'd also recommend instead using the new Character Handling library, which has an updated approach to saving mobs:

byond://Deadron.CharacterHandling



I would like to visit the CharacterHandling Library, I'm sure that will help me alot, but my computer won't let me download it - when the .dm file coms up, its blank. Please, I would be most appreciative if you could reply to this and cut and paste the stuff thats in that .dm file for Character Handling and post it in the reply.

"when the .dm file coms up, its blank" I found that when you try to open a dm file that does not have an envioment it loads up blank but if I enter it throuh the lib file in a project that has an enviment it works. (note: this is from byond version 290)
In response to Xzar (#5)
On 6/4/01 6:31 pm Xzar wrote:
"when the .dm file coms up, its blank" I found that when you try to open a dm file that does not have an envioment it loads up blank but if I enter it throuh the lib file in a project that has an enviment it works. (note: this is from byond version 290)

Yeah I filed this as a bug last week two -- it's quite annoying, cause when you open it this way then close the project, it asks if you want to save, and I have a guess that it might be trying to wipe out the file.
In response to Deadron (#6)
On 6/4/01 9:42 pm Deadron wrote:
On 6/4/01 6:31 pm Xzar wrote:
"when the .dm file coms up, its blank" I found that when you try to open a dm file that does not have an envioment it loads up blank but if I enter it throuh the lib file in a project that has an enviment it works. (note: this is from byond version 290)

Yeah I filed this as a bug last week two -- it's quite annoying, cause when you open it this way then close the project, it asks if you want to save, and I have a guess that it might be trying to wipe out the file.

I think I must be doing something wrong, because I haven't seen this problem. Can you give me boneheaded step-by-step instructions to reproduce it? Pretend I don't know anything. You'll be closer to the truth than you might imagine! :)
In response to Tom (#7)
On 6/4/01 9:47 pm Tom wrote:
On 6/4/01 9:42 pm Deadron wrote:
I think I must be doing something wrong, because I haven't seen this problem. Can you give me boneheaded step-by-step instructions to reproduce it? Pretend I don't know anything. You'll be closer to the truth than you might imagine! :)

1) Create a library with no .dme file.

2) Close DreamMaker.

3) In the file system, open a file in that library.

4) It comes up in DreamMaker with no content showing.

5) When you close DreamMaker it asks you if you want to save.
In response to Deadron (#8)
On 6/4/01 10:23 pm Deadron wrote:
1) Create a library with no .dme file.

2) Close DreamMaker.

3) In the file system, open a file in that library.

4) It comes up in DreamMaker with no content showing.

5) When you close DreamMaker it asks you if you want to save.

I'm still not seeing the problem. I'm testing by double-clicking on .../lib/dantom/htmllib/htmllib.dm in the filesystem (it has no corresponding .dme file). It opens up Dream Maker and puts that file in the "External" directory in the little file tree. What happens when you try this case?