ID:216162
 
Keywords: runtime
Code:
mob
Write(var/savefile/F)
..() << line 46
F["x"] << x
F["y"] << y
F["z"] << z


Read(var/savefile/F)
..()
var/x
var/y
var/z
F["x"] >> x
F["y"] >> y
F["z"] >> z
loc = locate(x,y,z)
mob
proc
SaveC()
if(src.cansave)
var/savefile/F=new("players/[src.key].sav")
Write(F)
LoadC()
if(fexists("players/[src.key].sav"))
src.FadeScreen()
var/savefile/F=new("players/[src.key].sav")
Read(F)
world << output("<font color=#EAC117>[src] ([key]) has logged in!.","info")
UpdateInventory()
UpdateSkill()
src.cansave=1
src.UnFadeScreen()
src.reitraining = 0
else
src<<"You have no savefile"
DelC()
if(fexists("players/[src.key].sav"))
var/conf=input("Are you sure you want to delete your savefile?")in list("Yes","No")
if(conf=="Yes")
fdel("players/[src.key].sav")
src<<"Savefile deleted sucessfully"
else
src<<"Deleting cancelled."
else
src<<"You dont have a savefile!"

Create()
if(fexists("Players/[src.key].sav"))
switch(alert(src, "Are you sure that you want to overwrite your old Character?", "Character Creation", "Yes","No"))
if("Yes")
sleep(0)
fdel("players/[src.key].sav")
if("No")
return //check if they have a file
var/creating=0
while(!creating)
creating=1
var/name = input("What Name Would You Like You Character To Have?") as text|null
if(length(name) < 2)
alert("Your Name Must Be Longer Than Two Characters!")
return
if(length(name) > 12)
alert("Your Name Can Not Be Longer Than Twelve Characters!")
return
if(!src)
return
if(!src.name) creating=0
src.name="[name]"
src.loc=locate(54,96,2)
src.icon='Base1.dmi'
Str = rand(2,3)
src.StrXp =0
src.StrMXp = 100
src.Def = 2
src.DefXp = 0
src.DefMXp = 100
src.MHp = 50
src.Hp = 50
src.HpXp = 0
src.HpMXp = 100
src.MRei = 10
src.Rei = 10
src.Reir = 2
src.ReirXp = 0
src.ReirMXp = 100
src.MXp = 50
src.Xp = 0
src.Class = "Human"
src.Yen = 0
src.cansave=1
src.player = 1
src.contents += new/skill/Attack
src.contents += new/obj/Items/SchoolUniform
src.UpdateSkill()
src.UpdateInventory()
J_update(usr)
SaveC()
world << output("<font color=#FFFFCC>[src]([key]) Has Entered The World For The First Time!.","info")
underlays += image('Misc.dmi',icon_state="shadow",pixel_y=-3)//add character shadow as a underlay/image

runtime error: Failed to write variable Str to savefile players/Tia Halibel.sav. The value being written was 2.
proc name: Write (/mob/Write)
source file: Proc.dm,46
usr: Talim (/mob)
src: Talim (/mob)
call stack:
Talim (/mob): Write(players/Tia Halibel.sav (/savefile))
Talim (/mob): SaveC()
Talim (/mob): Create()
New (6,15,1) (/turf/TitleScreens/New): Click(New (6,15,1) (/turf/TitleScreens/New), "default.map1", "icon-x=10;icon-y=13;left=1;scr...")
Problem description: every once and a wile i would get tis runtime error i dont all te time tho any help would be greatly help me

Oh and is there anyway i can make tis code more efficient