mob {
proc {
WhatClick(control) {
world << "click";
var/list/control2 = params2list(control);
world << control2.len;
if(control2["right"]) return "right";
if(control2["left"]) return "left";
}
}
}
Problem description:
Whenever I run the "WhatClick()" proc from the Click() event, it logs that control2.len is 4 (Containing icon-x, icon-y, left/right, and screen-loc) and it returns the proper mouse button ("left" or "right").
Whenever I run the "WhatClick()" proc from the MouseDown() event, it logs that control2.len is 0 and it returns null.
This behavior is consistent across client/Click(), obj/Click(), client/MouseDown(), and obj/MouseDown().
Is there any reason for MouseDown()'s control variable to be of length 0, where Click()'s control variable is of length 4?
Example of a MouseDown() event:
client {
MouseDown(location,control,params) {
if(usr.WhatClick(control) == "left") {
if(mouse_position.IsOverMap()) {
usr.mouseDown = 1;
if(CheckGUIConflict()) Edit();
}
}
}
}
Example of a Click() event:
obj {
gui {
mle_btn {
icon_state = "melee";
Click(object,location,control,params) {
if(usr.WhatClick(control) == "left") {
usr.unitMode = "melee";
usr.RefreshUI();
}
}
}
}
}
Edit: The reason why I am using MouseDown() is because I want to track how long the user's mouse is held down. I have a corresponding MouseUp() event to set usr.mouseDown = 0;