ID:178249
 
runtime error: Cannot execute null.Add().
proc name: registerHQ (/obj/registry/verb/registerHQ)
source file: st_hq_system.dm,18
usr: Sariat (/mob)
src: the registry (/obj/registry)
call stack:
the registry (/obj/registry): registerHQ()

is the error


this is the code
var/list/registeredteams
obj/registry
icon = 'icons.dmi'
icon_state = "reg"
verb/registerHQ()
set src in oview(1)
var/team = input("What is the HQ's name?") as null|text
registeredteams.Add("[team]")//line 18



What I am trying to is a set up a place where you can register your HQ team name so nobody steal it. And So that you can add whoever you want to that HQ. I was wondering if I am on the right track like this, or should I do something else?

I want to be able to use taxing on team members and put team members in the newspapers if they do something good, or have team to team battle and stuff like that. Is this a good start? If not, can you help me?

-ST

Sariat wrote:
runtime error: Cannot execute null.Add().
proc name: registerHQ (/obj/registry/verb/registerHQ)
source file: st_hq_system.dm,18
usr: Sariat (/mob)
src: the registry (/obj/registry)
call stack:
the registry (/obj/registry): registerHQ()

is the error

It tells you right in the key line: The program is failing on registeredteams.Add(), which means registeredteams is null. You never initialized the list.

When you declare the list, do it like this:
var/list/registeredteams=list()

Lummox JR
In response to Lummox JR
Ah, okay. But, is it possible to add mobs to that list?


Like say I register the BYONDeriffic team and say, I can comeback later with a friend and I can add that friend to my team (or any other mob that is in view) if that person accepts. And, how would I correspond that to a persons HQgroup?
In response to Sariat
Sariat wrote:
Ah, okay. But, is it possible to add mobs to that list?


Like say I register the BYONDeriffic team and say, I can comeback later with a friend and I can add that friend to my team (or any other mob that is in view) if that person accepts. And, how would I correspond that to a persons HQgroup?

If the mob isn't deleted when you leave, it can stay safely in the list. If it is deleted, then what you need to do is set up key names in the list instead.

Lummox JR