ID:147880
 
I'm putting in a separate command in my game to delete all objects that someone built through right clicking something and selecting it from a popup menu, since the other verb like it uses a list proc that basically disables the verb from being displayed in the popup menu.
            Delete_All_Owned_Objects(obj/o in view())
set category = "Owner"
set desc = "Delete everything that a specific key made."
for(var/obj/P in world)
if(P.owner == o.owner)
del P
del o

It keeps giving me the error: "Cannot read null.owner". Could anyone tell me why?
Also, is there a setting that can hide a verb from the verb panel, but still allows one to see it in a popup menu?
"var/obj/P in world"
"P.owner"
I'm not sure how that code works, but to fix the error, add before "if(P.owner == o.owner)" this line "if(!P) continue". Sometimes a non-existing or something I do not exactly know of is returned in the world.contents list. That line will skip over null objects.
Close, Yota, but not quite.

Enigmaster2002 wrote:
for(var/obj/P in world)
if(P.owner == o.owner)
del P
del o

See that line I've bolded? You're deleting "o" the first time through the loop. Therefore, the second time through the loop, you'll get that null.owner error. It looks like you've indented the line once too many times than you meant to.

You might also want to check that (P!=o), otherwise you might end up deleting "o" even without the "del o" line. Just put this line immediately after the for() line:

if (P==o) continue
In response to Crispy
Thanks Crispy, you're like the part of my mind that isn't there. Now that that's fixed, could anyone tell me if there's a setting that would hide the verb from the verb panel, but still allow it to show up in the popup menu?
In response to Enigmaster2002
Try set category = null
In response to Enigmaster2002
Enigmaster2002 wrote:
Thanks Crispy, you're like the part of my mind that isn't there. Now that that's fixed, could anyone tell me if there's a setting that would hide the verb from the verb panel, but still allow it to show up in the popup menu?

What do you mean by "still allow the verb to show up in the popup menu"? I am not quite sure what you are refering to by saying "the popup menu".
In response to Loduwijk
I meant "popup menu" as in when you right click on a mob or obj, and it lists all the verbs associated with it in a menu. But Lazyboy answered my question with setting the verb's category to null.
In response to Enigmaster2002
Enigmaster2002 wrote:
Thanks Crispy, you're like the part of my mind that isn't there.

Our brain must have got a divorce. ;-D