ID:140106
 
Code:
client
var
currentWallet
currentBank

mob

Login(client)
var/newPlay = new /mob/player
newPlay
x = 1
y = 1
z = 1
name = input("Your name please;") as text
var
currentBank
currentWallet
player
var
currentWallet
currentBank
proc
saveData(client)
if(fexists(""+ckey+".sav")) loadData()
else new /savefile(""+ckey+".sav")

loadData(client)
var/savefile/e=(""+ckey+".sav")
e >> currentBank
e >> currentWallet


Problem description:
I'm having trouble, you see I'm trying to get this save system up, so I can start on the more important part of this game. However, when I try to access the client variables it says their not found. What is the problem?
well that makes sense and if you want to do that then this is somewhat better...

mob
var
currentWallet
currentBank

mob
Login()
..()
loc = locate(1,1,1)
name = input("Your name please;") as text

client
proc
saveData(client)
if(fexists(""+ckey+".sav")) loadData()
else new /savefile(""+ckey+".sav")

loadData(client)
var/savefile/e=("[ckey].sav")
e >> mob.currentBank
e >> mob.currentWallet


and btw i think you should read more of the DM guide :|
In response to Masschaos100
I think you should read more of it too >.> You keep asking questions which are so simple

mob/proc
Save()
var/savefile/e = new("Saves/[src.key].sav")
e["currentBank"]<<src.currentBank
e["currentWallet"]<<src.currentWallet
Load()
if(fexists("Saves/[src.key].sav"))
var/savefile/e = new("Saves/[src.key].sav")
e["currentBank"]>>currentBank
e["currentBank"]>>currentWallet


much easier and less code =P

client
Del()
if(src.mob) src.mob.Save()
return ..()
In response to Isenggard
Okay, sorry it never occured to me to think of the whole . clause, and to the man above you who answered; "Thank you, it is refreshing to know that kindness is still around. Albeit not always abundant."
In response to Masschaos100
Masschaos100 wrote:
well that makes sense and if you want to do that then this is somewhat better...

> mob
> var
> currentWallet
> currentBank
>
> mob
> Login()
> ..()
> loc = locate(1,1,1)
> name = input("Your name please;") as text
>
> client
> proc
> saveData(client)
> if(fexists(""+ckey+".sav")) loadData()
> else new /savefile(""+ckey+".sav")
>
> loadData(client)
> var/savefile/e=("[ckey].sav")
> e >> mob.currentBank
> e >> mob.currentWallet
>

and btw i think you should read more of the DM guide :|

Sorry, I know the DM guide does have to deal with a lot of this, but when I use mob. it still returns the variable as not being known.
In response to CodeWeasel22
This is due to HOW you define e. You are saying e = "string", you want a file (hint hint) not a string... hm, I wonder if the DM reference has an entry about that...

And you are loading all of e to those two variables. So if they used to be numbers... now they are files! Woops! Now, how can you access certain variables from a savefile, which is similar to accessing a value in a list...

If you cannot answer any of those questions, sincerely, look up the DM reference AND read chapter 12 of the DM guide, which is dedicated to savefiles.
In response to GhostAnime
I'm sorry. I apologize, I don't mean to be so ignorant. I'm trying at least.