ID:877345
 
(See the best response by GreatFisher.)
Code:
mob
verb
interact()
usr<<"testing"
mob
var
currentTown = ""
Xaxis
Yaxis
pressed = 0
step_size = 2
Login()
..()
client.focus = src
src.loc = locate(22,22,1)
//src << sound('midis/Town 3.mid',1)
src.icon = 'NPCs.dmi'
src.bound_width = 20
src.bound_x = 5
src.icon_state = "male1"
src.currentTown = "town1"
src.overlays+=new/obj/heads/male
key_down(k)
if(k == "z" && pressed == 0)
interact()
pressed = 1

mob
villagers

oldman1
step_size = 1
icon = 'oldman1.dmi'
icon_state = "base"
var/hair = /obj/heads/oldman1hair
New()

src.overlays += new src.hair
src.bound_width = 20
spawn()walk_loop()
proc
walk_loop()
while(src)
sleep(rand(10,15))
var/stepdir=pick(NORTH,SOUTH,EAST,WEST,null)
walk(src,stepdir)

interact()
set src in oview(1)
usr.client.screen += world_hud["Test Menu"]
usr.DRAW_TEXT("I'm old, but I like walking lol.",2,3,1,15,"Test Menu")


Problem description:
I'm currently using forum_account's library for keyboard macro, and basically what I want to accomplish is that this interact() verb to do what the other mob's interact() verb is whenever I'm near it. ie. When I press "z" near a mob it should do that mob's interact verb, but it doesn't. Sorry for my poor coding, I'm new. Help! and Thanks!

Best response
Make interact a mob proc:
mob
proc
Interact()
..()

then you can define each one for separate mobs and have the interact verb do something like this:
mob
verb
Interact(var/mob/m in oview(1))
m.Interact()


Pretty sure something like that should do the trick.
Look into call() if you're modifying key_down() for the client.
Able to make it work! Thanks guys!