SRL Archive - First Scripts

Catherby Fisher (Broken) 07


Netzone

2013-03-06 10:33:20

program NetCatherbyFisher;
{$I SRL/SRL.Simba}
{$I P07Include.Simba}

var x, y, CatFish3, CatFish2, CatCook, CatFish1, CatBank, i, CatTwoTrees, CatFishShop: Integer; PBox: TBox; SsFound: Extended;

Procedure P07_DeclarePlayer;
Begin
P07_PlayerName:='';
P07_PlayerPass:='';
end;

procedure DTMs;
begin
CatFish3 := DTMFromString('mbQAAAHicY2VgYJjIxMCwAogXA3ELEPcDsSdQ3BuIE4HYFYijgfjctmKGDEdphosbSsHs6r7tDJJAcXTMiAWDAQCEOA1+');
CatCook := DTMFromString('mbQAAAHicY2VgYHBnYmBwA2JnILYBYn8QGygeBMRWQOwAxI5AXJiZxVDdt52hq0mBIc/fCMyXBIqjY0YsGAwAawEJoA==');
CatBank := DTMFromString('mbQAAAHicY2VgYEhjYmBIAOIkIM4C4lAgFmOAYFkgloLSsydMAuPW6lowXZyVwyAJFEfHjFgwGAAAuxMK9g==');
CatTwoTrees := DTMFromString('mbQAAAHicY2VgYAhlYmBwB2IvII4E4gQgDgSKhwBxChCHA7E1EF/cUMpQ3bed4czOGIZz64sZzm0rZpAEiqNjRiwYDABF0Q1K');
CatFishShop := DTMFromString('mrAAAAHic42BgYPBhYmAIB+IAKJ0AxC5QHALEvkA1fkAcDcQpQJwIxA5A7A3E7kC8Y3kIg6WdE0NwRCQcF2ZmMaxZZMuwb5UzgyRQDT7MSADDAABomg/u');

end;

procedure DTMFree;
begin
FreeDTM(CatBank);
FreeDTM(CatFish3);
FreeDTM(CatTwoTrees);
FreeDTM(CatFishShop);
FreeDTM(CatCook);
end;

procedure StartCheck; // This will move the camera to the best place.
begin
Wait(RandomRange(1000,2000));
P07_MakeCameraAngleHigh();
P07_MakeCompassNorth;
P07_HoverSkill('Fishing', random(5000));
Wait(RandomRange(200,1000));
end;

procedure StartFish; //Checks for Fishing Spot and starts fishing
begin
if not P07_LoggedIn then Exit;
PBox := IntToBox(238, 149, 286, 186);
if not P07_InvFull then
if AveragePixelShift (PBox, 250, 350) < 30 then
Wait(RandomRange(250,1200));
if AveragePixelShift (PBox, 250, 350) < 30 then
If (P07_FindObjCustom(x, y, ['Ca', 'ge'], [15518125, 15452076, 15053708, 14398100, 14659209], 45)) then //Finds the Fishing spot
begin
MMouse(RandomRange(X - 5, X + 6), RandomRange(y - 5, y + 6), 0, 0); //Moves the mouse there
Wait(RandomRange(450,850));
If P07_IsUpTextMultiCustom(['Ca', 'ge']) then
ClickMouse2(Mouse_Left);
end
else
begin
repeat
wait(RandomRange(150,300));
until AveragePixelShift (PBox, 250, 350) < 30;
end else
writeln('Could not find any Fishing Spot');
P07_MakeCompassDegree(RandomRange(0, 360)); //Rotate camera in case script doesn't find any Fishing Spots. Will add walking here later
P07_MakeCameraAngleHigh();
end;

procedure WCatTwoTrees;
var wx, wy, i, numberOfWaits: Integer;
begin
if WaitFunc(@(WCatTwoTrees), 100 + Random(150), 5000) then
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTMRotated(CatTwoTrees, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatTwoTrees Found.');
Result := True;
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left);

end else
begin
writeln('Failsafe needed.')
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTMRotated(CatFish3, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatFish3 failsafe Found.');
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left);
end;
end;
end;
procedure WCatFishShop;
var wx, wy: Integer;
begin
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTMRotated(CatFishShop, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatFishShop Found.');
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left)
end;
end;

procedure WCatCook;
var wx, wy: Integer;
begin
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTMRotated(CatCook, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatCook Found.');
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left)
end;
end;

procedure WCatBank;
var wx, wy: Integer;
begin
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTMRotated(CatBank, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatBank Found.');
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left)
writeln('Arrived at Bank! Banking...');
end;
end;

procedure GoToBank;
begin
Wait(RandomRange(1200,2200));
WCatTwoTrees;
begin
Wait(RandomRange(3000,3200));
WCatFishShop;
end;
begin
Wait(RandomRange(3000,3200));
WCatCook;
end;
begin
Wait(RandomRange(3000,3200));
WCatBank;
end;
begin
Wait(RandomRange(3000,3200));
end;
end;


Function EasyAntiBan: Boolean; //AntiBan
begin
case random(60) of
0: P07_HoverSkill('Fishing', random(4500));
1: P07_MakeCameraAngleHigh;
2: P07_MakeCompassDegree(RandomRange(0, 180));
3: MMouse(random(100), random(420), 0, 0);
4: P07_MakeCameraAngleLow;
5: MMouse(random(600), random(120), 0, 0);
end;
end;

//Start of Main
begin
SetupSRL();
SetupP07Include;
P07_DeclarePlayer;
MouseSpeed := 15;

If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
end;
Wait(RandomRange(500,1000));
StartCheck;
DTMs; //Load DTM's
//Start of fishing
repeat wait(RandomRange(1000,2000));
EasyAntiBan;
StartFish;
if (P07_InvFull) then
begin
writeln('Inventory is full, banking.');
GoToBank;
end;
until (not P07_LoggedIn)
DTMFree; //Frees them
end.

Basically this is the first programming I've ever done except editing lines. I tried to get DTM working, and while it does walk to the bank, I couldn't manage to get some failsafes in there and that's pretty much where I got stuck. I was going to use the dtm's for finding new fishing spots aswell doing something like a

  case random(3) of
0: CatFish1;
1: CatFish2;
2: CatFish3;
end;
if it didn't find any, which would be dtm walking functions to the different catherby fishing spots.
I did borrow a couple of things, mainly the pixelbox to check if fishing. Can't remember from who, sorry I can't give proper credit to the person.

Decided to wait for the official release and remake my script because of better documentation and support probably. Posting here for general feedback.