ID:145446
 
Code:
mob
proc
save()
var/savefile/F = new("[ckey].sav")
F["afk"] << afk
F["canattack"] << canattack
F["attacking"] << attacking
F["canhold"] << canhold
F["password"] << password
F["protect"] << protect
F["correctpass"] << correctpass
F["house"] << house
F["GMhouse"] << GMhouse
F["canenter"] << canenter
F["shop"] << shop
F["SGS_kick_for_repeat"] << SGS_kick_for_repeat
F["SGS_remember_txt"] << SGS_remember_txt
F["SGS_locked"] << SGS_locked
F["SGS_Stop_all_txt"] << SGS_Stop_all_txt
F["Fishing"] << Fishing
F["FishingExp"] << FishingExp
F["MaxFishingExp"] << MaxFishingExp
F["axe"] << axe
F["gold_banked"] << gold_banked
F["owner"] << owner
F["maxhp"] << maxhp
F["hp"] << hp
F["maxsp"] << maxsp
F["sp"] << sp
F["exp"] << exp
F["maxexp"] << maxexp
F["str"] << str
F["def"] << def
F["delay"] << delay
F["attack"] << attack
F["protection"] << protection
F["giveexp"] << giveexp
F["level"] << level
F["gold"] << gold
F["race"] << race
F["random"] << random
F["move"] << move
F["clan"] << clan
F["clanowner"] << clanowner
F["copper"] << copper
F["steel"] << steel
F["hammer"] << hammer
F["deitystone"] << deitystone
F["sword_equiped"] << sword_equiped
F["shield_equiped"] << shield_equiped
F["shield_able"] << shield_able
F["weapon"] << weapon
F["shield"] << shield
F["admin"] << admin
F["deity"] << deity
F["deityspells"] << deityspells
F["Mining"] << Mining
F["MiningExp"] << MiningExp
F["MaxMiningExp"] << MaxMiningExp
F["PickAxe"] << PickAxe
F["ishop"] << ishop
F["subscibe"] << subscibe
F["type"] << type
F["parent_type"] << parent_type
F["tag"] << tag
F["name"] << name
F["desc"] << desc
F["suffix"] << suffix
F["text"] << text
F["icon"] << icon
F["icon_state"] << icon_state
F["overlays"] << overlays
F["underlays"] << underlays
F["dir"] << dir
F["luminosity"] << luminosity
F["opacity"] << opacity
F["density"] << density
F["layer"] << layer
F["gender"] << gender
F["mouse_over_pointer"] << mouse_over_pointer
F["mouse_drag_pointer"] << mouse_drag_pointer
F["mouse_drop_pointer"] << mouse_drop_pointer
F["mouse_drop_zone"] << mouse_drop_zone
F["verbs"] << verbs
F["vars"] << vars
F["contents"] << contents
F["invisibility"] << invisibility
F["infra_luminosity"] << infra_luminosity
F["pixel_x"] << pixel_x
F["pixel_y"] << pixel_y
F["loc"] << loc
F["x"] << x
F["y"] << y
F["z"] << z
F["sight"] << sight
F["client"] << client
F["group"] << group
F["ckey"] << ckey
F["key"] << key
F["see_in_dark"] << see_in_dark
F["see_invisible"] << see_invisible
F["see_infrared"] << see_infrared
F["pixel_step_size"] << pixel_step_size
F["deityspells "] << deityspells
usr<<"Saving"
sleep(10)
usr<<"Your progress has been saved."
src.client.Export(F)

Load()
var/savefile/F = new("[ckey].sav")
F["afk"] >> afk
F["canattack"] >> canattack
F["attacking"] >> attacking
F["canhold"] >> canhold
F["password"] >> password
F["protect"] >> protect
F["correctpass"] >> correctpass
F["house"] >> house
F["GMhouse"] >> GMhouse
F["canenter"] >> canenter
F["shop"] >> shop
F["SGS_kick_for_repeat"] >> SGS_kick_for_repeat
F["SGS_remember_txt"] >> SGS_remember_txt
F["SGS_locked"] >> SGS_locked
F["SGS_Stop_all_txt"] >> SGS_Stop_all_txt
F["Fishing"] >> Fishing
F["FishingExp"] >> FishingExp
F["MaxFishingExp"] >> MaxFishingExp
F["axe"] >> axe
F["gold_banked"] >> gold_banked
F["owner"] >> owner
F["maxhp"] >> maxhp
F["hp"] >> hp
F["maxsp"] >> maxsp
F["sp"] >> sp
F["exp"] >> exp
F["maxexp"] >> maxexp
F["str"] >> str
F["def"] >> def
F["delay"] >> delay
F["attack"] >> attack
F["protection"] >> protection
F["giveexp"] >> giveexp
F["level"] >> level
F["gold"] >> gold
F["race"] >> race
F["random"] >> random
F["move"] >> move
F["clan"] >> clan
F["clanowner"] >> clanowner
F["copper"] >> copper
F["steel"] >> steel
F["hammer"] >> hammer
F["deitystone"] >> deitystone
F["sword_equiped"] >> sword_equiped
F["shield_equiped"] >> shield_equiped
F["shield_able"] >> shield_able
F["weapon"] >> weapon
F["shield"] >> shield
F["admin"] >> admin
F["deity"] >> deity
F["deityspells"] >> deityspells
F["Mining"] >> Mining
F["MiningExp"] >> MiningExp
F["MaxMiningExp"] >> MaxMiningExp
F["PickAxe"] >> PickAxe
F["ishop"] >> ishop
F["subscibe"] >> subscibe
F["tag"] >> tag
F["name"] >> name
F["desc"] >> desc
F["suffix"] >> suffix
F["text"] >> text
F["icon"] >> icon
F["icon_state"] >> icon_state
F["overlays"] >> overlays
F["underlays"] >> underlays
F["dir"] >> dir
F["luminosity"] >> luminosity
F["opacity"] >> opacity
F["density"] >> density
F["layer"] >> layer
F["gender"] >> gender
F["mouse_over_pointer"] >> mouse_over_pointer
F["mouse_drag_pointer"] >> mouse_drag_pointer
F["mouse_drop_pointer"] >> mouse_drop_pointer
F["mouse_drop_zone"] >> mouse_drop_zone
F["verbs"] >> verbs
F["contents"] >> contents
F["invisibility"] >> invisibility
F["infra_luminosity"] >> infra_luminosity
F["pixel_x"] >> pixel_x
F["pixel_y"] >> pixel_y
F["loc"] >> loc
F["x"] >> x
F["y"] >> y
F["z"] >> z
F["sight"] >> sight
F["client"] >> client
F["group"] >> group
F["ckey"] >> ckey
F["key"] >> key
F["see_in_dark"] >> see_in_dark
F["see_invisible"] >> see_invisible
F["see_infrared"] >> see_infrared
F["pixel_step_size"] >> pixel_step_size
F["deityspells "] >> deityspells
src.client.Import(F)


