ID:262000
 
mob/var/saved = 0
mob/var/description
mob/var/person

mob/verb/save()
var/savefile/F = new()

F["saved2"] << saved
F["gold"] << gold
F["Stat"] << Stat
usr.client.Export(F)


client/New()
..()
var/savefile/client_file = new(Import())
if(client_file)
// client_file["usr"] >> mob //use this if you want to save ALL of the users vars
client_file["saved2"] >> mob.saved
client_file["gold"] >> mob.gold
client_file["Stat"] >> mob.Stat



return ..()
How do i make it to work so i can save Level, hp, attack, defence, exp, gold, deaths, fight.??</<></<></<>



Please Post your code in DM Tags, Thanks.
In response to XzDoG
where?
<-DM->
What ever code
<-DM->

Without the -, it makes it easier to read then a bunch of text. its best to use this whenever posting code in the forum.
In response to XzDoG
Anyways back on topic..
client/verb/Save()
set category = "Save"
usr << "Saved"
SaveMob()

client/proc/SaveMob()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
var/char_ckey = cKey(src.mob.name)
F["/[ckey]/[char_ckey]"]<<src.mob

client/proc/LoadMob(char_ckey)
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F["/[ckey]/[char_ckey]"]>>src.mob


You can do something like that, you dont need to save each var individualy.
In response to XzDoG
but.. when i try to log back in most of it works but then when you log in i can't see my icon
In response to Revenge-X
are you sure you have it setting an icon for when you login?
In response to XzDoG
world
name="Legend Of Zelda Unknown Swords"

mob/Login()//When User Logs in
usr<<"<font color = black>Welcome [usr]"
world<<"<font color = black>[usr] has entered [world.name]"//[world.name = well the worlds name]
usr.loc=locate(14,18,3)//or what ever you want them to go
turf
Exit
icon='EXITUP.bmp'
Click()
del(usr)
LOZ
icon='LOZUS.bmp'
Play
icon='Playup.bmp'
Click()
alert("Welcome to [world.name]!")
switch(input("What do you want to do?")in list("Make new character", "Continue with old character",""))
if("Make new character")
switch(input("Are you sure? If you have an old character, it will be erased. ( If you have one.)")in list("Yes", "No"))
if("No")
return ..()
if("Yes")
usr.name = input("Name?")as text
switch(input("Choose Your Tunic","[world.name]")in list("Green Link","Blue Link","Red Link","Pink/Purple Link"))
if("Green Link")
usr.icon='Character.dmi'
usr.icon_state="Green Link"
if("Blue Link")
usr.icon='Character.dmi'
usr.icon_state="Blue Link"
if("Red Link")
usr.icon='Character.dmi'
usr.icon_state="Red Link"
if("Pink/Purple Link")
usr.icon='Character.dmi'

usr.icon_state="Pink Link"
switch(input("Are you done?")in list("Yes", "No"))
if("No")
return ..()
if("Yes")
usr.loc=locate(1,1,1)
var/savefile/F = new(args)
Write(F)
if("Continue with old character")
switch(input("If you haven't already played on this server there will be problems. Are you sure you want to continue?")in list("Yes", "No"))
if("Yes")
var/savefile/F = new(args)
Read(F)
usr.loc=locate(1,1,1)
if("No")
return ..()

Yea its alot but i really don;t know what you mean maby this will help u andswer me :]
In response to Revenge-X
Try something like this
    if("Green Link")
usr.icon='Character.dmi usr.icon_state="Green Link"
usr.iconloaded="Character.dmi"
usr.iconstateloaded="Green Link"


Then when they continue their char set it up like
usr.icon=iconloaded
usr.iconstateloaded=icon_state

anyways you get the idea.
In response to XzDoG
i'm not following where do i put what ure talkin about? :P sorry i suck at coding this is my game in a while
In response to Revenge-X
This goes when you choose your character just replace color of the link with what ever your character color is for each one.
usr.icon='Character.dmi
usr.icon_state="Color of theLink"
usr.iconloaded="Character.dmi"
usr.iconstateloaded="Color of the Link"


Then go to the part of your code where you continue your old character and it loads everything thats where you put
usr.icon=iconloaded
usr.iconstateloaded=icon_state


So that way.. they have their icon when they login, theres other ways to do this but this is easier to explain i think.
In response to XzDoG
when i put it in
                            switch(input("Choose Your Tunic","[world.name]")in list("Green Link","Blue Link","Red Link","Pink/Purple Link"))
if("Green Link")
usr.icon='Character.dmi' usr.icon_state="Green Link"
usr.iconloaded="Character.dmi"
usr.iconstateloaded="Green Link

Login Code.dm:28:error: usr: expected end of statement
comes up then it gets all messed o.o
oh yea it highlights
usr.icon='Character.dmi'                    usr.icon_state="Green Link"

also
            if("Continue with old character")
switch(input("If you haven't already played on this server there will be problems. Are you sure you want to continue?")in list("Yes", "No"))
if("Yes")
client/proc/LoadMob(char_ckey)
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F["/[ckey]/[char_ckey]"]>>src.mob
usr.icon=iconloaded
usr.iconstateloaded=icon_state
usr.loc=locate(1,1,1)
if("No")
return ..()

I think that is right correct me if i am wronge :]
In response to Revenge-X
usr.icon='Character.dmi' usr.icon_state="Green Link"

make sure you hit enter because there on the same line..
In response to XzDoG
oh i c
what about
            if("Continue with old character")
switch(input("If you haven't already played on this server there will be problems. Are you sure you want to continue?")in list("Yes", "No"))
if("Yes")
client/proc/LoadMob(char_ckey)
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F["/[ckey]/[char_ckey]"]>>src.mob
usr.icon=iconloaded
usr.iconstateloaded=icon_state
usr.loc=locate(1,1,1)
if("No")
return ..()

Did i put eveything right??
Maby just edit it a little and send it ;]
and i think this is all but if anotehr error comes i think ill need some more help.
In response to Revenge-X
Well what is the error
In response to XzDoG
Login Code.dm:53:error:char_ckey:undefined var
Login Code.dm:53:error:client/proc/LoadMob:undefined var
Login Code.dm:56:error:ckey:undefined var
Login Code.dm:56:error:char_ckey:undefined var
Login Code.dm:57:error:iconloaded:undefined var
Login Code.dm:58:error:usr.iconstateloaded:undefined var
Login Code.dm:54:error:src.ckey:undefined var
Login Code.dm:55:error:src.ckey:undefined var
Login Code.dm:56:error:src.mob:undefined var
that i don't get it