ID:143393
 
Code:
mob
proc
Cload()
src.locked=1
switch(alert("Which Savefile do you wish to load?","Load?","SaveSlot 1","SaveSlot 2","SaveSlot 3","Cancel"))
if("SaveSlot 1")
if(fexists("savefiles/[src.ckey]1.sav"))
var/savefile/F = new("savefiles/[src.ckey]1.sav")
Read(F)
F["last_x"] >> src.x
F["last_y"] >> src.y
F["last_z"] >> src.z
F["verbs"] >> src.verbs
F["overlays"] >> src.overlays
src.locked=0
else
alert("No savefile found in the directory","ERROR")
src.login1()
return


Problem description:my problem may be run of the mill, but when players load their charactors 1 - 2 things happen but i have like 3 problems

1: they dont have their verbs that i have plainly in the save verb. (i think this and #2 might be prevented if i move around the Read(F) part but i dont know)
mob/proc/SaveF()
var/savefile/F=new("savefiles/[src.ckey][SaveSlot].sav")
F["last_x"] << src.x// This stuff saves the players location
F["last_y"] << src.y
F["last_z"] << src.z
F["verbs"] << src.verbs
F["overlays"] << src.overlays
src<<"<font size=2><font color=red>Game Saved</font color></font size>"
Write(F)


2: people load their charactor with black screens... i dont know why ive never had this problem.

and 3: i know how to fix this one and i have but i want your opinion, people load their charactors and they cant move, i have a locked movement system (thus the locked=0) but for some reason the load feature neglects the locked=0... any input?



~P.S.: i know those might seem a little stupid to some, but my emotional stress is at a all time high and i feel like i am cracking under my slavemasters whip... i mean my mothers niceness.. >_> <_< i just need something in my life to go right, my dad left and i know this isnt the right place to say any of this but i really feel like dirt... thats the only way to let you guys thinking "this guy needs help with beginner stuff heh" how much ive got on my head right now.

~~VolksBlade

----------
Coming Undone..
Alright, one of your problems, with the appearing on a black screen.
I've had that kind of problem before, I thought it was something else, but I guess this might be the problem.

Setting a mobiles XYZ data one by one.
You should try something like src.loc = locate(F["last_x"],F["last_y"],F["last_z"]).
If that doesn't work, make sure the area actually exists, and then, I don't know what to tell you.
(I think it originates from trying to set x/y data while on a nonexistant/null z level. it might even work if you set the z level first)

As for Read..
It's a possibility.
I don't remember any instances where I've used Read, but I'd assume it's overwriting all of the mobile data that's being found in the savefile (along with the client data), so it's basically killing the previous mob.
You could try putting it on after you've modified the location data, but I'm not entirely positive on that.
In response to Keeth
kk, ill try that thanks.. ^_^
In response to Keeth
Keeth wrote:
Setting a mobiles XYZ data one by one.
You should try something like src.loc = locate(F["last_x"],F["last_y"],F["last_z"]).

Except you can't read from the savefile directly like that. The key is to load those values into vars, and then use locate().

var/lx,ly,lz
F["last_x"] >> lx
F["last_y"] >> ly
F["last_z"] >> lz
loc = locate(lx,ly,lz)


Lummox JR
In response to Lummox JR
thanks for the help guys, ill check back if i have any more trouble with it.

[edit]

now new problem, your var/lx,ly,lz and then uploading our location to those then sending our charactor to that spot... it didnt work, my charactor just appears on the intro screen

here is my coding again:

mob
proc
Cload()
src.locked=1
switch(alert("Which Savefile do you wish to load?","Load?","SaveSlot 1","SaveSlot 2","SaveSlot 3","Cancel"))
if("SaveSlot 1")
if(fexists("savefiles/[src.ckey]1.sav"))
var/savefile/F = new("savefiles/[src.ckey]1.sav")
Read(F)
var/lx,ly,lz
F["last_x"] >> lx
F["last_y"] >> ly
F["last_z"] >> lz
F["verbs"] >> src.verbs
F["overlays"] >> src.overlays
src.loc=locate(lx,ly,lz)
src.locked=0
else
alert("No savefile found in the directory","ERROR")
src.login1()
return
In response to Lummox JR
mob/verb/test()
var/savefile/F = new()
F["x"] = 2
F["y"] = 3
F["z"] = 1
src.loc = locate(F["x"],F["y"],F["z"])


I only ever read directly from savefile data like that.
The only time I've used the >> and << operators was when I first started using savefiles.
In response to Keeth
Keeth wrote:
> mob/verb/test()
> var/savefile/F = new()
> F["x"] = 2
> F["y"] = 3
> F["z"] = 1
> src.loc = locate(F["x"],F["y"],F["z"])
>

I only ever read directly from savefile data like that.

I don't see how, as others have tried it before and it just plain doesn't work like that.

Lummox JR
In response to Lummox JR
But it does work.