ID:906608
 
Keywords: detect, rightclick
(See the best response by Kaiochao.)
Code:


Problem description:
I'm trying to figure out how to detect a right click from the mouse. I gather from reading the skin reference that there's a parameter I can access that's related to the Click() proc, but I can't seem to find an example, and I haven't been able to find one on the forums.

For now, all I want to do is right click on an object and display output to the player that says, "You clicked on [whatever]."
Firstly you'll need to check the "Send right-clicks to mouse procs" box for your map element: http://puu.sh/NKq7

Then, you can do this:

turf
Click(location, control, params)
var/list/convertedParams = params2list(params)

if("right" in convertedParams)
usr << "Right click detected."
Thanks LordAndrew. No wonder I couldn't figure it out. Do you know... is this covered somewhere in more detail (like under a Help topic maybe)?
Best response
p["right"] is also a true value during right-clicks. It's probably slightly more efficient than the "in" operator.

I think the original way to activate right-clicking on maps is to set client.show_popup_menus=0.

There's an entire reference entry for "mouse control".
In response to OrionBPG
The mouse control entry explains a great deal of it.
Okay. Thanks much. In reading that, I can see that my first error was not enabling right-mouse clicks as procs on the particular control I was working on. My second error was that my "Click()" proc was defined under client, which takes an extra parameter ("object"), so my params2list() was converting the wrong thing.

Now I think I get it. Thanks again to you both.