ID:2731458
 
Code:


Does anyone know any command that allows me to look at an icon and automatically execute an action? I want to replace the DblClick/b>

What do you mean by "look at"?

There's MouseEntered(), which will trigger an action when the mouse overlaps an atom.

You could also execute the action on a keyboard button press by caching the atom that a mouse is hovering over on the client, and calling an action when that key is pressed via a macro/verb linkage.
In response to Ter13
like, I'm walking with a character on the map, there is a training room to level up the stats, but currently I have to double click on a punching bag icon for him to start training, then I would like a command that when ahead with this bag, it starts to train automatically
In response to DarkSleek
For something like this you could use.. Bump()
mob
Bump(/atom/a)
if(istype(a, /obj/punchingbag)
src.training = TRUE

Move()
if(src.training)
//stop training
stc.training = FALSE

Also if you are going for having these punching bags have verbs to be used you can give them verbs and use the "set src" for a verb to give it a distance of object range.

The verb can check the usr(user of the verb)'s "dir" is equal to the direction from them to the SRC(the bag). To confirm if they can use it as well.
obj/verb/punch()
set src in oview(1)