SRL Archive - General Botting Help

GetColorToleranceSpeed help


Thief

2014-01-23 04:56:31

I've just started work on a script, and I'm trying to get it to find an NPC using the Find object function.

I'm using ACA, and I pasted the find object code from there - but I get the following error when I try to compile:

Exception in Script: Unknown declaration "GetColorToleranceSpeed" at line 20, column 13



Any ideas why?



program FindObject;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}

var
x, y: Integer;


function FindObject(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(2.47, 0.07);

if not(FindColorsTolerance(arP, 3307800, MSX1, MSY1, MSX2, MSY2, 14)) 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.49) and (X <= 12.51) and (Y >= 0.85) and (Y <= 6.40) and (Z >= 1.31) and (Z <= 43.76) 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 (IsUpText('night')) then
begin;
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;
FindObject(x, y);
end.

riwu

2014-01-23 05:52:17

The function has been renamed to GetToleranceSpeed() in newer versions of simba.

Thief

2014-01-23 06:02:08

Ah that makes sense, thanks for the fast reply.

If I change line 20 to GetToleranceSpeed(), it comes up with: "Exception in Script: Unknown declaration "ColorToleranceSpeed" at line 19, column 3"

Is ColorToleranceSpeed also different in the newer versions of simba, or do I need something in the parentheses of GetToleranceSpeed()?

riwu

2014-01-23 06:36:33

Yeah it's now SetColorToleranceSpeed()

Thief

2014-01-23 06:53:18

Great thanks!

do you know what SetColorSpeed2Modifiers has changed to?

These small things are killing me lol

The Mayor

2014-01-23 06:54:35

No need to go to all this trouble. There are some overloads in SRL6 that reset the CTS automatically after finding a color.

For example, take the findColorsSpiralTolerance overload in the following function. The colorSetting(2, 0.17, 2.72) is the CTS, hue and sat modifiers from ACA.


function findColor: boolean;
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
if not isLoggedIn then
exit;

if findColorsSpiralTolerance(x, y, TPA, 7916778, mainScreen.getBounds(), 10, colorSetting(2, 0.17, 2.72)) then

if (Length(TPA) < 1) then
exit;

ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['mayor', 'cool'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clear;
exit(true);
end;
end;
end;

Thief

2014-01-23 06:57:58

Oh awesome, thanks! I'll give that a try. Love the self references in that code lol.