ID:147174
 
The usrs are acually srcs I changed them and still got the same error, and when I use it at Login() the proc just doesn't work.
world/New()
..()
usr.Check4Picks()

var/draftstatus = "over" // nodraft, inprogress, and over

mob/proc/Check4Picks()
if(draftstatus == "over")
if(locate((/obj/Round1_Pick1) in usr.contents))
usr.contents-=/obj/Round1_Pick1
if(locate((/obj/Round1_Pick2) in usr.contents))
usr.contents-=/obj/Round1_Pick2
if(locate((/obj/Round1_Pick3) in usr.contents))
usr.contents-=/obj/Round1_Pick3
if(locate((/obj/Round1_Pick4) in usr.contents))
usr.contents-=/obj/Round1_Pick4
if(locate((/obj/Round1_Pick5) in usr.contents))
usr.contents-=/obj/Round1_Pick5
if(locate((/obj/Round1_Pick6) in usr.contents))
usr.contents-=/obj/Round1_Pick6
if(locate((/obj/Round1_Pick7) in usr.contents))
usr.contents-=/obj/Round1_Pick7
if(locate((/obj/Round1_Pick8) in usr.contents))
usr.contents-=/obj/Round1_Pick8
if(locate((/obj/Round1_Pick9) in usr.contents))
usr.contents-=/obj/Round1_Pick9
if(locate((/obj/Round1_Pick10) in usr.contents))
usr.contents-=/obj/Round1_Pick10
if(locate((/obj/Round1_Pick11) in usr.contents))
usr.contents-=/obj/Round1_Pick11
if(locate((/obj/Round1_Pick12) in usr.contents))
usr.contents-=/obj/Round1_Pick12
if(locate((/obj/Round1_Pick13) in usr.contents))
usr.contents-=/obj/Round1_Pick13
if(locate((/obj/Round1_Pick14) in usr.contents))
usr.contents-=/obj/Round1_Pick14
if(locate((/obj/Round1_Pick15) in usr.contents))
usr.contents-=/obj/Round1_Pick15
if(locate((/obj/Round1_Pick16) in usr.contents))
usr.contents-=/obj/Round1_Pick16
if(locate((/obj/Round1_Pick17) in usr.contents))
usr.contents-=/obj/Round1_Pick17
if(locate((/obj/Round1_Pick18) in usr.contents))
usr.contents-=/obj/Round1_Pick18
if(locate((/obj/Round1_Pick19) in usr.contents))
usr.contents-=/obj/Round1_Pick19
if(locate((/obj/Round1_Pick20) in usr.contents))
usr.contents-=/obj/Round1_Pick20
if(locate((/obj/Round2_Pick1) in usr.contents))
usr.contents-=/obj/Round2_Pick1
if(locate((/obj/Round2_Pick2) in usr.contents))
usr.contents-=/obj/Round2_Pick2
if(locate((/obj/Round2_Pick3) in usr.contents))
usr.contents-=/obj/Round2_Pick3
if(locate((/obj/Round2_Pick4) in usr.contents))
usr.contents-=/obj/Round2_Pick4
if(locate((/obj/Round2_Pick5) in usr.contents))
usr.contents-=/obj/Round2_Pick5
if(locate((/obj/Round2_Pick6) in usr.contents))
usr.contents-=/obj/Round2_Pick6
if(locate((/obj/Round2_Pick7) in usr.contents))
usr.contents-=/obj/Round2_Pick7
if(locate((/obj/Round2_Pick8) in usr.contents))
usr.contents-=/obj/Round2_Pick8
if(locate((/obj/Round2_Pick9) in usr.contents))
usr.contents-=/obj/Round2_Pick9
if(locate((/obj/Round2_Pick10) in usr.contents))
usr.contents-=/obj/Round2_Pick10
if(locate((/obj/Round2_Pick11) in usr.contents))
usr.contents-=/obj/Round2_Pick11
if(locate((/obj/Round2_Pick12) in usr.contents))
usr.contents-=/obj/Round2_Pick12
if(locate((/obj/Round2_Pick13) in usr.contents))
usr.contents-=/obj/Round2_Pick13
if(locate((/obj/Round2_Pick14) in usr.contents))
usr.contents-=/obj/Round2_Pick14
if(locate((/obj/Round2_Pick15) in usr.contents))
usr.contents-=/obj/Round2_Pick15
if(locate((/obj/Round2_Pick16) in usr.contents))
usr.contents-=/obj/Round2_Pick16
if(locate((/obj/Round2_Pick17) in usr.contents))
usr.contents-=/obj/Round2_Pick17
if(locate((/obj/Round2_Pick18) in usr.contents))
usr.contents-=/obj/Round2_Pick18
if(locate((/obj/Round2_Pick19) in usr.contents))
usr.contents-=/obj/Round2_Pick19
if(locate((/obj/Round2_Pick20) in usr.contents))
usr.contents-=/obj/Round2_Pick20
if(locate((/obj/Round3_Pick1) in usr.contents))
usr.contents-=/obj/Round3_Pick1
if(locate((/obj/Round3_Pick2) in usr.contents))
usr.contents-=/obj/Round3_Pick2
if(locate((/obj/Round3_Pick3) in usr.contents))
usr.contents-=/obj/Round3_Pick3
if(locate((/obj/Round3_Pick4) in usr.contents))
usr.contents-=/obj/Round3_Pick4
if(locate((/obj/Round3_Pick5) in usr.contents))
usr.contents-=/obj/Round3_Pick5
if(locate((/obj/Round3_Pick6) in usr.contents))
usr.contents-=/obj/Round3_Pick6
if(locate((/obj/Round3_Pick7) in usr.contents))
usr.contents-=/obj/Round3_Pick7
if(locate((/obj/Round3_Pick8) in usr.contents))
usr.contents-=/obj/Round3_Pick8
if(locate((/obj/Round3_Pick9) in usr.contents))
usr.contents-=/obj/Round3_Pick9
if(locate((/obj/Round3_Pick10) in usr.contents))
usr.contents-=/obj/Round3_Pick10
if(locate((/obj/Round3_Pick11) in usr.contents))
usr.contents-=/obj/Round3_Pick11
if(locate((/obj/Round3_Pick12) in usr.contents))
usr.contents-=/obj/Round3_Pick12
if(locate((/obj/Round3_Pick13) in usr.contents))
usr.contents-=/obj/Round3_Pick13
if(locate((/obj/Round3_Pick14) in usr.contents))
usr.contents-=/obj/Round3_Pick14
if(locate((/obj/Round3_Pick15) in usr.contents))
usr.contents-=/obj/Round3_Pick15
if(locate((/obj/Round3_Pick16) in usr.contents))
usr.contents-=/obj/Round3_Pick16
if(locate((/obj/Round3_Pick17) in usr.contents))
usr.contents-=/obj/Round3_Pick17
if(locate((/obj/Round3_Pick18) in usr.contents))
usr.contents-=/obj/Round3_Pick18
if(locate((/obj/Round3_Pick19) in usr.contents))
usr.contents-=/obj/Round3_Pick19
if(locate((/obj/Round3_Pick20) in usr.contents))
usr.contents-=/obj/Round3_Pick20


