ID:178604
 
I'm trying to get my get verb (called Search) to pick up obj's. The problem is that I have the obj's in different groups, such as /obj/weapons, /obj/shields, and so on. I don't want the verb attached to the individual items if possible. I have a menu that is brought up by a macro, and the verb is in that menu. Here is the code.

----------
mob
verb
VerbList()
set category = null
var/verbchoice = input("Command") in list ("Talk","Item","Cast","Equip","Search","Cancel")
switch(verbchoice)
if("Talk")
Talk()
if("Item")
Item()
if("Cast")
Cast()
if("Equip")
masterequip()
if("Search")
Search()
if("Cancel")
return ..()
Search(obj/O as obj in oview(1))
set category = null
O.Move(usr)
-------
The error is

runtime error: Cannot execute null.Move().
verb name: Search (/mob/verb/Search)
usr: Hero (/mob/hero)
src: Hero (/mob/hero)
call stack:
Hero (/mob/hero): Search(null)
Hero (/mob/hero): VerbList()

---------

Any help is appreciated. Thanks.
for(var/obj/O in oview(1))
O.loc = usr
In response to Sariat
Duh, I didn't even think about that. Thanks.
The problem here is that you are calling Search fine, but there is nothing in the parentheses, so you are defining O as null. You're basically calling Search(null), so O turns out to be null. When you use args, you can only input the args if you are directly calling the verb, not just calling it from another verb or proc. I would do this:
mob/proc/Search()
//Make it a proc so you can't select it; remember you can still use verbs even if category = null
for(var/obj/O in view(src,1))
O.Move(src)
return //end here so you only pick up one thing

Remember that just because you set category = null, you can still call the verb by typing it into the command line. If you *really* want it to still be a verb, then set invisibility = 101 and no one will be able to access it.
In response to Rubius
Also, if you making it a macro, make the verb hidden.

set hidden = 1