ID:139885
 
Code:
            ForceSave(M as mob in world)
M.client.Save()
M<<"Your progress has been saved."


Problem description: For my game, it automatically saves when you log out, and I make constant updates. So, the idea is that I use this verb before I reboot to add the updates, so it saves everyone's progress, because I know for a fact that the Save() proc saves the user's vars, except for when I reboot. I think it's because it resets everything, including user variables. Any help?

This code would be to force 1 person to save.

You would need to loop though all mobs with a client (or through clients) and call save for each of them.
In response to Pirion
Alright... how do I connect to their client? M.client.Save() makes an error: GM.dm:2076:error: M.client.Save: undefined var
In response to Colin1011
you would want to do a loop like the following:

proc/saveall()
for(var/client/C)
C.save()
C << "Saved by Saveall Proc"
In response to Pirion
Now it just gives me some errors when I reboot, and then the Connection fails. It says: runtime error: Cannot execute null.Save()
In response to Colin1011
Show the code snippet you're using?
In response to Schnitzelnagler
K....
Save/Load Code:
client
proc
Save()
var/savefile/F = new("[ckey].sav")
F["mob"] << mob
// Do not add anything more to be saved here
Load()
if(fexists("[ckey].sav"))
var/savefile/F = new("[ckey].sav")
F["mob"] >> mob
// Do not add anything more to be loaded here

mob
Write(var/savefile/F)
..()
// Add any special processing for saving here
F["x"] << src.x
F["y"] << src.y
F["z"] << src.z
Read(var/savefile/F)
..()
F["x"] >> src.x
F["y"] >> src.y
F["z"] >> src.z
// Add any special processing for loading here

Reboot Code:
            Reboot(){set category="GM";Announcement("World will reboot in 10 seconds.");
sleep(100);world.Reboot()}

Proc Code:
mob/proc/SaveAll()
for(var/client/C)
C.Save()
C << "Your progress has been saved!"

Command Code:
            ForceSave()
SaveAll()
In response to Colin1011
Where is forcesave called?
In response to Pirion
mob/verb/ForceSave()
.
It's a verb for GMs...
In response to Colin1011
    Logout()
world<<"<font color = purple>[src.name] has logged out."
client.Save()
del(src)


This was posted in the other thread as your logout?

Its posible that by the time it trys to execute client.Save() that the client is gone, so you would get null.Save()

I would move it to client/Del() so when the client disconnects it saves.
In response to Pirion
It gives me an error when I do client.Save() for the Del() proc, so do I do this?
client
Del()
src.Save()
In response to Colin1011
Yes, as it is the client, you switch client to src.
In response to Pirion
Whenever I use the verb, then Reboot, once the Reboot is done, the Connection fails...
In response to Colin1011
I noticed that when I try to start it again, it begins as Connection fails. But when I go to the folder for the game, delete my save file, it works again. Does this help at all?