Simba Code:
function MMMS(MM: TPoint): TPoint;//credit Home
Var
X, Y :Extended;
begin
X := (((MM.X - 626.5) * 9.81119354838709677419354838709677) + 258.531);
Y := (((MM.Y - 84.5) * 8.84193548387096774193548387096777) + 175.341);
Result := Point(Round(X), Round(Y));
end;
function GetSBox(P: TPoint): TBox;
begin
if not LoggedIn then Exit;
Result := PointToBox(MMMS(Point(P.x - 2, P.y - 3)),
MMMS(Point(P.x + 3, P.y + 2)));
end;
procedure RemoveColorTPA(SB: TBox; var TPA: TPointArray; Col, Tol: Integer;
H, S: Extended);
var
RTPA: TPointArray;
HM, SM: Extended;
CTS: Integer;
begin
GetColorspeed2Modifiers(HM, SM);
CTS := GetColorToleranceSpeed;
SetColorspeed2Modifiers(H, S);
ColorToleranceSpeed(2);
if FindColorsTolerance(RTPA, Col, SB.X1, SB.Y1, SB.X2, SB.Y2, Tol) then
TPA := ClearTPAFromTPA(TPA, RTPA);
SetColorspeed2Modifiers(HM, SM);
ColorToleranceSpeed(CTS);
end;
procedure RemoveBadColors(SB: TBox; var TPA: TPointArray);
var
CT1, CT2, CT3, CT4, CT5, CT6, CT7, CT8: array[0..1] of Integer;
HS1, HS2, HS3, HS4, HS5, HS6, HS7, HS8: array[0..1] of Extended;
begin
CT1[0] := 3427197; CT1[1] := 18;//body
HS1[0] := 0.25; HS1[1] := 0.75;//body
CT2[0] := 2637130; CT2[1] := 8;//legs
HS2[0] := 0.27; HS2[1] := 1.37;//legs
CT3[0] := 2313556; CT3[1] := 13;//feet
HS3[0] := 0.19; HS3[1] := 1.08;//feet
CT4[0] := 3233380; CT4[1] := 14;//wall
HS4[0] := 0.04; HS4[1] := 0.50;//wall
CT5[0] := 3377517; CT5[1] := 13;//greenwall
HS5[0] := 0.03; HS5[1] := 0.68;//greenwall
CT6[0] := 2503482; CT6[1] := 15;//switch
HS6[0] := 0.21; HS6[1] := 0.20;//switch
CT7[0] := 855310; CT7[1] := 1;//switchblack
HS7[0] := 16.67; HS7[1] := 3.71;//switchblack
CT8[0] := 725785; CT8[1] := 2;//tile
HS8[0] := 0.36; HS8[1] := 1.53;//tile
RemoveColorTPA(SB, TPA, CT1[0], CT1[1], HS1[0], HS1[1]);
RemoveColorTPA(SB, TPA, CT2[0], CT2[1], HS2[0], HS2[1]);
RemoveColorTPA(SB, TPA, CT3[0], CT3[1], HS3[0], HS3[1]);
RemoveColorTPA(SB, TPA, CT4[0], CT4[1], HS4[0], HS4[1]);
RemoveColorTPA(SB, TPA, CT5[0], CT5[1], HS5[0], HS5[1]);
RemoveColorTPA(SB, TPA, CT6[0], CT6[1], HS6[0], HS6[1]);
RemoveColorTPA(SB, TPA, CT7[0], CT7[1], HS7[0], HS7[1]);
RemoveColorTPA(SB, TPA, CT8[0], CT8[1], HS8[0], HS8[1]);
end;
function FindDrop(var P: TPoint; var UT: String): Boolean;
var
SB: TBox;
PP: TPoint;
FTPA, TTPA: TPointArray;
ATPA: T2DPointArray;
HM, SM: Extended;
i, Hi, CTS: Integer;
begin
Result := False;
if not LoggedIn then Exit;
if not rs_OnMinimap(P.x, P.y) then Exit;
SB := GetSBox(P);
PP := MMMS(P);
P := Point(-1, -1);
GetColorspeed2Modifiers(HM, SM);
CTS := GetColorToleranceSpeed;
//get floor in area
SetColorspeed2Modifiers(0.05, 0.36);
ColorToleranceSpeed(2);
if not FindColorsTolerance(FTPA, 5468278, SB.X1, SB.Y1, SB.X2, SB.Y2, 14) then
begin
SetColorspeed2Modifiers(HM, SM);
ColorToleranceSpeed(CTS);
Exit;
end;
//get floor bounds and tpa
SB := GetTPABounds(FTPA);
if Debug then SMART_DrawBoxEx(True, SB, clPurple);
TTPA := TPAFromBox(SB);
//remove roach/floor colors from tpa
TTPA := ClearTPAFromTPA(TTPA, FTPA);
TTPA := ClearTPAFromTPA(TTPA, TPAFromBox(IntToBox(243, 143, 275, 182)));
if m_HPBar then
TTPA := ClearTPAFromTPA(TTPA, TPAFromBox(IntToBox(227, 121, 293, 149)));
RemoveBadColors(SB, TTPA);
SetColorspeed2Modifiers(HM, SM);
ColorToleranceSpeed(CTS);
//split tpa by 1
ATPA := SplitTPA(TTPA, 1);
Hi := High(ATPA);
if Hi < 0 then Exit;
//sort arrays
SortATPASize(ATPA, True);
for i := 0 to Hi do
begin
if Debug then
begin
SMART_DrawDotsEx(False, ATPA[i], clYellow);
end;
{if (PixelShift(GetTPABounds(ATPA[i]), 120) > 20) then
begin
m_Debug('Removing Item: PixelShift', False);
Continue;
end;}
if not InRange(Length(ATPA[i]), 10, 430) then
begin
m_Debug('Removing Item: Length', False);
Continue;
end;
P := RPDist(ATPA[i], 3);
MMouse(P.x, P.y, 0, 0);
Wait(150);
if WaitText(UT, ['alk here'], 150) then
begin
P := Point(-1, -1);
m_Debug('Removing Item: Uptext', False);
Continue;
end;
if Debug then
begin
SMART_DrawDotsEx(False, ATPA[i], clGreen);
SMART_DrawBoxEx(False, GetTPABounds(ATPA[i]), clBlue);
end;
Break;
end;
Result := PointInBox(P, MSBox);
end;