ID:1396831
 
(See the best response by Ter13.)
Code:
obj/SkillCards/ActionButton
Click(x,y)
if((src in usr)&&(findtext("[y]","HotBar"))) Action()
else ..()

verb/Action()
set category="TECHNIQUES"
set src in usr.contents
..()

mob/NPC
Fisherman
name = "Fisherman"
icon = 'Fisherman.dmi'

verb
Action()
//code here for interacting with NPC


Problem description:
I was hoping this would work - having an obj in ther usr's inventory, with a verb attached to it ("Action"); and having that same verb-name be attached to NPCs and various objects...

But it doesn't...
Is there a work around to get what I wanna achieve? :)

Cheers
Best response
Can you clarify a bit?

Seems like you want a clickable button on the screen that will call a verb, right?

If so, there's no reason to use verbs, and you should be using procs instead.
I intend for all of my various NPCs, as well as a variety of different objects to all be interacted with by a single "action" verb.
This action verb is a verb attached to an obj in the usr's inventory.

The NPCs would be 'interactable' from ranges of 0-3 tiles.
Some objects would be interactable if you're facing it the exclusion of other interactions.
Other objects would interact with it at varying ranges.

Im sure I could do a check in the Action verb to check for these possible outcomes and acting accordingly. But I cant see such a system working without using oview/orange etc. I would love to avoid using any such procs as they (relatively speaking) use up far more resources than otherwise.
Using getstep would be an enormous pain too, esp for off-set angles...

I was hoping I could just use the action obj verb to "activate" the various mobs'/objs' verbs.
obj/SkillCards/ActionButton
Click(x,y)
if((src in usr)&&(findtext("[y]","HotBar")))
for(var/atom/atom in range()) atom.Action(usr)
else ..()

/atom/proc/Action(mob/user)
return

mob/NPC
Fisherman
name = "Fisherman"
icon = 'Fisherman.dmi'

Action(mob/user)
if(user in range(2, src)) world << "[user] INTERACTED WITH THE MOTHERFUCKING FISHERMAN."
Thanks for this! It didn't fully cover what I needed but I'm able to make some concessions to the system and am left with a working version.

Just ONE thing though. The 'cmdstring' var is important for my in-built macro system.
Long story short, I need the Action() proc to be insertable into this line:
// kKey = the relevant keyboard key pressed,
// and ACTION is where the verb would normally go;
// as command_text.
winset(src,kKey,{"parent="Game";name=[kKey];command="ACTION""})
In response to Saucepan Man
From what I recall, command within winset() can only call verbs.

You could just have one verb under the player that prioritizes searching for an NPC within range over everything else. If it finds it, call your Action() proc, otherwise move down your priority list ( I'd assume NPC then interactive objects? ).