ID:148238
 
Ok. A friend needs help but he claims you people just flame him so I wont mention his name.
Well here's the problem. In the game things can be built (like a house for example) and the house should be saved when the server goes down. That *would* work but when something is build the server crashes (as is just closes the whole game). It might be the building code conflicting with the saving code I'm not sure . Both Green Lime's and Super16's obj saving examples were used and didn't work. So don't bother saying go use one of them.
Anyway here's the code for saving the objects...
var/list/objs = list ()

world/New()
..()
if(fexists("Map.sav"))
var/savefile/F = new ("Map.sav")
F >> objs
for(var/obj/Build/o in objs)
o.loc = locate(o.saved_x,o.saved_y,o.saved_z)
objs.Cut()
return ..()

world/Del()
var/savefile/F = new("Map.sav")
for(var/obj/Build/o in world.contents)
o.saved_x = o.x
o.saved_y = o.y
o.saved_z = o.z
objs.Add(o)
F << objs
return ..()
and this is to build an object...
mob/carpenter/verb
Build()
set category = "Carpentery"
// switch(input("What do you want to build?","Build What?") in list("Bed","Cancel"))
var/list/buildinglist=new()
var/O
for(O in usr.buildlist)
buildinglist += O
buildinglist += "Cancel"
var/b = input("What do you want to build?","Build What?") in buildinglist
if(b=="Bed")
if(usr:lumber >= usr:item_cost)
view(6) << "[usr.name] places a Bed."
var/a = new/obj/Build/bed(usr.loc)
a:owner = "[usr.key]"
usr:item_cost = a:item_cost // Takeing the objs itemcost and showing it on stats var.
usr:totalcost += usr:item_cost // Adding and subtracting with item cost.
usr:lumber -= usr:item_cost
usr.build2 += 1
// SaveObjects()
else
usr << "Cannot build....."
That is just the code for building a bed.
Anyway anyone know whats wrong? If so want to share it with me?</<>
Wow. There's a whole lot of : crap in that code. Tell your friend to do type casting and use . instead.

Lummox JR
In response to Lummox JR
Will that help at all or is it to make the coding neater?
In response to Yuugi
Using : will not work in as many situations as using . will.
In response to Jotdaniel
Using : instead of . will give you less compiler errors, but potentially more runtime errors (which are usually harder to track down). It also has the added benefit of making the code easier to read. =)