ID:270994
 
the code i have for my saving is this:

Save_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] << src.mob
S["x"] << src.mob.x
S["y"] << src.mob.y
S["z"] << src.mob.z

____________________________________________________________
how would i modify that so it could save the items in the players invetory too?
Dark-Millenia wrote:
the code i have for my saving is this:

Save_Char()
> var/savefile/S = new ("Player/[src.mob.ckey]")
> S["mob"] << src.mob
> S["x"] << src.mob.x
> S["y"] << src.mob.y
> S["z"] << src.mob.z

____________________________________________________________
how would i modify that so it could save the items in the players invetory too?

Save_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] << src.mob
S["x"] << src.mob.x
S["y"] << src.mob.y
S["z"] << src.mob.z
S["src.contents] << src.mob.contents


Thats my GUESS!
In response to Revojake
Revojake wrote:
Dark-Millenia wrote:
the code i have for my saving is this:

Save_Char()
> > var/savefile/S = new ("Player/[src.mob.ckey]")
> > S["mob"] << src.mob
> > S["x"] << src.mob.x
> > S["y"] << src.mob.y
> > S["z"] << src.mob.z

____________________________________________________________
how would i modify that so it could save the items in the players invetory too?

Save_Char()
> var/savefile/S = new ("Player/[src.mob.ckey]")
> S["mob"] << src.mob
> S["x"] << src.mob.x
> S["y"] << src.mob.y
> S["z"] << src.mob.z
> S["src.contents] << src.mob.contents

Thats my GUESS!

K thanks i will see what other people say too casue i don't like going with guesses but that seems pretty probable to be an answer for it.
In response to Dark-Millenia
oh I forgot to add the " after the first src.contents.
In response to Revojake
Shouldnt the S["Mob"] Part cover that mobs contents as well?

Unless you've made it so that all the mobs items are kept in a different variable list then contents...
Save_Char()
var/savefile/S=new("Player/[ckey].sav")
var/mob/M=src.mob
S["x"]<<M.x
S["y"]<<M.y
S["z"]<<M.z
S["contents"]<<M.contents


However, this is probably not how you want it. You had S["mob"]<<src.mob which implies that you want to save the mob and every variable that it has (not saving single variables).
Try this:

client/verb
Save_Char()
var/savefile/S=new("Player/[ckey].sav")
src.mob.Write(S)
Load_Char()
var/savefile/S=new("Player/[ckey].sav")
src.mob.Read(S)
//probably should just put these at mob/Login() and mob/Logout() \
uncomment the code below to do just that

/*

mob/Login()
if(fexists("Player/[ckey].sav")) Read( new/savefile("Player/[ckey].sav") )
.=..()
mob/Logout()
Write( new/savefile("Player/[ckey].sav") )
.=..()

*/


mob
Write(savefile/F)
.=..() //save the rest
//save coordinates (since they're not saved by default)
F["x"]<<x
F["y"]<<y
F["z"]<<z
Read(savefile/F)
.=..() //load the rest
loc=locate(F["x"],F["y"],F["z"]) //load the coordinates and move the player to em'
In response to Android Data
Android Data wrote:
    Read(savefile/F)
.=..() //load the rest
loc=locate(F["x"],F["y"],F["z"]) //load the coordinates and move the player to em'


Correct me if I'm wrong, but loading directly from the savefile like this doesn't seem to be safe. =/
In response to Android Data
Android Data wrote:
> Save_Char()
> var/savefile/S=new("Player/[ckey].sav")
> var/mob/M=src.mob
> S["x"]<<M.x
> S["y"]<<M.y
> S["z"]<<M.z
> S["contents"]<<M.contents
>

However, this is probably not how you want it. You had S["mob"]<<src.mob which implies that you want to save the mob and every variable that it has (not saving single variables).
Try this:

> client/verb
> Save_Char()
> var/savefile/S=new("Player/[ckey].sav")
> src.mob.Write(S)
> Load_Char()
> var/savefile/S=new("Player/[ckey].sav")
> src.mob.Read(S)
> //probably should just put these at mob/Login() and mob/Logout() \
> uncomment the code below to do just that

> /*
>
> mob/Login()
> if(fexists("Player/[ckey].sav")) Read( new/savefile("Player/[ckey].sav") )
> .=..()
> mob/Logout()
> Write( new/savefile("Player/[ckey].sav") )
> .=..()
>
> */

>
> mob
> Write(savefile/F)
> .=..() //save the rest
> //save coordinates (since they're not saved by default)
> F["x"]<<x
> F["y"]<<y
> F["z"]<<z
> Read(savefile/F)
> .=..() //load the rest
> loc=locate(F["x"],F["y"],F["z"]) //load the coordinates and move the player to em'
>


android how would i modify that to tile screen way like

</DM>
turf
load1
Click()
</DM>

what would i do to make load work for clicking and in a turf.