onActionMouseDown() will work on any level object that has a shape. You'll need setshape on both sides to get it to work clientside and serverside.
Edit: onMouseDown() is detecting of the mouse button is pressed at all, you'll need to check where the mouse actually is yourself. Would probably be better to set a shape and use the action event instead.
Edit2: Btw, I believe its actually onActionLeftMouse() and onActionRightMouse()
PHP Code:
// This is an NPC in a level.
function onCreated() {
setShape(1, 32, 32);
}
function onActionLeftMouse() {
echo("You have clicked on the serverside.");
}
//#CLIENTSIDE
function onCreated() {
setShape(1, 32, 32);
}
function onActionLeftMouse() {
echo("You have clicked on the clientside.");
}
Theres also:
PHP Code:
//#CLIENTSIDE
function onMouseDown(mode) {
if (mousex in |x, x+2| && mousey in |y, y+2|) {
if (mode == "left") {
// You left clicked it
}
else if (mode == "right") {
// you right clicked it.
}
}
}
You would also want to check if the GraalControl is the GUI thats focused.