Ok so here is my problem:
For my powerminer, more specifically my manscreen mining, after ore has been dropped it is the same color as the rock veins. Now, My script seems to mouse over this, not alot but its still annoying. To combat this I tried getting the mouse position everytime that the script doesnt find the correct uptext. This fixes the multiple mousing over, but it still has to mouse over the area to get the point to now mouse over anymore. So my Question is, How would I combat this, My idea would be checking pixel lengths (rock veins are smaller than the ore on the ground) but I dont really know where to start.
Code:
SCAR Code:
Function AllocateRockPoints(index: Integer): TpointArray;
var tpa: TpointArray; atpa: T2DPointArray; l, i, c, cts, col: Integer;
begin
c := currentPlayer;
i := random(Length(rock[c][index].col));
col := rock[c][index].col[i];
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(rock[c][index].hue, rock[c][index].sat);
FindColorsSpiralTolerance(MScx, MScy, tpa, col, MSx1, MSy1, MSx2, MSy2, rock[c][index].lum);
SortTpaFrom(tpa, Point(MScx, MScy));
Atpa := TpatoAtpaEx(Tpa, 10, 10);
for i := 0 to High(atpa) do
begin
if Length(atpa) > 5 then
begin
l := getarraylength(Result);
SetArrayLength(Result, l+1);
Result[l] := MiddleTpa(atpa[i]);
end;
end;
ColorToleranceSpeed(cts);
SetColorSpeed2Modifiers(0.2, 0.2);
if (l > 0) then WriteLn('Found: '+IntToStr(l)+' Point(s)');
end;
Function C_MSpoint(tpa: TpointArray; Index: Integer): Boolean;
var i, x, y: integer; Bool: Boolean;
begin
for i := 0 to High(tpa) do
begin
WriteLn('Current Point at: ('+IntToStr(Tpa[i].x)+', '+IntToStr(tpa[i].y)+');');
if InRange(Tpa[i].x, Rock[CurrentPlayer][index].x-10, Rock[CurrentPlayer][index].x+10) or
InRange(tpa[i].y, Rock[CurrentPlayer][index].y-10, Rock[CurrentPlayer][index].y+10) then Continue;
MMouse(tpa[i].x, tpa[i].y, 2, 2);
Wait(350+random(200));
If IsUpTextMultiCustom(['ine','ock']) then
begin
GetMousePos(x, y);
Wait(Random(500));
bool := random(4) <> 1;
Mouse(x, y, 0, 0, Bool);
Result := True;
Wait(200+random(150));
ChooseOption('ine');
Exit;
end else
begin
GetMousePos(Rock[CurrentPlayer][index].x, Rock[CurrentPlayer][index].y);
Continue;
end;
end;
end;
Function Loop(Index: Integer): Boolean;
var Tpa: TpointArray; i, a: Integer;
begin
case Index of
0: // Mining Loop
begin
i := Players[CurrentPlayer].Integers[0];
tpa := AllocateRockPoints(i);;
if Length(tpa) > 0 then
if C_MSpoint(tpa, i) then
a := getsystemtime;
if TextCheck <> 1 then
while TextCheck <> 1 do
begin
Wait(150);
if Getsystemtime-a > RandomRange(2750, 3500) then Break;
end;
while IsMining do
begin
FindNormalRandoms;
Result := True;
end;
end;
1: DropItems(DropArr);
end;
end;
more of the script can be supplied if requested. Any help is appreciated, thanks in advance.