mob/proc/Save2()
var/savefile/save
save = new ("Save Files/[src.mob.ckey]")
save["mob"] << src.mob
save["x"] << src.mob.x
save["y"] << src.mob.y
save["z"] << src.mob.z
mob/verb/Save()
set category = "Communication"
src.Save2()
usr <<"'usr.name' saved!"
This is the saving system that i use...but i have a few problems:
Save.dm:14:error:src.mob.ckey:undefined var
Save.dm:16:error:src.mob.x:undefined var
Save.dm:17:error:src.mob.y:undefined var
Save.dm:18:error:src.mob.z:undefined var
I don't think they are vars, but i don't know how to fix it please help!
ID:148184
Jun 7 2003, 12:46 am
|
|
Jun 7 2003, 3:14 am
|
|
GOOD GOSH!!! You have src and mob plastered all over that proc...mob is your culprit here. mob=client which in turn is only used in client procs...etc...get rid of mob. and just put src.
|
In response to Goku72
|
|
client would still work for a title screen?
|
In response to Goku72
|
|
Not a very good explanation, Goku. =)
"mob" is a client var that references the mob that client is currently connected to. However, as "src" is the mob in this case, "src.mob" does not exist; hence the error. Replace "src.mob" with "src" throughout that code. It's clear you've just copied and pasted without thinking about what the code does. Please make an effort to understand what every bit of code you're given does, and how it does it. |
In response to Crispy
|
|
Well, I was always confused with Saving, so i think i got it...
mob/verb/Save() //We gotta let the player do it manually, right? set category = "Communication" src.Save2() //Save the character with the proc we defined above. usr <<" Game saved!" mob/proc/Save2() var/savefile/save save = new ("Save Files/[src.ckey]") save["mob"] << src.mob save["x"] << src.x save["y"] << src.y save["z"] << src.z |
In response to YamiGotenks
|
|
hmm i dont know much about that but from what crispy said it seems that src.mob isnt a very good code.. and you still have it written there so im guessing that code might create potential problems later..
|
In response to Siefer
|
|
Forget potential problems later, it's causing problems NOW. =P
It so happens that src is a mob, right? Right. So therefore, if you reference "src.blah" then "blah" must be a mob var. It also happens that mobs do not have a "mob" var. That's clients, not mobs. Conclusion: You don't want "src.mob". "src.mob" does not exist*. You want "src", because "src" is the mob you want. Replace "src.mob" with "src" in that code you posted. *Just had a flashback to the Matrix when I started to type that. =P |