Is there anyway to use a bitmap to detect Uptext?
Here's my bitmap, uploaded as a PNG.
MineUpText.png
If not is there a way to specify 07 text for the chars?..
Here's my code:
Simba Code:
program FindObject;
{$i SRL\SRL.simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$I P07Include.Simba}
var
x, y: Integer;
function FindIron(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.14, 0.31);
if not(FindColorsTolerance(arP, 2174026, MSX1, MSY1, MSX2, MSY2, 7)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 1.91) and (X <= 6.90) and (Y >= 1.65) and (Y <= 5.76) and (Z >= 1.01) and (Z <= 3.05) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if P07_IsUpTextMultiCustom(['Mine', 'ine', 'ne']) then
begin;
ClickMouse2 (mouse_left);
Result := True;
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;
GetMousePos(fx, fy);
end;
begin
SetupSRL;
FindIron(x, y);
end.