ID:144375
 
Code:
mob/proc
save_deck(slotnum)
if(length(src.deck) <=40)
src<<"<b><font color = white>Sorry Cant Save a deck with 40 cards or less."
else
var/savefile/F=new("saves/[src.key]/Decks/slot[slotnum].sav")
src.CurrentDeck = src.deck
F["deck"]<<src.CurrentDeck
F["name"]<<name
Write(F)
src<<"<b><font color='white'>Cards and Deck Saved Successfully!"

load_deck(slotnum)
if(fexists("saves/[src.key]/Decks/slot[slotnum].sav"))
var/savefile/F=new("saves/[src.key]/Decks/slot[slotnum].sav")
F["deck"]>>src.CurrentDeck
Read(F)
src<<"<b><font color='white'>Cards and Deck Loaded Successfully!"
else
src<<"<b><font color='white'>No deck to load!"
turf/SaveDeck
icon = 'SaveDeck.png'
Click()
var/slotnum=input("Pick a slot to save your deck in.") as null|anything in list("1","2","3","4","5")
if(!slotnum)return
slotnum=text2num(slotnum)
var/name = input("Name your deck") as text|null
if(!name) return
if(fexists("saves/[usr.key]/Decks/slot[slotnum].sav"))
var/savefile/T = new("saves/[usr.key]/Decks/slot[slotnum]/[name].sav")
switch(alert("Do you want to overwrite the deck in slot [slotnum]\nName of Deck: [T["name"]]?","Save Deck","Yes","No"))
if("Yes")
usr.save_deck(slotnum,name)
if("No")
return
else
usr.save_deck(slotnum)
turf/LoadDeck
icon = 'LoadDeck.png'
Click()
var/slotnum=input("Pick a deck to load.") as null|anything in list("1","2","3","4","5")
if(!slotnum)return
slotnum=text2num(slotnum)
switch(alert("Do you want to overwrite your current deck?","Load Deck","Yes","No"))
if("Yes")
usr.load_deck(slotnum)
if("No")
return


Problem description:

When i make a deck and then save it nothing happens,then when i load the slotnum i saved it under it reboots me out of the world.
Please help i would like for this to get fixed i been trying to fix it but i couldnt figure it out.
~Grand~
You're also saving the mob, by using the src.Write() proc to save it then the src.Read() to load it (WITHOUT LOOKING THEM UP AND ACTUALLY UNDERSTANDING THEM! argh...), so when you load that save, the mob gets loaded as well which should actually assign you to it rather than kick you out of the world, but it's still a problem.
Also, rather than calculating a list's length all the time with the length() proc, use the 'len' var.