ID:867826
 
(See the best response by Soul Sign.)
Code:
Saving
        Save(mob/Player/M as mob)
var/savefile/F=new("savefiles/telnet/players/[ckey(lowertext(M.name))]")
M.last_x=src.x
M.last_y=src.y
M.last_z=src.z
M.Write(F)


Character Creation
mob/new_player
Login()
if(copytext(lowertext(key),1,7) == "telnet")
world.log << "(TELNET) [client.address] connected."
mb_msgout("\n[worldname]\nLast Compile: 07-13-12 @ 04:00 AM EST")
src.name=input("Name:", "Drag(*)nBall Z Epic Login") as text
if(src.TextAbuseCheck(name))
mb_msgout("{YYour name must not start or end with a space nor can it be blank!{x")
del(src)
if(fexists("savefiles/telnet/players/[ckey(lowertext(name))]"))
var/savefile/F=new("savefiles/telnet/players/[ckey(lowertext(name))]")
var/gotit
F["Password"]>>gotit
F["key"]<<src.key
var/pass=input("Password:", "Drag(*)nBall Z Epic Login") as password
if(pass==gotit)
src << "Please wait..."
src.Read(F)
sleep(20)
src.loc=locate(src.last_x,src.last_y,src.last_z)
src.ProcessLogin()
else
mb_msgout("{YIncorrect password!{x")
del(src)
else
if(src.ConfirmName())
else
mb_msgout("{YPlease reconnect!{x")
del(src)
src.Password=input("Enter a password for your character.", "Drag(*)nBall Z Epic Login") as password
if(src.TextAbuseCheck(Password))
mb_msgout("{YYour password must not start or end with a space nor can it be blank!{x")
del(src)
var/correctpass=input("Please enter it again.", "Drag(*)nBall Z Epic Login") as password
if(correctpass==Password)
var/mob/Player/new_Character

// RACE //
mb_msgout("Please choose a race.")
mb_msgout("\n{cSaiyan\n{yHuman\n{gNamekian\n{DAndroid{x")
switch(input("What is your race?")in list("Saiyan", "Human", "Namekian", "Android"))
if("Saiyan")
new_Character = new /mob/Player/Saiyan()
if("Human")
new_Character = new /mob/Player/Human()
if("Namekian")
new_Character = new /mob/Player/Namekian()
if("Android")
new_Character = new /mob/Player/Android()
/////////

// GENDER //
mb_msgout("Please choose a gender.")
mb_msgout("\n{cMale\n{mFemale{x")
switch(input("What is your gender?")in list("Male", "Female"))
if("Male")
new_Character.Gender = "Male"
new_Character.GenderColor = "{c"
if("Female")
new_Character.Gender = "Female"
new_Character.GenderColor = "{M"
//////////

// ALIGNMENT //
mb_msgout("Please select your alignment.")
mb_msgout("\n{BGood\n{REvil{x")
switch(input("What is your alignment?")in list("Good", "Evil"))
if("Good")
new_Character.Alignment = "Good"
new_Character.good = 1
new_Character.AlignmentColor = "{B"
if("Evil")
new_Character.Alignment = "Evil"
new_Character.evil = 1
new_Character.AlignmentColor = "{R"
/////////////

// EMAIL //
mb_msgout("{Y\nA valid e-mail is required.{x")
new_Character.Email=input("Please enter your email address:") as text

//////////
new_Character.name = name
new_Character.Password = Password

new_Character.loc=locate(new_Character.ClassX,new_Character.ClassY,new_Character.ClassZ)

new_Character.Save(new_Character)

src.client.mob = new_Character


del(src)


else
mb_msgout("The two passwords did not match.")
del(src)
return .. ()
else
world.log << "(BYOND) [client.address] connected."
return .. ()


Mobs
mob
Player

Saiyan
density = 0
Class = "Saiyan"
Location = "Earth"
PowerLevel = 250
MaxPowerLevel = 250
Energy = 100
ClassX = 101
ClassY = 226
ClassZ = 1
Zenni = 100
ClassColor = "{c"
text="{c*{x"
//SKILLS//
LearnPunch = 1
LearnSweep = 1
LearnRoundhouse = 1
LearnDuck = 1
LearnDodge = 1
LearnJump = 1
LearnBlock = 1
//CANLEARN//
CanLearnGalicGun = 1
CanLearnKamehameha = 1
CanLearnSSJ = 1

