ID:160658
 
And yes, here I come again, mr. "noob-at-mouse-control".

I really don't understand Click()/DblClick() its args.
I know how they both work, by just called mob/Click() and such, but could someone explane me these args?


Format: Click(location,control,params)
When: Called when the object is clicked.
Args: location: the turf, stat panel, grid cell, etc. in which the object was clicked
control: the name of the skin control involved
params: other parameters including mouse/keyboard flags, icon offsets, etc.; see mouse control

This proc is called by the default client.Click() procedure.
The following example allows the player to walk to a position by clicking it.


My question is, could someone explain me the args and how I have to use them, with an example, if possible.

Thanks for youur time reading this and thanks in advance,

~ Rick
atom/Click(location,control,params)
var/list/p=params2list(params)
if(p.Find("right"))usr<<"You right clicked [src]!"
if(p.Find("left"))usr<<"You left clicked [src]!"
if(p.Find("shift"))usr<<"You shift+clicked [src]!"
usr<<"You clicked \icon[src] at [p["icon-x"]],[p["icon-y"]]!"

Look up "mouse control" in the DM reference to see a list of the supported parameters and other information.

If you have an interface file, control returns the ID of the control you clicked.
In response to Kaiochao
The thing is, I looked it up but I was like.. "o_O yeah..."

Thanks alot Kaiochao, this cleared alot for me up. ^^
In response to Kaiochao
The right click isn't working. o-o
I, myself have no idea how to fix it. xD
In response to Sokkiejjj
Right click actions won't work if pop-up menus are enabled.
You can either set the client var show_popup_menus to 0 to disable all pop-up menus or check "send right-clicks to mouse procs" on a certain control to disable pop-up menus on that control.
In response to Jemai1
Jemai1 wrote:
You can either set the client var show_popup_menus to 0 to disable all pop-up menus or check "send right-clicks to mouse procs" on a certain control to disable pop-up menus on that control.

Now, is there a way to distinguish right-clicks from left-clicks in the mouse procs?
In response to Hiro the Dragon King
Yes.
client
Click(object,location,control,params)
var/list/p = params2list(params)
if(p["right"])
src << "You right-clicked on [object]"
..()


Click here to learn more on mouse control.
In response to Kaiochao
You should really use the 'in' statement instead of the Find() proc in these cases -- it's faster. The only time you need to use Find() is if you need the exact index number of an item in the list.