SRL Archive - OSR Help

Function not clicking mouse -.-


rj

2013-08-31 20:04:12

So my code is finding the object, hovering the mouse over it but not clicking it for some reason..


It's finding the stall:


It's moving the mouse to the stall:

MiddleTPAEx(ATPA[i], x, y);
Mouse(x, y, 0, 0, Mouse_left);

Here is my code:

function g_find_stall:Boolean;
var
TPA, green_TPA:TPointArray;
ATPA:T2DPointArray;
i, x, y:Integer;
Bounds:TBox;
begin
// if (not g_loggedin) then
//exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.22, 4.57);
FindColorsTolerance(TPA, 2050398, 0, 0, 514, 338, 3);
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.02, 0.02);
if (Length(TPA) > 0) then
begin
ATPA := TPAToATPAEx(TPA, 22, 22);
FilterTPAsBetween(ATPA, 0, 10);
SortATPAFromFirstpoint(ATPA, Point(259, 172));
if (debug = true) then
DebugATPABounds(ATPA);
for i := 0 to high(ATPA) do
begin
Bounds := GetTPABounds(ATPA[i]);
FindColorsTolerance(Green_TPA, 1747732, Bounds.x1, Bounds.y1, Bounds.x2, Bounds.y2, 21);
if (length(green_TPA) > 10) then
begin
Writeln('Green length: ' + ToStr(length(green_TPA)));
result := true;
MiddleTPAEx(ATPA[i], x, y);
Mouse(x, y, 0, 0, Mouse_left);
exit;
end;
end;
end;
end;

I know the length of the green is > 10 because the debug box prints

Green length: 66

the function is returning true:

Writeln(g_find_stall);
True

Brandon

2013-08-31 20:18:08

Why don't you debug it then? Put a writeln everywhere before and after the mouse. Print the X and Y.. If it is a valid X and Y, it should click.

rj

2013-08-31 20:22:30

From: Brandon
Why don't you debug it then? Put a writeln everywhere before and after the mouse. Print the X and Y.. If it is a valid X and Y, it should click.


Green length: 44
(248, 134)
True

Is a valid spot, Mouse is moving the mouse but not clicking it , I even tried clickmouse2 afterwards with the same results(no clicking)

Nebula

2013-08-31 20:33:23

try using true instead of mouse_left

rj

2013-08-31 20:36:24

From: Nebula
try using true instead of mouse_left


Tried it, still won't click

@Brandon it appears it will move the mouse but the client isn't registering the simba clicks do you think it would be detecting it? Because I got simba to click anything else but it can't click anything to do with the client

Brandon

2013-08-31 21:19:25

From: Officer Barbrady
Tried it, still won't click

@Brandon it appears it will move the mouse but the client isn't registering the simba clicks do you think it would be detecting it? Because I got simba to click anything else but it can't click anything to do with the client


What client though? If it is an RSPS and Smart then I'm not sure why it won't click. It should if the mouse is moving.

If it is a browser ten that uses SendInout from Winapi I hope and it doesn't exactly fail.

rj

2013-08-31 21:23:37

From: Brandon
What client though? If it is an RSPS and Smart then I'm not sure why it won't click. It should if the mouse is moving.

If it is a browser ten that uses SendInout from Winapi I hope and it doesn't exactly fail.


It's called grinderscape and I downloaded it's client which was a .exe (no idea if that effects anything but just going to throw that out there)

stata

2013-09-02 00:28:00

Try ClickMouse
procedure ClickMouse(x, y: Integer; Left: Boolean);

or make your own click with
procedure HoldMouse(x, y: Integer; Left: Boolean);
Holds mouse button. Set parameter Left to true for left button, false for right.

procedure ReleaseMouse(x, y: Integer; Left: Boolean);
Releases mouse button. Set parameter Left to true for left button, false for right.

just put a small random wait time between the two

rj

2013-09-02 18:57:11

From: stata
Try ClickMouse
procedure ClickMouse(x, y: Integer; Left: Boolean);

or make your own click with
procedure HoldMouse(x, y: Integer; Left: Boolean);
Holds mouse button. Set parameter Left to true for left button, false for right.

procedure ReleaseMouse(x, y: Integer; Left: Boolean);
Releases mouse button. Set parameter Left to true for left button, false for right.

just put a small random wait time between the two


Wouldn't make a difference but tried anyway and failed


anyone else have any ideas?