ID:138740
 
Code:
/datum/game_mode/proc/pick_aliens()
var/list/candidates
for(var/mob/living/carbon/human/G in world)
if(G.client)
if(G.client.be_alien)
if(((G.client.inactivity/10)/60) <= 5)
candidates.Add(G)



Problem description: It showed no errors in Dream Maker but Dream Daemon started to show errors when called:
proc name: pick aliens (/mob/verb/pick_aliens)
source file: Alien2.dm,8
usr: Lucium Nightgale (/mob/living/carbon/human)
src: Lucium Nightgale (/mob/living/carbon/human)
call stack:



So, I decided to turn it into a verb for troubleshooting and then I changed the Add proc into a + operation:
mob/verb/pick_aliens()
var/list/candidates
for(var/mob/living/carbon/human/G in world)
if(G.client)
if(G.client.be_alien)
if(((G.client.inactivity/10)/60) <= 5)
candidates.Add(G)



which showed no errors but Dream Daemon reported:
Lucium Nightgale (/mob/living/carbon/human): pick aliens()
runtime error: Cannot execute null.Add().
proc name: pick aliens (/mob/verb/pick_aliens)
source file: Alien2.dm,8
usr: Lucium Nightgale (/mob/living/carbon/human)
src: Lucium Nightgale (/mob/living/carbon/human)
call stack:



Now I get this in Dream Maker.
Alien2.dm:7:warning: +: statement has no effect



Any help given will be much appreciated.
~AD
You need to initialize lists before you use them.
var candidates[0] // this creates an empty list
var candidates[] // this creates a variable that the compiler sees is a list, but it hasn't been initialized yet
In response to Kaiochao
I tried it and it worked perfectly! Thank you!

This is the second time I've tried to use a list without initializing it... I've always thought it was something wrong with the adding and subtracting procs/operations.