ID:148508
 
I'm pretty sure this is a bug and it's reallllly pissing me off:


var/Score_Keeper/Score_Keepers = new
Score_Keeper
var
s10[]
s30[]
s60[]
s90[]


now when I do say this:

for(var/F in Score_Keepers:s10)

it says "Cannot read null.s10" as a runtime error... This has got to be a bug, because even when I seem to have done nothing, it worked for a minute, then it started comming up with that annoying error again. Now what in the world could make this not work here, but work in other places? >:(
The list needs to initialized, thelist[0] will work.
In response to Nadrew
Ok heres my code:

var/Score_Keeper/Score_Keepers = new
Score_Keeper
var
s10[0]
s30[0]
s60[0]
s90[0]


proc/Report_Scores()
var/Score_Keeper2 = list()
var/Score_Keeper3 = list()
var/Score_Keeper4 = list()
var/Score_Keeper5 = list()
for(var/F in Score_Keepers:s10) //runtime error comes from here
Score_Keeper2 += "[RC5_Decrypt(F,"blah")]"
for(var/F in Score_Keepers:s30)
Score_Keeper3 += "[RC5_Decrypt(F,"blah")]"
for(var/F in Score_Keepers:s60)
Score_Keeper4 += "[RC5_Decrypt(F,"blah")]"
for(var/F in Score_Keepers:s90)
Score_Keeper5 += "[RC5_Decrypt(F,"blah")]"
return "[k_list2text(Score_Keeper2)]"

Still says same thing.
This isn't a bug, so I've moved it. The problem is definitely somewhere in your code.

Two questions:

  • Why are you using the : operator when . is not only safer to use, but won't cause you any trouble in this context?
  • What other parts of the code interact with this datum? I suspect somewhere it's getting deleted before s10 can be accessed, or you're trying to access s10 before it's technically created (for example if you're calling something in world/New() it could be acting before Score_Keepers exists).

    Lummox JR
In response to Lummox JR
Ok I found out the problem was for some reason when it tried to load a file that wasn't there, during the hosts login, it somehow made it so it wasn't created... Now I'm having another problem... What proc can I use to check if that file exists?

I tried this:

if(isfile(file("/scores/Scores.sav")))

but that seems to return true no matter what I put in there...

[EDIT]

Nevermind, I figured out a way to do it with length.
In response to Kunark
look up
fexists