SRL Archive - OSR Help

Quick Question


icode

2015-02-24 22:57:25

Here is the code snippet I have for my miner I am working on. This is the function that finds the iron ore rocks and clicks on them. The only problem I am having is that it will find all the rocks on the screen, but then quickly click all of them. I just want it to find one and click on one, but I can't seem to fix this problem. Any help would be appreciated.

function FindRocks(x, y: Integer): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
PBox: TBox;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.17, 0.75);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 1450296, MSx1, MSy1, MSx2, MSy2, 9);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.25, 0.82);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 2898528, MSx1, MSy1, MSx2, MSy2, 2);
ColorToleranceSpeed(CTS);
end;
SMART_DrawDots(MyTPA);
MyATPA := tpatoatpaex(mytpa, 40, 40);
TPAL := High(MyATPA);
for i := TPAL downto 0 do
begin
MMTPA := MiddleTPA(MyATPA[i]);
MMouse(MMTPA.x, MMTPA.y, 3, 3);
if (waitUpTextMulti(['ine', 'roc'], 600)) then
begin
Result := True;
ClickMouse2(Mouse_Left);
end
else
begin
Writeln('option mine rock not found') Attempts := + 1;
if Attempts >= 30 then
begin
WriteLn('can not find Iron in MainScreen, logging out');
Logout;
TerminateScript;
end;
end;
end;
end;

KeepBotting

2015-02-24 23:05:22

After you click the rock, break; out of the loop (or exit; the function, whichever you prefer).

icode

2015-02-24 23:17:16

From: KeepBotting
After you click the rock, break; out of the loop (or exit; the function, whichever you prefer).


I think that fixed it :) thanks again man you always help me out haha guess I'll test it out tonight and release it soon if it's ready

KeepBotting

2015-02-24 23:19:38

From: icode
so like?


begin
Result := True;
ClickMouse2(Mouse_Left);
break;
end


Yeah, that'll break out of your for loop

icode

2015-02-24 23:26:36

From: KeepBotting
Yeah, that'll break out of your for loop


can't believe it was that simple lol *facepalm