ID:150277
 
How would i save the usrs verbs so when they log back on they have the same verbs
Richter wrote:
How would i save the usrs verbs so when they log back on they have the same verbs



mob/verb/Save()
var/savefile/F = new("[usr.ckey].sav")
F["verbs"]<<usr.verbs
Write(F)

mob/verb/Load()
var/savefile/F = new("[usr.ckey].sav")
Read(F)
F["verbs"]>>usr.verbs
In response to Nadrew
When i put the save verbs and load verbs in a save login code i have it with no errors but i get a dang runtime error and this is it
runtime error: bad file
proc name: Login (/mob/Login)
usr: Richter (/mob/DM)
src: Richter (/mob/DM)
call stack:
Richter (/mob/DM): Login()
This is the proc i have for the saving verb
mob/proc
Saving()
var/savefile/F = new("[usr.ckey].sav")
var/savefile/D = new("[usr.ckey].verbs")
F["Saves"]<<usr.Saves
Write(F)
F["verbs"]<<usr.verbs
Write(D)
Then for when i load it i have the Read(F)
Read(D)
but i get the runtime error and i am not to sure why it tells me i am a bad file
lol. Thanx if you help me and thanx Nadrew





~Richter
In response to Richter
Richter wrote:
When i put the save verbs and load verbs in a save login code i have it with no errors but i get a dang runtime error and this is it
runtime error: bad file
proc name: Login (/mob/Login)
usr: Richter (/mob/DM)
src: Richter (/mob/DM)
call stack:
Richter (/mob/DM): Login()
This is the proc i have for the saving verb
mob/proc
Saving()
var/savefile/F = new("[usr.ckey].sav")
var/savefile/D = new("[usr.ckey].verbs")
F["Saves"]<<usr.Saves
Write(F)
F["verbs"]<<usr.verbs
Write(D)
Then for when i load it i have the Read(F)
Read(D)
but i get the runtime error and i am not to sure why it tells me i am a bad file
lol. Thanx if you help me and thanx Nadrew





~Richter



1. Why are you saving the verbs into a seperate file?

2. You really should keep the savefile to a one min.

3. Well there is no 3.
In response to Nadrew
I tried and it didnt work so i figured i would have to make it seperate
This is what i had for them together
var/savefile/F = new("[usr.ckey].sav")
F["Saves"]<<usr.Saves
F["verbs"]<<usr.verbs
Write(F)




~Richter
In response to Richter
Richter wrote:
I tried and it didnt work so i figured i would have to make it seperate
This is what i had for them together
var/savefile/F = new("[usr.ckey].sav")
F["Saves"]<<usr.Saves
F["verbs"]<<usr.verbs
Write(F)



How are you loading the verbs?
In response to Nadrew
Nadrew wrote:
Richter wrote:
I tried and it didnt work so i figured i would have to make it seperate
This is what i had for them together
var/savefile/F = new("[usr.ckey].sav")
F["Saves"]<<usr.Saves
F["verbs"]<<usr.verbs
Write(F)



How are you loading the verbs?


So would i put
mob/proc
Saving()
var/savefile/F = new
("[usr.ckey].sav","[usr.ckey].verbs")
F["Saves"]<<usr.Saves
F["verbs"]<<usr.verbs
Write(F)
Well i fugured this should have worked but it doesnt
It still doesnt work .
In response to Nadrew
the problem is usr.something
use src, usr can return some nastry results sometimes, often returning red text that yells at you for not using src.

notice you can only use src, if the proc is in the atom you intend the proc to work for. if the proc was, lets say in world, it would cause the world to try to be saved, also resulting in errors.

