ID:273800
 
Alright so...I have this little problem with some lists I /barely/ created which should work.

Before I created the new lists I had 2 global lists that I would add players keys and such to. I also have a savefile proc that saves and loads both lists' content.

Now that I created the new lists, the procs I added for them (which are EXACTLY THE SAME as the other lists' procs) keep telling me that error message "Cannot find .null", also when I try to view what's inside the lists (keys etc) It says "Cannot read "personskey".null" bla bla

So basically what the game is telling me is that the new lists aren't lists at all? I just want the new lists to work like my previous ones...I tried making them exactly the same as my 2 lists that work but nope. Help?
It seems your not initializing the list and also may not be giving the list the proper input it needs.

Since you say you have the proc already and it doesn't work maybe you could add it here so that we have more context as to what your trying to do and why your getting the error, So respond with the proc and any things that may link to that proc so we can get all data.

But as it stands id say your just failing to initialize the list properly aswell as reading it properly.
In response to Midgetbuster
These are the lists

//Lists that do work//
var/global/list/BanList = list()
var/global/list/MuteList = list()
//Lists that do not work//
var/list/ServerBan = list()
var/list/ServerMute = list()
var/list/ServerGM = list()
var/list/ServerAdmin = list()


Procs that read and check the lists
mob/proc
BanCheck()
if(global.BanList.Find(src.key))
src << "\white {Server}:\red You are banned from this game."
del (src)
if(global.BanList.Find(src.client.address))
src << "\white {Server}:\red Your IP address has been banned."
global.BanList.Add(src.key)
sleep(10)
del (src)


mob/proc
ServerMute()
if(global.ServerMute.Find(src.key))
src<<"Logging out wont un-mute you XD"
src.Muted=1
if(global.ServerMute.Find(src.client.address))
src<<"Your IP has been Muted, your multiple keys will also be affected."
src.Muted=1


And this is what loads them/saves them
world
New()
..()
if(fexists("Folder/Server Staff.sav"))
var/savefile/T = new("Folder/Server Staff.sav")
T["server_ban"] >> global.ServerBan
T["server_mute"] >> global.ServerMute
T["server_admin"] >> global.ServerAdmin
T["server_gm"] >> global.ServerGM
world.log << "<font color=blue>Server Staff Savefile loaded successfully.</font>"
if(fexists("Folder/[world.name]"))
var/savefile/F = new("Folder/[world.name]")
F["ban_list"] >> global.BanList
F["mute_list"] >> global.MuteList
world.log << "<font color=red>Global Lists loaded successfully.</font>"
world.log<<"[name] started at [Time()]"

Del()
var/savefile/T = new("Folder/Server Staff.sav")
T["server_ban"] << global.ServerBan
T["server_mute"] << global.ServerMute
T["server_admin"] << global.ServerAdmin
T["server_gm"] << global.ServerGM
world.log << "<font color=blue>Server Staff Savefile saved successfully.</font>"
var/savefile/F = new("Folder/[world.name]")
F["ban_list"] << global.BanList
F["mute_list"] << global.MuteList
world.log << "<font color=red>Global Lists saved successfully.</font>"
world.log<<"[name] shutdown at [Time()]"
..()


So yeah I think this is everything, the verbs I use to add keys and such to the lists consist of the usual "global.BanList.Add(M.key)" and such.
In response to Paul De La Torre
You didn't define those lists as global, but are trying to access them with the global keyword. Are the lists defined at the base level, or within another object? Technically, if they're at the base level, it shouldn't make a difference, but it's worth a try adding the global keyword to the definitions.

However, I would say try ditching the global keywords altogether, they're unnecessary unless it's ambiguous to whether you're referencing a local or global variable.
In response to DarkCampainger
They actually were -all- global, I just omitted the global part before posting to see whether or not that made a difference. I guess it doesn't, though what do you mean by "Are the lists defined at the base level, or within another object?" I kind of don't understand that. x.x
In response to Paul De La Torre
*BUMP*
In response to Paul De La Torre
Well, here's one other issue, these paths don't match:

var/savefile/T = new("DMK Folder/Server Staff.sav")
var/savefile/T = new("Folder/Server Staff.sav")


Can you give us the actual full error messages, along with the lines they reference?
In response to DarkCampainger
Alright fixed the paths issue, now I think everything loads and saves properly. Now the REAL issue is this:
mob
server_admin
verb
ban()
var/banned = input("Type in the Key or IP Address you wish to ban, correct spelling/grammar/punctuation are very very important.","Ban Options")as null|text
if(!(banned))
return
switch(alert("Are you sure you want to Ban [banned] from the game?","Ban [banned]?","Yes","No"))
if("Yes")
var/Reason=input("State a reason why you are banning [banned].","Is there a reason?")as null|text
if(null)
return
if(Reason)
world<<sound('throw.wav',0)
world<<"[banned] <font color=red>was Banned out of the game for:</font> [Reason]"
global.ServerBan.Add(banned)
else
world<<sound('throw.wav',0)
world<<"[banned] \red was Banned out of the game."
global.ServerBan.Add(banned)
if("No")
return

^ That's the verb used to ban people. Whenever I try to ban someone or manually input text I get this
runtime error: Cannot execute null.Add().
proc name: Ban (/mob/server_admin/verb/ban)
source file: Server Staff.dm,273
usr: Link (/mob)
src: Link (/mob)
call stack:
Link (/mob): Ban()

So what I am getting from this is...that the Lists are null? Also whenever I try to view what's inside the Lists it says "cannot read null."whateversinsidethelist"
In response to Paul De La Torre
I'm gonna take a guess here. Try using this instead to load the saves:

world
New()
..()
if(fexists("Folder/Server Staff.sav"))
var/savefile/T = new("Folder/Server Staff.sav")
T["server_ban"] >> global.ServerBan
T["server_mute"] >> global.ServerMute
T["server_admin"] >> global.ServerAdmin
T["server_gm"] >> global.ServerGM
if(!global.ServerBan) global.ServerBan=list()
if(!global.ServerMute) global.ServerMute=list()
if(!global.ServerAdmin) global.ServerAdmin=list()
if(!global.ServerGM) global.ServerGM=list()
world.log << "<font color=blue>Server Staff Savefile loaded successfully.</font>"
if(fexists("Folder/[world.name]"))
var/savefile/F = new("Folder/[world.name]")
F["ban_list"] >> global.BanList
F["mute_list"] >> global.MuteList
if(!global.BanList) global.BanList=list()
if(!global.MuteList) global.MuteList=list()
world.log << "<font color=red>Global Lists loaded successfully.</font>"
world.log<<"[name] started at [Time()]"


What I think is happening, is that the server_ban/server_mute/ect didn't exist in the savefile when you first loaded the older version of it (before you added them), so it was loading null into the lists, causing them to be no longer initialized. Then when you went to save them, it stored that null value. With these checks in place, the lists should be re-initialized if the savefile doesn't actually contain a value for it.

Alternatively, you could delete the "Server Staff.sav" file, but I'd assume you don't want to lose that data (or is there any data in it?)
In response to DarkCampainger
OMG It works now, thank you very very much x.x (also as a side note, I deleted that .sav multiple times and it still didnt work, I guess defining them as lists() when the files were loaded was the best way to go).
In response to Paul De La Torre
one last question though, probably heard this a lot but whenever I search for something in my contents list( which is a default list BYOND has im assuming) there's always this selection at the very top that's just a " why is that?
In response to Paul De La Torre
Paul De La Torre wrote:
one last question though, probably heard this a lot but whenever I search for something in my contents list( which is a default list BYOND has im assuming) there's always this selection at the very top that's just a " why is that?

I've actually never heard of that before. Try outputting the contents of the list to see if you have an unnamed object hiding in there:

mob/verb/displayContents()
for(var/C in contents)
if(C && istype(C,/atom))
var/atom/A = C
src<<"[A.type] = '[A.name]'"
else
src<<"null entry"


And when you say "selection", do you mean you're using input() in contents? Or are you searching in another way?