ID:137475
 
I dont think this is possible right now but I would like to know if it will be in the future since byond isnt finished yet and still has a ton of room for features. Would it be possible to have verbs work from a variables besides the mobs name like having some kind of verb code that looks like this:

mob/verb
examine(obj/O as O.desc in usr.contents)
usr << "[O.desc] looks like a [O.name]."

that way when you clicked the examine verb you would get a list that showed the desc variables of the objs in your contents instead of their names.
Skrylan wrote:
I dont think this is possible right now but I would like to know if it will be in the future since byond isnt finished yet and still has a ton of room for features. Would it be possible to have verbs work from a variables besides the mobs name like having some kind of verb code that looks like this:

mob/verb
examine(obj/O as O.desc in usr.contents)
usr << "[O.desc] looks like a [O.name]."

that way when you clicked the examine verb you would get a list that showed the desc variables of the objs in your contents instead of their names.

I believe Dantom is working on some parsing functionality that would allow programmers to do this sort of thing, with a little work. In the meantime, a quick workaround would be to leave the verb without arguments, then have it loop through the user's contents and make a list of all the item descriptions from which the user can select via the input() proc. For players using the verbpanels, the effect would basically be identical--the only real drawback is lack of command-line input/macroing capability.
In response to Leftley
In the meantime, a quick workaround would be to leave the verb without arguments, then have it loop through the user's contents and make a list of all the item descriptions from which the user can select via the input() proc.


Another way is to create a custom possible values list:

proc/InvDescriptions()
   var/lst[0]
   for(var/O in contents)
      lst += O.desc
   return lst

mob/verb/examine(Desc in InvDescriptions())
   //blah


Of course, if you wanted to find out what the original object was, you would have to loop through the inventory and find an item with a matching description.

--Dan
In response to Dan
Oh, duh, can't believe I never thought of that. Fortunately, I can't remember any of the things I've ever done that would've needed it, so I can't get really frustrated at myself.
In response to Dan
Hey that's terrific, I can think of a ton of ways to use that! thanks!