Echo_
2011-04-17 18:06:16
This procedure finds a specified interface component's coordinates and clicks them, pretty self explanatory.
So let's say I want to open the Lumbridge bank and use the deposit carried items tab at the bottom of the bank interface. This is what I would use.
Btw, this relies upon relative coordinates, not absolute.
{*******************************************************************************
procedure ClickInterface(parentIndex, childIndex, randomX, randomY: Integer; left: Boolean);
By: Echo_
Description: Finds the x and y coordinates of an interface and clicks them.
*******************************************************************************}
procedure ClickInterface(parentIndex, childIndex, randomX, randomY: Integer; left: Boolean);
var
ch, x, y, w, h: Integer;
begin
ch := GetInterface(parentIndex, childIndex);
x := SmartGetFieldInt(ch, hook_interface_GetX);
y := SmartGetFieldInt(ch, hook_interface_GetY);
w := SmartGetFieldInt(ch, hook_interface_GetWidth);
h := SmartGetFieldInt(ch, hook_interface_GetHeight);
MMouse(x+(w/2), y+(h/2), RandomRange(-randomX, randomX), RandomRange(-randomY, randomY));
GetMousePos(x, y);
Mouse(x, y, 0, 0, left);
SmartFreeObject(ch);
end;So let's say I want to open the Lumbridge bank and use the deposit carried items tab at the bottom of the bank interface. This is what I would use.
R_OpenBankBooth('lumbridge');
Wait(500 + Random(250));
if (R_BankScreen) then ClickInterface(762, 34, 2, 2, True);Btw, this relies upon relative coordinates, not absolute.