SCAR Code:
program Fisher;
{.include SRL/SRL.scar}
var t : integer;
const
SpotColorMid = 10392974;
SpotColorLow = 11050390;
StartPlayer = 0;
NumOfPlayers = 1; // Number of users.
Procedure DeclarePlayers;
Begin
HowManyPlayers := NumOfPlayers;
NumberOfPlayers( HowManyPlayers );
CurrentPlayer := StartPlayer;
Players[0].Name :='myun';
Players[0].Pass :='mypw';
Players[0].Nick :='nick';
Players[0].Active:=True;
SetPlayerNameTPAs;
End;
procedure CheckLoggedIn;
begin
if not LoggedIn then
begin
Writeln('Not logged in.. terminating script.');
TerminateScript;
end;
end;
procedure WalkToDock;
begin
if t < 5 then
begin
wait(1000+random(1000));
if RadialWalk(11324 , 61, 78, 60, 0, 1)then
begin
Flag;
exit;
end else
t := t + 1;
wait(500+random(100));
MakeCompass('N');
wait(500+random(100));
WalkToDock;
end else
Writeln('Could not find dock.. terminating script.');
Logout;
wait(3000+random(1000));
TerminateScript;
end;
procedure WalkToBank;
begin
if t < 5 then
begin
wait(1000+random(1000));
if RadialWalk( 3821414, 264, 254, 50, 0, 1)then
begin
Flag;
exit;
end else
t := t + 1;
wait(500+random(100));
MakeCompass('N');
wait(500+random(100));
WalkToBank;
end else
Writeln('Could not find bank.. terminating script.');
Logout;
wait(3000+random(1000));
TerminateScript;
end;
procedure Bank;
begin
wait(250 + random(167));
if OpenBankQuiet('vwb') then
begin
Flag;
FixBank;
wait(445 + random(265));
Deposit(2,28,True);
wait(227 + random(258));
CloseBank;
wait(127 + random(258));
exit;
end else
Writeln('Could not open bank.. terminating script.');
Logout;
wait(3000+random(1000));
TerminateScript;
end;
Function FindFishingSpots: TPointArray;
Var
Fish: TPointArray;
Fishes: T2DPointArray;
I , cts: Integer;
begin
If Not LoggedIn Then Exit;
SetLength(Result, 0);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, Fish, SpotColorMid, MSX1, MSY1, MSX2, MSY2, 40)
Fishes := TPAtoATPA(Fish, 25)
SetLength(Fish, 0)
SetLength(Result, Length(Fishes));
For I := 0 to High(Fishes) Do
begin
If Length(Fishes[i]) < 5 Then
Continue;
Result[I] := MiddleTPA(Fishes[I]);
end;
SetLength(Fishes, 0);
ColorToleranceSpeed(cts);
end;
Function FindFishingSpot(Var x, y: Integer): Boolean;
Var
Fish: TPointArray;
I : Integer;
Begin
If Not LoggedIn Then Exit;
Result := False;
Fish := FindFishingSpots;
For I := 0 to length(Fish) - 1 Do
Begin
MMouse(Fish[I].X, Fish[I].Y, 0, 0);
Wait(150 + Random(50));
If IsUpText('age') Then
begin
Result := True;
x := Fish[I].X;
y := Fish[I].Y;
Exit;
end;
end;
end;
Function FollowSpot(Var x, y: Integer): Boolean;
Var
FishP, FishP1, FishP2: TPointArray;
P: TPoint;
z: Integer;
Begin
Result := False;
If Not LoggedIn Then
Exit;
z := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsTolerance(FishP1, SpotColorLow, x - 20, y - 20, x + 20, y + 20, 40);
FindColorsTolerance(FishP2, SpotColorMid, x - 20, y - 20, x + 20, y + 20, 40);
FishP := CombineTPA(FishP1, FishP2);
If Length(FishP) > 3 Then
Begin
Result := True;
P := MiddleTPA(FishP);
x := P.X;
y := P.Y;
End;
ColorToleranceSpeed(z);
End;
Function FindWhirlPool(x, y: integer): Boolean;
Var
FishPoints: TPointArray;
cts: Integer;
Begin
If Not LoggedIn Then Exit;
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsTolerance(FishPoints, 13947343, x - 20, y - 20, x + 20, y + 20, 40)
If Length(FishPoints) > Round(230 * 1) Then
Begin
WhirlPools := Whirlpools + 1;
WriteLn(FloatToStr(Length(FishPoints) / 1600.0)+ '% Change');
Result := True;
End;
ColorToleranceSpeed(cts);
End;
Procedure HandleFight;
Begin
MakeCompass('N');
WalkToBank;
Wait(4000);
WalkToDock;
MakeCompass('N');
End;
function Fish: Boolean;
Var
x, y, RotateNum: Integer;
begin
If Not LoggedIn Then Exit;
t := 0
FindNormalRandoms;
If FindFishingSpot(x, y) Then
Begin
RotateNum := 15000 + Random(20000);
If Not FindWhirlPool(x, y) Then
Begin
Mouse(x, y, 0, 0, True);
Result := True;
Wait(500+random(250));
Repeat
If FindWhirlpool(x, y) Then
Begin
Mouse(648, 84, 4, 4, True);
Wait(100);
WriteLn('Whirlpool found.');
Inc(Whirlpools);
Break;
End;
If Not FollowSpot(x, y) Then
Break;
Wait(200);
If InvFull Then
Break;
Wait(100);
If FindFight Then
HandleFight;
Wait(15);
Until False;
end;
end;
end;
begin
SetupSRL;
ActivateClient;
wait(500+random(500));
CheckLoggedIn;
WalkToDock;
Fish;
WalkToBank;
Bank;
end.