Sir R. M8gic1an
2009-01-26 06:42:25
{*******************************************************************************
function FindWhirPoolXY(x, y:integer): Boolean;
by: Rasta Magician
Description: Returns true if whirpool found at (x,y)
*******************************************************************************}
function FindWhirlPoolXY(x, y:integer): Boolean;
var
arP: TPointArray;
ararP: T2DPointArray;
tmpCTS, i, arL: Integer;
P: TPoint;
begin
if not LoggedIn then exit;
Result := False;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.21, 1.58);
if not(FindColorsTolerance(arP, 13940675, x-25, y-25, x+25, y+25, 15)) then
begin
//Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPA(arP, 5);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) > Round(300*WhirlPoolAcc)) then
begin
Result := True;
writeln('Found Whirlpool! ');
writeln('Whirpool Points: '+IntToStr(Length(ararP[i])));
break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
each rs square is 40*40, thise searches in an area of 45*45 just in case the x,y given is not the exact center of the square.
WhirpoolAcc is a constant extended that already exists in Fishing.scar and is default set to 1.00
{*******************************************************************************
function FindWhirPoolMS: Boolean;
by: Wizzup, edited by Rasta Magician
Description: Returns true if whirpool found in MainScreen
*******************************************************************************}
function FindWhirlPoolMS: Boolean;
var
arP: TPointArray;
ararP: T2DPointArray;
tmpCTS, i, arL: Integer;
P: TPoint;
begin
if not LoggedIn then exit;
Result := False;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.21, 1.58);
if not(FindColorsTolerance(arP, 13940675, MSX1, MSY2, MSX2, MSY2, 15)) then
begin
//Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPA(arP, 5);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) > Round(300*WhirlPoolAcc)) then
begin
Result := True;
writeln('Found Whirlpool!');
writeln('Whirpool Points: '+IntToStr(Length(ararP[i])));
break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
returns true if found on the mainscreen at all
{*******************************************************************************
function FindWhirPoolEx: Boolean;
by: Rasta Magician
Description: Returns true if whirpool found in the 4 spots around your
player in which he might be fishing in
*******************************************************************************}
function FindWhirlPoolEx: Boolean;
begin
Result := True;
if not FindWhirlPoolXY(MSCX - 20, MSCY) then
if not FindWhirlPoolXY(MSCX + 20, MSCY) then
if not FindWhirlPoolXY(MSCX, MSCY - 20) then
if not FindWhirlPoolXY(MSCX, MSCY + 20) then
Result := False;
end;
return true if the whirpool is found on any of the 4 spots around the player that you might be fishing in.
hope you like it :)
~RM