Simba Code:
program FindObject;
{$define SMART}
{$i srl/srl.scar}
{$i srl/srl/skill/fighting.scar}
{$i sps/sps.simba}
{$i SRL/SRL/misc/paintsmart.scar}
Function FindObjectFX(Colors: TIntegerArray; Uptext: TStringArray; X1, Y1, X2, Y2, Width, Height, tol: integer): Boolean;
var
X, Y, I: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
SetLength(TPA, Length(Colors));
For I:= 0 To High(Colors) do
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[i], X1, Y1, X2, Y2, tol); //Find colours starting from the middle outwards..
ATPA:= TPAToATPAEx(TPA, Width, Height); //Group TPA into cirles by Distance..
SortATPAFrom(ATPA, Point(MSCX, MSCY)); //Sort the colours from the closest to the center..
if(Length(ATPA) = 0) then
Exit;
MiddleTPAEx(ATPA[0], X, Y); //In that 2D Array, Pick out the closest to the middle a.k.a. the first one..
MMouse(x, y, 5, 5); //Move the mouse to the colours found..
Wait(randomrange(200, 500)); //Wait for the uptext to show..
If(IsUpTextMultiCustom(UpText)) then
begin
ClickMouse2(False); //If it finds it, click the object/item..
wait(500);
if ChooseOptionMulti(UpText) then
begin
Result := True; //If it clicks the object, return true..
Exit;
end;
end else
Result := False; //Cannot find the uptext then its the wrong object, return false..
end;
Function FindObjAdv(Colors: TIntegerArray; Uptext: TStringArray; X1, Y1, X2, Y2, Width, Height, tol: integer): Boolean;
var
X, Y, I: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
SetLength(TPA, Length(Colors));
For I:= 0 To High(Colors) do
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[i], X1, Y1, X2, Y2, tol); //Find colours starting from the middle outwards..
ATPA:= TPAToATPAEx(TPA, Width, Height); //Group TPA into cirles by Distance..
SortATPAFrom(ATPA, Point(MSCX, MSCY)); //Sort the colours from the closest to the center..
if(Length(ATPA) = 0) then
Exit;
MiddleTPAEx(ATPA[0], X, Y); //In that 2D Array, Pick out the closest to the middle a.k.a. the first one..
MMouse(x, y, 5, 5); //Move the mouse to the colours found..
Wait(randomrange(200, 500)); //Wait for the uptext to show..
If(IsUpTextMultiCustom(UpText)) then
begin
Result := True; //If it clicks the object, return true..
Exit;
end else
Result := False; //Cannot find the uptext then its the wrong object, return false..
end;
Procedure ClickButterflies;
var
TmpCTS: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(2.21, 1.60);
FindObjectFX([2705528], ['atch', 'Ruby', 'harvest'], MSX1, MSY1, MSX2, MSY2, 2, 2, 2);
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
Function FindButterflies: Boolean;
var
TmpCTS: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(2.21, 1.60);
FindObjAdv([2705528], ['atch', 'Ruby', 'harvest'], MSX1, MSY1, MSX2, MSY2, 2, 2, 2);
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
var
Tries: Integer;
MS: TBox;
begin
Smart_Server := 45;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
SPS_Areas := ['2_6','3_6','3_5'];
SPS_Setup(RUNESCAPE_SURFACE, SPS_AREAS);
Repeat
ClickButterflies;
while IsMoving do
wait(500);
Until(False);
end.