sorry for posting thnis twice but i really need help on this i have spent 2 months i just this one question. How do i make my saveing code save the location?
here is my code:
mob
proc
Save_Character()
var
savefile/F = new()
saved_x ***
saved_y ***
saved_z ***
Write(F)
saved_x = x
saved_y = y
saved_z = z
client.Export(F)
src << "[src.name] saved."
mob/PC/verb/Save()
set category = "Communication"
src.Save_Character()
*** = warning or error
The Adventures of Perspolis.dm:439:saved_x :warning: variable defined but not used
The Adventures of Perspolis.dm:440:saved_y :warning: variable defined but not used
The Adventures of Perspolis.dm:441:saved_z :warning: variable defined but not used
ID:175133
Jun 7 2003, 1:48 pm
|
|
In response to Jon88
|
|
lol, im sorry but i get a
The Adventures of Perspolis.dm:450:error:Write :duplicate definition (conflicts with built-in proc) |
In response to Nave
|
|
Sorry, I fixed it in my earlier post.
|
In response to Jon88
|
|
yeah i actually figured out the problem for my self but it still doesnt work
|
In response to Nave
|
|
i think maybe i have the whole thing wrong
|
In response to Nave
|
|
Here's a snippet from my current project:
<code>mob/person/player Read(savefile/F) .=..() var {last_x;last_y;last_z} F["last_x"] >> last_x F["last_y"] >> last_y F["last_z"] >> last_z var/newloc=locate(last_x,last_y,last_z) if (!Move(newloc)) world.log << "[src] failed to move to [last_x],[last_y],[last_z]" loc=newloc Write(savefile/F) .=..() F["last_x"] << x F["last_y"] << y F["last_z"] << z</code> That automatically loads and saves the mob's position when the mob is loaded and saved, using last_x, last_y and last_y vars. You'll need to adjust those var references to fit in with the vars you have defined. Using the above code, you can just save the mob itself and not worry about the position. |
In response to Crispy
|
|
im confused
|
In response to Nave
|
|
maybe its something in a different place in my code, like right here in the login part:
mob/PC/Login() //Let's get started: |
In response to Nave
|
|
I am still stumped
|
In response to Nave
|
|
Your problem is that your saving is probably working PERFECTLY. However, you aren't loading the savefiles, and if you were, without making your own Read() proc like you did for the Write() one, the mob's locations won't be set.
|
mob
var
saved_x
saved_y
saved_z
proc
Save_Character()
var
savefile/F = new()
Write(F)
client.Export(F)
src << "[src.name] saved."
mob/PC/verb/Save()
set category = "Communication"
src.Save_Character()
mob/Write(savefile/F)
saved_x = x
saved_y = y
saved_z = z
..()