verb
Save()
usr.save()


Problem description: I open up the game file and use the save verb, but when i do that, it says this:
runtime error: bad output proc name: save (/mob/proc/save) source file: Save and Load.dm,96 usr: Flame48 (/mob/subscribers/Subsciber3) src: Flame48 (/mob/subscribers/Subsciber3) call stack: Flame48 (/mob/subscribers/Subsciber3): save() Flame48 (/mob/subscribers/Subsciber3): Save()


HOLY HELL.
Instead of all those vars, use something like this
mob/var/list/V // New list
mob
proc
Load()
var/savefile/F = new("Save/[src.ckey][src.slot].sav")
src.Read(F)
var/lx
var/ly
var/lz
F["last_x"] >> lx
F["last_y"] >> ly
F["last_z"] >> lz
F["V"] >> src.V
src.verbs+=src.V
Save()
var/savefile/F = new("Save/[src.ckey][src.slot].sav")
src.Write(F)
F["last_x"] << src.x
F["last_y"] << src.y
F["last_z"] << src.z
src.V+=src.verbs
F["V"] << src.V
src.locked=0


Forum indendation..
In response to Mysame
i still have to write out the vars though, don't i? It would only take the names of the vars, not the vars, values.
In response to Flame48
src.Write(F) will save the vars, really.
In response to Mysame
no, it didn't, i did it exactly like this and it didn't save anything except the location:

mob/var/list/V // New list
mob
proc
Load()
var/savefile/F = new("[src.ckey].sav")
src.Read(F)
var/lx
var/ly
var/lz
F["last_x"] >> lx
F["last_y"] >> ly
F["last_z"] >> lz
F["V"] >> src.V
src.verbs+=src.V
src.client.Import(F)
save()
var/savefile/F = new("[src.ckey].sav")
src.Write(F)
F["last_x"] << src.x
F["last_y"] << src.y
F["last_z"] << src.z
src.V+=src.verbs
F["V"] << src.V
usr<<"Saving"
sleep(10)
src.client.Export(F)
usr<<"Your progress has been saved."
In response to Flame48
I still need help!!!
In response to Flame48
bump
In response to Flame48
Ummmmmmm...I dunno try:
Load()
var/savefile/F = new("[src.ckey].sav")
src.client.Import(F) /*replaces the data of "[src.ckey].sav". If that doesn't work
then do src.client.Import("[src.ckey].sav")*/

F.cd = "/"//specify a directory to write to or remove this if you're writing to root.
//F["data_name"] >> src.var_name
//...

Save()
var/savefile/F = new("[src.ckey].sav")
//F["data_name"] << src.var_name
//...
src.client.Export(F)

I would suggest just using the game name as the savefile name. It'll be exported onto the user's computer and if another game uses the user's ckey for the savfile name and has the same variables,such as last_x stored then it overwrites it. Or make the savefile the user's ckey but then do
F.cd = "/<game_name>"
before you read and write data. It'll be unique then.
In response to SJRDOZER
I tried that in the first code(read first post by me)!!!
<font size=10>BUMP</font>
In response to Flame48
Don't bump unless its been 24 hours...

Why not look up the Read() and Wirte functions in the DM reference?
In response to Flame48
When you export a savefile, it goes onto the user's computer. After saving, you do the export. BEFORE loading, you specify the savefile and import that savefile that exists on the user's computer. It rewrites the savefile with whatever was written and importted during Save(). In other words, put src.client.Import(F) after var/savefile/F = new("[src.ckey].sav") and before you input any variables.
I dunno if that's how it goes, but why not, try it if you haven't already.
The problem is simple... the error points to line 96 in your code, and I can still count that high, that would mean your problem lies in this line.

" F["client"] << client"

In other words, you can't save the client because you are the client, and there is no point in trying to save the client. Also, you should not try and make your own saving system unless you know what you are doing and are an intermediate coder or better, which, sorry to say, you aren't.

So what I suggest doing is using Deadron's Characterhandling library, and if you would like to make it so it doesn't save, add base_AutoSaveAllowed = 0 (or whatever var it was he used for that.) Then have a verb that simply calls the proc that he used to save, then another verb that calls upon the loading proc.

--§--