ID:173527
 
whats wrong, it seems ok, but slots 2 and 3 dont save. heres the code:


mob
verb
Savefile_Status()
var
s1name
s2name
s3name
if(fexists("players/[usr.ckey]/Slot_1.sav"))
var/savefile/s1=new("players/[usr.ckey]/Slot_1.sav")
s1["name"]>>s1name
else
s1name=""
if(fexists("players/[usr.ckey]/Slot_2.sav"))
var/savefile/s2=new("players/[usr.ckey]/Slot_2.sav")
s2["name"]>>s2name
else
s2name=""
if(fexists("players/[usr.ckey]/Slot_3.sav"))
var/savefile/s3=new("players/[usr.ckey]/Slot_3.sav")
s3["name"]>>s3name
else
s3name=""
var/browse="
Slot
Name
Options
Slot 1 [s1name] Delete
Slot 2 [s2name] Delete
Slot 3 [s3name] Delete
"
usr<<browse(browse,"window=Savefile Status;size=400x400;can_minimize=0")

client
proc
Load_Character()
var/savefile/s1=new("players/[src.mob.key]/Slot_1.sav")
var/savefile/s2=new("players/[src.mob.key]/Slot_2.sav")
var/savefile/s3=new("players/[src.mob.key]/Slot_3.sav")
switch(input("Hello [usr] which slot would you like to run from?","Load Character")in list("Slot 1","Slot 2","Slot 3"))
if("Slot 1")
s1["mob"]>>src.mob
s1["x"]>>src.mob.x
s1["y"]>>src.mob.y
s1["z"]>>src.mob.z
for(var/C in src.mob.CV)
src.mob.verbs+=C
if("Slot 2")
s2["mob"]>>src.mob
s2["x"]>>src.mob.x
s2["y"]>>src.mob.y
s2["z"]>>src.mob.z
for(var/C in src.mob.CV)
src.mob.verbs+=C
if("Slot 3")
s3["mob"]>>src.mob
s3["x"]>>src.mob.x
s3["y"]>>src.mob.y
s3["z"]>>src.mob.z
for(var/C in src.mob.CV)
src.mob.verbs+=C
SaveProc()
var/savefile/s1=new("players/[src.mob.key]/Slot_1.sav")
var/savefile/s2=new("/players/[src.mob.key]/Slot_2.sav")
var/savefile/s3=new("players/[src.mob.key]/Slot_3.sav")
switch(input("Hello [usr] which slot would you like to save to?","Save Character")in list("Slot 1","Slot 2","Slot 3"))
if("Slot 1")
src.mob.CV=src.mob.verbs
s1["CV"]<<src.mob.CV
s1["mob"]<<src.mob
s1["x"]<<src.mob.x
s1["y"]<<src.mob.y
s1["z"]<<src.mob.z
s1["name"]<<src.mob.name
if("Slot 2")
src.mob.CV=src.mob.verbs
s2["CV"]<<src.mob.CV
s2["mob"]<<src.mob
s2["x"]<<src.mob.x
s2["y"]<<src.mob.y
s2["z"]<<src.mob.z
s2["name"]<<src.mob.name
if("Slot 3")
src.mob.CV=src.mob.verbs
s3["CV"]<<src.mob.CV
s3["mob"]<<src.mob
s3["x"]<<src.mob.x
s3["y"]<<src.mob.y
s3["z"]<<src.mob.z
s3["name"]<<src.mob.name

Del()

