ID:140571
 
Code:
world
mob = /mob/creating_character
name = "Dragonball Z: Hypnotic Existence"
hub = "Cyberlord34.DragonballZHypnoticExistence"
status = "Dragonball Z: Hypnotic Existence - <font color=red>Closed Testing"
view = 7
loop_checks = 0
map_format = TILED_ICON_MAP
New()
var/savefile/Bs = new("Save Files/Bans.sav")
var/list/L = list()
Bs["Bans"] >> L
if(!L) return
for(var/obj/Save_Object/Ban/B in world) if(B.loc) del(B)
for(var/obj/Save_Object/Ban/B in L)
B.loc = locate(185,210,10)
var/savefile/Gs = new ("Save Files/Guilds.sav")
var/list/Ls = list()
Gs["Guilds"] >> Ls
if(!Ls) return
for(var/obj/Guild_Objects/Guild_Approved/G in world) if(G.loc) del(G)
for(var/obj/Guild_Objects/Guild_Approved/G in Ls)
G.loc = locate(185,210,10)
..()
Del()
var/savefile/Bs = new("Save Files/Bans.sav")
var/list/L = list()
for(var/obj/Save_Object/Ban/B in world)
L += B
Bs["Bans"] << L
var/savefile/Gs = new("Save Files/Guilds.sav")
var/list/Ls = list()
for(var/obj/Guild_Objects/Guild_Approved/G in world)
Ls += G
Gs["Guilds"] << Ls
..()


Problem description:
Whenever I Restart the server, the objects don't get loaded. Basically the save isn't working. Can anybody tell me what I should look up, or what to do to make a better method?
This is an alternate method you can use. Attach a var to the object for it's location, and just make a list to put the object's into.

obj
var
lastx
lasty
lastz
Save_Object
Ban
Guild_Objects
Guild_Approved
var
list
Save_Objects = list()
world
New()
if(fexists("Save Objects.sav"))
var/savefile/F = new ("Save Objects.sav")
F >> Save_Objects
for(var/obj/Save_Object/Ban/B in Save_Objects)
B.loc = locate(B.lastx, B.lasty, B.lastz)
for(var/obj/Guild_Objects/Guild_Approved/G in Save_Objects)
G.loc = locate(G.lastx, G.lasty, G.lastz)
Save_Objects.Cut()
..()
Del()
var/savefile/so = new("Save Objects.sav")
for(var/obj/Save_Object/Ban/B in world.contents)
B.lastx = B.x
B.lasty = B.y
B.lastz = B.z
Save_Objects.Add(B)
for(var/obj/Guild_Objects/Guild_Approved/G in world.contents)
G.lastx = G.x
G.lasty = G.y
G.lastz = G.z
Save_Objects.Add(G)
so << Save_Objects
..()
In response to Perfection144
This is a poor method. There is no need for the object to carry ugly dummy vars. You are freely able to save whatever data you want into a savefile, regardless of whether there is an object var corresponding to it or not.
Also, save and load handling of an object should be done in its Write() and Read() procs, respectively.

The DM Guide's savefile chapter covers all of this, so you, as well as the OP, should read it.
In response to Kaioken
Kaioken wrote:
This is a poor method. There is no need for the object to carry ugly dummy vars. You are freely able to save whatever data you want into a savefile, regardless of whether there is an object var corresponding to it or not.
Also, save and load handling of an object should be done in its Write() and Read() procs, respectively.

The DM Guide's savefile chapter covers all of this, so you, as well as the OP, should read it.

I apologize. I haven't dealt with object saving very much. I only know two method's to it.
In response to Perfection144
No apology needed, since no harm was done, especially not to me. =)
Oh, but just don't quote whole posts when replying to them. The quote button isn't for that; people can know who you're replying to even if you don't quote at all.
Every instance I've ever received warnings/runtime errors for loop_checks, it was something I had to fix. Is there actually situations where messing with loop_checks is needed?
In response to Kaioken
Got it, thanks. By the way, not in a fanboy sense or anything, but I absolutely love your programming. Especially your projectile demo. =)
In response to Moonlight Memento
There generally aren't, you're correct. Disabling loop checks is highly inadvisable, since their purpose is to check for a problem (a game-hogging infinite loop) and alert you about it.