SRL Archive - OSR Help

How to Wait for and click a color when it appears?


Mister Snow

2012-05-15 13:23:53

The goal here is to wait until the offer completes and turns green like this. When that happens, I want to click there.





Here is what I tried and failed with:

Function FindCompleteNature: Boolean; //x, y, 1999423, 54, 168, 152, 175, 0, 1000000000) : True;
var
x, y : Integer;
begin;
writeln('Waiting for nature runes buy to complete');
wait(500 + random (50));
if FindColorSpiralTolerance(x, y, 1999423 , 54, 168, 152, 175, 0) then
MoveMouse(x, y);
begin
writeln('wewt');
Mouse(x, y, 0, 0, True);
end;
end;


Apologies for being dumb @ coding.

CephaXz

2012-05-15 13:26:12


Function FindCompleteNature: Boolean; //x, y, 1999423, 54, 168, 152, 175, 0, 1000000000) : True;
var
x, y : Integer;
begin;
writeln('Waiting for nature runes buy to complete');
repeat
wait(500 + random (50));
Antiban; //So it doesn't logout
until FindColorSpiralTolerance(x, y, 1999423 , 54, 168, 152, 175, 0);

if FindColorSpiralTolerance(x, y, 1999423 , 54, 168, 152, 175, 0) then
begin
MMouse(x, y, 3, 3);
writeln('wewt');
ClickMouse2(mouse_Left);
Result := True;
end;
end;

Mister Snow

2012-05-15 13:50:12

Thank you very much!

More questions to come I am sure.

:)

Runaway

2012-05-15 13:59:58

From: Mister Snow
The goal here is to wait until the offer completes and turns green like this. When that happens, I want to click there.

Function FindCompleteNature: Boolean; //x, y, 1999423, 54, 168, 152, 175, 0, 1000000000) : True;
var
x, y : Integer;
begin;
writeln('Waiting for nature runes buy to complete');
wait(500 + random (50));
if FindColorSpiralTolerance(x, y, 1999423 , 54, 168, 152, 175, 0) then
MoveMouse(x, y);
begin
writeln('wewt');
Mouse(x, y, 0, 0, True);
end;
end;


Try this out:

function FindCompleteNature(WaitFor: Integer): Boolean;
var
x, y : Integer;
t: Integer;
begin
Result := False;
Writeln('Waiting for nature runes buy to complete');
MarkTime(t);
repeat
if FindColorSpiralTolerance(x, y, 1999423, 54, 168, 152, 175, 1) then
begin
Result := True;
Break;
end;
Wait(1000 + Random(500));
until(TimeFromMark(t) > WaitFor);
if Result then
Mouse(x, y, 3, 3, True);
end;

That should do the trick :)

Flight

2012-05-15 21:09:47

We have this nifty function:

function WaitFindColor(var X, Y: Integer; Color, x1, y1, x2, y2, Tol, MaxTime: Integer): Boolean;