Human
density = 0
Class = "Human"
Location = "Earth"
PowerLevel = 250
MaxPowerLevel = 250
Energy = 100
ClassX = 101
ClassY = 226
ClassZ = 1
Zenni = 100
ClassColor = "{y"
text="{y*{x"
//SKILLS//
LearnPunch = 1
LearnSweep = 1
LearnRoundhouse = 1
LearnDuck = 1
LearnDodge = 1
LearnJump = 1
LearnBlock = 1
//CANLEARN//
CanLearnKamehameha = 1

Namekian
density = 0
Class = "Namekian"
Location = "Earth"
PowerLevel = 275
MaxPowerLevel = 275
Energy = 100
ClassX = 101
ClassY = 226
ClassZ = 1
Zenni = 100
ClassColor = "{g"
text="{g*{x"
//SKILLS//
LearnPunch = 1
LearnSweep = 1
LearnRoundhouse = 1
LearnDuck = 1
LearnDodge = 1
LearnJump = 1
LearnBlock = 1
//CANLEARN//

Android
density = 0
Class = "Android"
Location = "Earth"
PowerLevel = 300
MaxPowerLevel = 250
Energy = 100
ClassX = 101
ClassY = 226
ClassZ = 1
Zenni = 100
ClassColor = "{D"
text="{D*{x"
//SKILLS//
LearnPunch = 1
LearnSweep = 1
LearnRoundhouse = 1
LearnDuck = 1
LearnDodge = 1
LearnJump = 1
LearnBlock = 1
LearnAbsorb = 1


Savefile currently
Password = "y"
Email = "s"
last_x = 92
last_y = 227
last_z = 1
GenderColor = "{c"
AlignmentColor = "{B"
Alignment = "Good"
Gender = "Male"
good = 1
nearby = ""
inview = list()
fighting = list("")
skills = "* {cpunch{x * {csweep{x * {croundhouse{x * {cparry{x\n* {cdodge{x * {cjump{x * {cduck{x {Dssj{x\n{Dkamehameha{x {Dgalic gun{x"
dir_text = list("north","south",null,"east","northeast","southeast",null,"west","northwest","southwest")
name = "thunderz"
Energy = 97
Command = 17
loggedIn = 1
dir = 8
key = "Telnet @127.000.000.001"
gokussj99 = object(".0")
.0
type = /mob
name = "Gokussj99"
gender = "male"
key = "Gokussj99"


Savefile before i changed character creation

last_x = 200
last_y = 28
last_z = 1
Password = "x"
Email = "x@x"
Class = "Namekian"
ClassX = 101
ClassY = 226
ClassZ = 1
Location = "Earth"
ClassColor = "{g"
GenderColor = "{M"
AlignmentColor = "{R"
Alignment = "Evil"
Gender = "Female"
PowerLevel = 825
MaxPowerLevel = 1323
Energy = 42
Zenni = 100
evil = 1
LearnPunch = 1
LearnSweep = 1
LearnRoundhouse = 1
LearnDuck = 1
LearnDodge = 1
LearnJump = 1
LearnBlock = 1
nearby = ""
inview = list("")
fighting = list("")
skills = "* {cpunch{x * {csweep{x * {croundhouse{x * {cparry{x\n * {cdodge{x * {cjump{x * {cduck{x"
dir_text = list("north","south",null,"east","northeast","southeast",null,"west","northwest","southwest")
name = "Seferium"
text = "{g*{x"
density = 0
key = "Telnet @x"
EKills = 11
Scouter = 1
Eye = "{GScouter{x"
OnEye = 1
contents = list(object(".0"),object(".1"))
.0
type = /obj/Item/Scouter
equip = 1
suffix = "Equipped"
.1
type = /obj/Item/Scouter
gokussj99 = object(".0")
.0
type = /mob
name = "Gokussj99"
gender = "male"
key = "Gokussj99"

as you can see nearly all the variables from the new mob being created are not being saved.

Problem description:

For some reason not all of the character is being saved.. any ideas to why?

All i did was redo the character creation recently.

Best response
Its pretty clear.

When you use Write() => Variables marked tmp, global, or const and variables which are equal to their initial value are skipped.

Some variables are not saved because they are equal to their initial value, which is just the case when you create your new_Character.

new_Character = new /mob/Player/Saiyan()

A Mob is created and all the variables of the mob are their defaults. Only the values which you assign explicitly get altered and hence only they are saved when you use Write().