==Error==
runtime error: Cannot execute null.Check4Picks().
proc name: New (/world/New)
source file: initialization.dm,7
usr: null
src:
call stack:
: New()


Any ideas what's causing this problem?
ZLegend wrote:
The usrs are acually srcs I changed them and still got the same error, and when I use it at Login() the proc just doesn't work.
> world/New()
> ..()
> usr.Check4Picks()
>
> var/draftstatus = "over" // nodraft, inprogress, and over
>
> mob/proc/Check4Picks()
> if(draftstatus == "over")
> if(locate((/obj/Round1_Pick1) in usr.contents))
> usr.contents-=/obj/Round1_Pick1
> if(locate((/obj/Round1_Pick2) in usr.contents))
> usr.contents-=/obj/Round1_Pick2
> if(locate((/obj/Round1_Pick3) in usr.contents))
> usr.contents-=/obj/Round1_Pick3
> if(locate((/obj/Round1_Pick4) in usr.contents))
> usr.contents-=/obj/Round1_Pick4
> if(locate((/obj/Round1_Pick5) in usr.contents))
> usr.contents-=/obj/Round1_Pick5
> if(locate((/obj/Round1_Pick6) in usr.contents))
> usr.contents-=/obj/Round1_Pick6
> if(locate((/obj/Round1_Pick7) in usr.contents))
> usr.contents-=/obj/Round1_Pick7
> if(locate((/obj/Round1_Pick8) in usr.contents))
> usr.contents-=/obj/Round1_Pick8
> if(locate((/obj/Round1_Pick9) in usr.contents))
> usr.contents-=/obj/Round1_Pick9
> if(locate((/obj/Round1_Pick10) in usr.contents))
> usr.contents-=/obj/Round1_Pick10
> if(locate((/obj/Round1_Pick11) in usr.contents))
> usr.contents-=/obj/Round1_Pick11
> if(locate((/obj/Round1_Pick12) in usr.contents))
> usr.contents-=/obj/Round1_Pick12
> if(locate((/obj/Round1_Pick13) in usr.contents))
> usr.contents-=/obj/Round1_Pick13
> if(locate((/obj/Round1_Pick14) in usr.contents))
> usr.contents-=/obj/Round1_Pick14
> if(locate((/obj/Round1_Pick15) in usr.contents))
> usr.contents-=/obj/Round1_Pick15
> if(locate((/obj/Round1_Pick16) in usr.contents))
> usr.contents-=/obj/Round1_Pick16
> if(locate((/obj/Round1_Pick17) in usr.contents))
> usr.contents-=/obj/Round1_Pick17
> if(locate((/obj/Round1_Pick18) in usr.contents))
> usr.contents-=/obj/Round1_Pick18
> if(locate((/obj/Round1_Pick19) in usr.contents))
> usr.contents-=/obj/Round1_Pick19
> if(locate((/obj/Round1_Pick20) in usr.contents))
> usr.contents-=/obj/Round1_Pick20
> if(locate((/obj/Round2_Pick1) in usr.contents))
> usr.contents-=/obj/Round2_Pick1
> if(locate((/obj/Round2_Pick2) in usr.contents))
> usr.contents-=/obj/Round2_Pick2
> if(locate((/obj/Round2_Pick3) in usr.contents))
> usr.contents-=/obj/Round2_Pick3
> if(locate((/obj/Round2_Pick4) in usr.contents))
> usr.contents-=/obj/Round2_Pick4
> if(locate((/obj/Round2_Pick5) in usr.contents))
> usr.contents-=/obj/Round2_Pick5
> if(locate((/obj/Round2_Pick6) in usr.contents))
> usr.contents-=/obj/Round2_Pick6
> if(locate((/obj/Round2_Pick7) in usr.contents))
> usr.contents-=/obj/Round2_Pick7
> if(locate((/obj/Round2_Pick8) in usr.contents))
> usr.contents-=/obj/Round2_Pick8
> if(locate((/obj/Round2_Pick9) in usr.contents))
> usr.contents-=/obj/Round2_Pick9
> if(locate((/obj/Round2_Pick10) in usr.contents))
> usr.contents-=/obj/Round2_Pick10
> if(locate((/obj/Round2_Pick11) in usr.contents))
> usr.contents-=/obj/Round2_Pick11
> if(locate((/obj/Round2_Pick12) in usr.contents))
> usr.contents-=/obj/Round2_Pick12
> if(locate((/obj/Round2_Pick13) in usr.contents))
> usr.contents-=/obj/Round2_Pick13
> if(locate((/obj/Round2_Pick14) in usr.contents))
> usr.contents-=/obj/Round2_Pick14
> if(locate((/obj/Round2_Pick15) in usr.contents))
> usr.contents-=/obj/Round2_Pick15
> if(locate((/obj/Round2_Pick16) in usr.contents))
> usr.contents-=/obj/Round2_Pick16
> if(locate((/obj/Round2_Pick17) in usr.contents))
> usr.contents-=/obj/Round2_Pick17
> if(locate((/obj/Round2_Pick18) in usr.contents))
> usr.contents-=/obj/Round2_Pick18
> if(locate((/obj/Round2_Pick19) in usr.contents))
> usr.contents-=/obj/Round2_Pick19
> if(locate((/obj/Round2_Pick20) in usr.contents))
> usr.contents-=/obj/Round2_Pick20
> if(locate((/obj/Round3_Pick1) in usr.contents))
> usr.contents-=/obj/Round3_Pick1
> if(locate((/obj/Round3_Pick2) in usr.contents))
> usr.contents-=/obj/Round3_Pick2
> if(locate((/obj/Round3_Pick3) in usr.contents))
> usr.contents-=/obj/Round3_Pick3
> if(locate((/obj/Round3_Pick4) in usr.contents))
> usr.contents-=/obj/Round3_Pick4
> if(locate((/obj/Round3_Pick5) in usr.contents))
> usr.contents-=/obj/Round3_Pick5
> if(locate((/obj/Round3_Pick6) in usr.contents))
> usr.contents-=/obj/Round3_Pick6
> if(locate((/obj/Round3_Pick7) in usr.contents))
> usr.contents-=/obj/Round3_Pick7
> if(locate((/obj/Round3_Pick8) in usr.contents))
> usr.contents-=/obj/Round3_Pick8
> if(locate((/obj/Round3_Pick9) in usr.contents))
> usr.contents-=/obj/Round3_Pick9
> if(locate((/obj/Round3_Pick10) in usr.contents))
> usr.contents-=/obj/Round3_Pick10
> if(locate((/obj/Round3_Pick11) in usr.contents))
> usr.contents-=/obj/Round3_Pick11
> if(locate((/obj/Round3_Pick12) in usr.contents))
> usr.contents-=/obj/Round3_Pick12
> if(locate((/obj/Round3_Pick13) in usr.contents))
> usr.contents-=/obj/Round3_Pick13
> if(locate((/obj/Round3_Pick14) in usr.contents))
> usr.contents-=/obj/Round3_Pick14
> if(locate((/obj/Round3_Pick15) in usr.contents))
> usr.contents-=/obj/Round3_Pick15
> if(locate((/obj/Round3_Pick16) in usr.contents))
> usr.contents-=/obj/Round3_Pick16
> if(locate((/obj/Round3_Pick17) in usr.contents))
> usr.contents-=/obj/Round3_Pick17
> if(locate((/obj/Round3_Pick18) in usr.contents))
> usr.contents-=/obj/Round3_Pick18
> if(locate((/obj/Round3_Pick19) in usr.contents))
> usr.contents-=/obj/Round3_Pick19
> if(locate((/obj/Round3_Pick20) in usr.contents))
> usr.contents-=/obj/Round3_Pick20
>