mob/proc/SaveMe()
var/savefile/F = new("[src.key].save")
F["me"] << src.client.mob
F["myverbs]" << src.verbs
mob/proc/LoadMe()
var/savefile/F = new("[src.key].save")
F["me"] >> src.client.mob
F["myverbs"] >> src.verbs
In response to Richter
Richter wrote:
Nadrew wrote:
Richter wrote:
I tried and it didnt work so i figured i would have to make it seperate
This is what i had for them together
var/savefile/F = new("[usr.ckey].sav")
F["Saves"]<<usr.Saves
F["verbs"]<<usr.verbs
Write(F)



How are you loading the verbs?


So would i put
mob/proc
Saving()
var/savefile/F = new
("[usr.ckey].sav","[usr.ckey].verbs")
F["Saves"]<<usr.Saves
F["verbs"]<<usr.verbs
Write(F)
Well i fugured this should have worked but it doesnt
It still doesnt work .

Will some one tell me why this damn thing doesnt work >becuasei am getting really mad at the damn thing
So could some one please help me



~Richter
In response to Richter
Richter wrote:
Richter wrote:
Nadrew wrote:
Richter wrote:
I tried and it didnt work so i figured i would have to make it seperate
This is what i had for them together
var/savefile/F = new("[usr.ckey].sav")
F["Saves"]<<usr.Saves
F["verbs"]<<usr.verbs
Write(F)



How are you loading the verbs?


So would i put
mob/proc
Saving()
var/savefile/F = new
("[usr.ckey].sav","[usr.ckey].verbs")
F["Saves"]<<usr.Saves
F["verbs"]<<usr.verbs
Write(F)
Well i fugured this should have worked but it doesnt
It still doesnt work .

Will some one tell me why this damn thing doesnt work >becuasei am getting really mad at the damn thing
So could some one please help me
I get a runtime error of cannot write to the atom.verbs >and i dont know what to do to fix it so please help me
~Richter
In response to Richter
Ack!! Learn how to reply I could barely find what you said, and you're using a proc change usr to src.
In response to Nadrew
I still cant get the damn thing to work and its making me so very mad!!!!!!!!!
i have been trying for like 2 hours
damn why did they make it so f in hard to save
In response to Richter
It's not hard try this:


mob
proc
Save()
var/VERBS = src.verbs
var/savefile/F = new("[src.ckey].sav")
F["verbs"]<<VERBS
Write(F)
In response to Richter
Richter wrote:
I still cant get the damn thing to work and its making me so very mad!!!!!!!!!
i have been trying for like 2 hours
damn why did they make it so f in hard to save


*Smack, Smack, Smack, Smack* Try to save in any other kind of program. Try to see how many lines of code and how many hours it will take you to get a working Export/Import Savefile system in, lets say C. In MUDs, for every variable you want saved you have to manually create a spot in the file which handles saving, and its so insanely unstable on stock muds that most end up having memory leaks or bad *pfiles.

You get it easy pal, and ontop of that theres an entire library doing just this that you could take a peek at to learn from.

* Pfiles : Player Files for those who dont play MUDs, the saved files of each character

Alathon
In response to Nadrew
How would i load it into the game becuase this is what i was given
mob/verb/Save()
usr.Saves=1
Saving()

mob/proc/Saving()
var/savefile/F = new("[usr.ckey].sav")
var/VERBS = src.verbs
F["Saves"]<<usr.Saves
F["VERBS"]<<VERBS
Write(F)

mob/Login()
var/savefile/F = new("[usr.ckey].sav")
var/VERBS
F["Saves"]>>usr.Saves
F["VERBS"]>>VERBS
if(usr.Saves>=1)
switch(alert("You have save files!",,"Load","New","Delete"))
if("Load")
Read(F)
And i am not sure what else to do to get the verbs to save so can someone please help me thanx


~RICHTER
In response to Richter
You should move the verbs thing under the Read() proc.
In response to Nadrew
Is this what i would do
mob/proc/Saving()
var/savefile/F = new("[usr.ckey].sav","[usr.ckey].verbs")
var/VERBS=src.verbs
F["Saves"]<<usr.Saves
F["verbs"]<<VERBS
saved_x=x
saved_y=y
saved_z=z
..()
Write(F)



mob/Login()
var/savefile/F = new("[usr.ckey].sav")
var/VERBS=src.verbs
F["Saves"]>>usr.Saves
if(usr.Saves>=1)
switch(alert("You have save files!",,"Load","New","Delete"))
if("Load")
Read(F)
F["verbs"]<<VERBS
..()
Move(locate(saved_x,saved_y,saved_z))
Dont mind the saved stuff
In response to Richter
Richter wrote:
Is this what i would do
mob/proc/Saving()
var/savefile/F = new("[usr.ckey].sav","[usr.ckey].verbs")
var/VERBS=src.verbs
F["Saves"]<<usr.Saves
F["verbs"]<<VERBS
saved_x=x
saved_y=y
saved_z=z
..()
Write(F)



mob/Login()
var/savefile/F = new("[usr.ckey].sav")
var/VERBS=src.verbs
F["Saves"]>>usr.Saves
if(usr.Saves>=1)
switch(alert("You have save files!",,"Load","New","Delete"))
if("Load")
Read(F)
F["verbs"]<<VERBS
..()
Move(locate(saved_x,saved_y,saved_z))
Dont mind the saved stuff


Richter



So what would i do if this is not correct
In response to Richter
I'm not helping you because you took my system and screwed it up, and you keep bumping your posts.
In response to Nadrew
Well its not my fault no can help me and give me the write thing to use becuase every thing you have given me is fucked up
Page: 1 2