ID:266980
 
I am trying to save a Ranking list which has 2 spaces in it cause I declair it like this. var/list/Rank[2].

for(var/mob/bar/B in world)
Loadfile("S","N","[Rank[1]]")
Loadfile("S","S","[Rank[2]]")
if(Rank[2]<B.sco)
Rank[2]=B.sco
Rank[1]=B.name
Savefile("S","N","[Rank[1]]")
Savefile("S","S","[Rank[2]]")
world << "Best score is [Rank[2]] by [Rank[1]]."

As you can see the Rank[1] Holds the name and Rank[2] holds the score number. For some reason the Save file is either not Saving or loading. Im not sure which one is wrong. Could you please tell me why it would do this for my code. Thanks :)
In your Load and Save procs, what is the order of your arguments, just curious..
In response to Super16
proc/Savefile(filename,holder,type)
var/savefile/F = new("[filename].sav")
F["[holder]"] << type
proc/Loadfile(filename,holder,type)
var/savefile/F = new("[filename].sav")
F["[holder]"] >> type

Above is the code for them so You can see the arguments up there. So any thing wrong with it? Please tell me once I get this in my 4k Challange will be done and I can submit it.
You should really save the list by itself so,

var/list/Rank = list()


Loadfile("S","N",Rank)
for(var/mob/bar/B in world)
if(Rank[2] <b.sco)
Rank[2] = B.sco<br/> Rank[1] = B.name
Savefile("S","N",Rank)
world << "Best score is [Rank[2]] by [Rank[1]]."

Maybe that will help.
In response to Super16
I got this error
runtime error: list index out of bounds
Hmmm have any ideas?
In response to Green Lime
Oh in the list

var/list/Rank = list(1,2)

Just do that and it should be good.
In response to Super16
Either its not loading or its not saving.
I think it has somthing too do with the loading cause the Sav file is getting bigger. But when I play it and I get a lower score than was on the other game it doesnt work and just gives me the score I had at the time.

[EDIT] I was debugging it and I found out I loaded the list and then outputed the results at the start and it said Rank[1] = 1 and Rank[2] = 2 Any reason why that is?