==Error==
<font color = red>runtime error: Cannot execute null.Check4Picks().
proc name: New (/world/New)
source file: initialization.dm,7
usr: null
src:
call stack:
: New()</font color>

Any ideas what's causing this problem?

What are you trying to do with this? Everytime a mob logs in you want it to check if they have a certain obj in their contents?

If so then:

mob
Login()
..()
src.Check4Picks()
In response to DeathAwaitsU
yes I do.
In response to DeathAwaitsU
The object is still in the contents of the user.
In response to ZLegend
is draftstatus over?
In response to DeathAwaitsU
eh nevermind. I'll try for another hour to figure this out. >.<
Instead of having all of those if statements in that proc, you should add all of the draft pick types into a single list.
var/list/picktypes = list(/obj/Round1_Pick1,/obj/Round1_Pick2,...,/obj/Round3_Pick20) // the full list of draft types goes here
Then in the proc, you could do something like this.
mob/proc/Check4Picks()
if(draftstatus == "over")
for(var/picktype in picktypes)
var/pick = locate(picktype) in src.contents
if(pick)
del(pick)
Other than the list containing all of the pick types, its alot shorter than before, no?
In response to ZLegend
ZLegend wrote:
The object is still in the contents of the user.

There is no "the user" in world/New(). You're calling the proc at entirely the wrong time. world/New() shouldn't even be touching this.

You don't seem to have a handle on when not to use usr. Here's an important article that clarifies the issue.

Lummox JR