del src
..()
Topic(href,href_list[])
switch(href_list["savefile"])
if("Delete_S1")
fdel("players/[src.mob.ckey]/Slot_1.sav")
src<<"Your slot 1 file was deleted!"
if("Delete_S2")
fdel("players/[src.mob.ckey]/Slot_2.sav")
src<<"Your slot 2 file was deleted!"
if("Delete_S3")
fdel("players/[src.mob.ckey]/Slot_2.sav")
src<<"Your slot 3 file was deleted!"
if("Save_S1")
var/savefile/s1=new("players/[src.mob.ckey]/Slot_1.sav")
usr.client.mob.CV=usr.client.mob.verbs
s1["CV"]<<usr.client.mob.CV
s1["mob"]<<usr.client.mob
s1["x"]<<usr.client.mob.x
s1["y"]<<usr.client.mob.y
s1["z"]<<usr.client.mob.z
s1["name"]<<usr.name
usr<<"You were saved in slot 1."
if("Save_S2")
var/savefile/s2=new("players/[src.mob.ckey]/Slot_2.sav")
usr.client.mob.CV=usr.client.mob.verbs
s2["CV"]<<usr.client.mob.CV
s2["mob"]<<usr.client.mob
s2["x"]<<usr.client.mob.x
s2["y"]<<usr.client.mob.y
s2["z"]<<usr.client.mob.z
s2["name"]<<usr.name
usr<<"You were saved in slot 2."
if("Save_S3")
var/savefile/s3=new("players/[src.mob.ckey]/Slot_3.sav")
usr.client.mob.CV=usr.client.mob.verbs
s3["CV"]<<usr.client.mob.CV
s3["mob"]<<usr.client.mob
s3["x"]<<usr.client.mob.x
s3["y"]<<usr.client.mob.y
s3["z"]<<usr.client.mob.z
s3["name"]<<usr.name
usr<<"You were saved in slot 3."
if("Load_S1")
if(fexists("players/[src.mob.ckey]/Slot_1.sav"))
var/savefile/s1=new("players/[src.mob.ckey]/Slot_1.sav")
s1["mob"]>>src.mob
s1["x"]>>src.mob.x
s1["y"]>>src.mob.y
s1["z"]>>src.mob.z
for(var/C in src.mob.CV)
src.mob.verbs+=C
usr<<"You load from slot 1!"
else
usr<<"The slot does not exist!"
if("Load_S2")
if(fexists("players/[src.mob.ckey]/Slot_2.sav"))
var/savefile/s2=new("players/[src.mob.ckey]/Slot_2.sav")
s2["mob"]>>src.mob
s2["x"]>>src.mob.x
s2["y"]>>src.mob.y
s2["z"]>>src.mob.z
for(var/C in src.mob.CV)
src.mob.verbs+=C
usr<<"You load from slot 2!"
else
usr<<"The slot does not exist!"
if("Load_S3")
if(fexists("players/[src.mob.ckey]/Slot_3.sav"))
var/savefile/s3=new("players/[src.mob.ckey]/Slot_3.sav")
s3["mob"]>>src.mob
s3["x"]>>src.mob.x
s3["y"]>>src.mob.y
s3["z"]>>src.mob.z
for(var/C in src.mob.CV)
src.mob.verbs+=C
usr<<"You load from slot 3!"
else
usr<<"The slot does not exist!"
</<usr></<usr></<usr></<usr& gt;</<usr></<usr></<usr></< usr></<usr></<usr></<usr></ <usr></<usr></<usr></<usr>&l t;/<usr></<usr></<usr></<src&g t;</<src></<src></<src></<s rc></<src></<src></<src></& lt;src></<src></<src></<src>&l t;/<src></<src></<src></<src&g t;</<src></<src></<browse>
Please put your code inside <DM> tags when posting it on the forum; especially when you use html.
Egads. What possessed you to design save slots that way? You're only making more work for yourself by repeating a bunch of code over and over and changing a couple of things in each.

For one thing, you don't even need different .sav files. For another, any such system you use should be able to loop through the slots and just substitute a var where needed.

Of course, this all begs the question why you'd limit saving slots in the first place, when it's not at all necessary.

Lummox JR
In response to Lummox JR
Well I'm using it for my Resident Evil game. And to make it more like its playstation counter parts I wanted to have slot saving. So can you atleast help with a better way for slot saving. A better code maybe.