SRL Archive - First Scripts

SmallNetPowerFisher


ineedbot

2012-05-25 02:23:59

Hello, today I have decided to learn SRL and I managed to create a functional script that works pretty damn good for a first script in this language. Its just a simple Small Net power Fisher that uses pixel shift for animation, DTM for dropping and Auto Color Aid to find fishing spots.

Thanks to:
Flight's Tut for animation: http://villavu.com/forum/showthread.php?t=74090&highlight=animation
YoHoJo for his awesome tutorials on Youtube and here.
Nielsie95 and Sumilion for Auto Color Aid: http://villavu.com/forum/showthread.php?t=26944
Griff for his tutorial: http://villavu.com/forum/showthread.php?t=44942

Some possible bugs can be lag as my dropping method for items is just a fixed wait command in a for statment, and pixel shift maybe interfered by other people around you and lag.

Keep in mind this is my first Simba/SCAR/SRL (whatever you want to call it) script, I am open to suggestions and tips. Please don't flame.

program SmallNetPowerFisher;

{$DEFINE SMART}
{$i SRL/srl.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].BoxRewards := ['ostume'];
end;

function FishColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.30, 0.68);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 10524560, MSX1, MSY1, MSX2, MSY2, 5);
if (Length(arP) = 0) then
begin
//Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;

procedure DropFish;
var
x, y, ShrimpDTM, count : Integer;
begin
Status('Dropping Fish.');
ShrimpDTM := DTMFromString('mAAEAAHic42FgYOADYmkgFgRiLiBmZkAAJiDmBWJRIJYBYjEg5gZiFqg8iGaE0lxQM8SBWAjKBwFv73CoScTh/wykAUYSMTIAAOfqAx4=');
for count := 0 to 27 do
begin
Status('Dropping Fish: ' + IntToStr(count));
if FindDTM(ShrimpDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
Mouse(x, y, 5, 5, false);
ChooseOption('rop');
wait(750);
end;
FreeDTM(ShrimpDTM);
Status('Done Dropping Fish.');
end;

Function isFishing: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 100);
end;

procedure ClickFishSpot;
var
x, y, time : Integer;
begin
Status('Finding Fish Spot.');
x := MSCX;
y := MSCY;
if FindObj(x, y, 'et', FishColor, 5) then
begin
Mouse(x, y, 5, 5, true);
end;
Status('Running to Spot.');
Flag;
MarkTime(time);
repeat
Status('At Spot, waiting for fishing animation to start.');
until (isFishing) or (time = 5000)
end;

procedure AntiBan;
begin
FindNormalRandoms;
FTab(25);
case random(50) of
0:
begin
HoverSkill('Fishing', false);
wait(2453+Random(432));
end;
1:PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+Random(133));
MakeCompass('s');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;

begin
Smart_Server := 4;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;

ClearDebug;
SetupSRL;
DeclarePlayers;
LoginPlayer;
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
SetUpSRL;
repeat
if isFishing then
begin
Status('Fishing...');
AntiBan;
end else
begin
if (invfull) then
begin
DropFish;
end else begin
ClickFishSpot;
end;
end;
wait (10);
until(AllPlayersInactive);
end.

It uses the Status function, so look in your status box to see what the script is doing. :3