PDA

View Full Version : [OGL] Click Action



Chaos-Energy
06-29-2015, 07:56 PM
This function moves the mouse to a given TPoint and left-clicks if the tooltip contains the given action string. If the tooltip doesn't contain the action string because another model is overlapping the model you want to click, it will right-click using the rightClickOption procedure. If no tooltip is found it won't click.

Returns true if a click occured, false if not.


function tMouse.clickAction(funcClickPoint: tPoint; funcAction: string): boolean
var
funcTimeout: tCountDown;
funcTooltip: string;
begin
moveMouse(funcClickPoint.x, funcClickPoint.y);

funcTimeout.setTime(1000);
repeat
funcTooltip := mouse.getTooltip()
until (funcTooltip <> '') or (funcTimeout.isFinished());

if (funcTooltip <> '') then
begin
if (pos(funcAction, funcTooltip) <> 0) then
begin
mouse.click(funcClickPoint);
result := true;
end
else
result := mouse.rightClickOption(funcClickPoint, funcAction);

exit(result);
end;

exit(false);
end;

Obscurity
06-29-2015, 08:28 PM
Would rep again if I could. Great work!

Clarity
06-29-2015, 08:30 PM
Nice idea for a snippet. Thank you! :)

Lucidity
06-29-2015, 10:47 PM
Thanks for this, I'll be using it in my divination script. I've commented credits on the code. Cheers!

Obscurity
06-30-2015, 02:04 AM
Mind if I include a version of this in the next ogLib update? :).

Chaos-Energy
06-30-2015, 08:41 AM
Sure, go ahead.