I have edited the script so it eats tuna. The tuna part of the script was leeched from a different script edit. Credits to: cause
Hope both you guys don't mind me for using the code, and also pasting it here.
ALSO, I have not really tested this because I haven't been able to get low enough HP. Please use with caution. It's not certain the feature will work.
program MegaGoblinKiller;
{$DEFINE SMART}
{$i srl/srl/misc/smart.simba}
{$loadlib sps}
{$i srl/srl.simba}
{$i sps/sps.simba}
const
SRLStats_User = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
SERVER = 0; // Enter "0" to pick a random server.
MEMBERS = True;
NumbOfPlayers = 1;
StartPlayer = 0;
Tolerance = 2;
var
B: Array [0..5] of Integer;
x, y, Food: Integer;
aFound: Extended;
Drops:TStringArray;
Bones, TotalEXP, GoblinKilled: Integer;
procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['XP'];
With Players[0] do
begin
Name := ''; //Username.
Pass := ''; //Password.
Active := True;
end;
end;
procedure FailSafe (Reason:String);
begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
TerminateScript;
end;
function InFight: Boolean;
begin
Result := srl_InFight;
end;
Function OthersInFight: Boolean;
var
x, y, i: integer;
Colors: TIntegerArray;
begin
Colors := [HP_BAR_COLOR1, HP_BAR_COLOR2];
for i := 0 to High(Colors) do
if FindColorTolerance(x, y, Colors[i], MSX1, MSY1, MFBox.X1, MSY2, 0) or
FindColorTolerance(x, y, Colors[i], MSX1, MSY1, MSX2, MFBox.Y1, 0) or
FindColorTolerance(x, y, Colors[i], MFBox.X2, MSY1, MSX2, MSY2, 0) or
FindColorTolerance(x, y, Colors[i], MSX1, MFBox.Y2, MSX2, MSY2, 0) then
begin
Result := True;
Exit;
end;
end;
function IsFightAt(var X, Y: Integer): Boolean;
var
B: TBox;
H, I: integer;
ATPA: T2DPointArray;
Colors: TIntegerArray;
begin
Colors := [HP_BAR_COLOR1, HP_BAR_COLOR2];
H := High(Colors);
SetArrayLength(ATPA, H+1);
B := IntToBox(x-20, y-40, x+20, y+10);
for i := 0 to H do
with B do
FindColorsSpiralTolerance(x, y, ATPA[i], Colors[i], Max(X1, MSX1), Max(Y1, MSY1), X2, Y2, 0);
Result := Length(MergeATPA(ATPA)) > 0;
end;
function FindGoblin(Var X,Y: Integer): Boolean;
var
CTS: Integer;
TPA: TPointArray;
begin
Result := False;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.1415519568151143, 0.7379752182483808);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3046770, MSX1, MSY1, MSX2, MSY2, 7);
ColorToleranceSpeed(CTS);
if (Length(TPA) < 1) then
Exit;
MMouse(TPA[0].X, TPA[0].Y, 5, 5);
if WaitUpText('ttack Goblin', 250) then
begin
GetMousePos(X, Y);
Wait(10);
end;
end;
Procedure ToBank;
begin
B[0] := DTMFromString('mrAAAAHic42BgYChhYmAIAuJVQLwSiu2h2AmI7YBqUoA4EYiDgdgTiKOBOByI/YB4em8qQ7ghG4NBkgiDQoQAg5U1Kxw7JEkxiADV4MOMBDAMAACI9AxR');
B[1] := DTMFromString('mlwAAAHicY2dgYDBkYmBwAmJHKHYAYj8gjgfiQKC8CxCHAXE8EOcDsTMQOwHxzJ5UBqdEKQYbK1Y4NkoUYVAKF2AQAcrjwox4MBQAAKFHCbE=');
B[2] := DTMFromString('mlwAAAHicY2dgYIhiYmDwAOJ6NOwOxJVA+Xwg9gXiHCCuBeIJQGwJxFt70hi+/+ZmMEoUYbCxYgVjENu70IRBBCiPCzPiwVAAABJQDU0=');
MakeCompass ('n')
if FindDTMRotated(B[0], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(6);
FreeDTM(B[0]);
repeat
Wait(50 + Random(25));
until FindDTMRotated(B[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound);
end;
if FindDTMRotated(B[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(6);
FreeDTM(B[1]);
repeat
Wait(50 + Random(25));
until FindDTMRotated(B[2], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound);
end;
if FindDTMRotated(B[2], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(6);
FreeDTM(B[2]);
End;
End;
Procedure FromBank;
begin
B[4] := DTMFromString('mwQAAAHic42RgYOhnYmCYg4RnA3E4EJcAcQUQpwKxCVCdGxBHA3EGEGsCsS4QqwFxCRALAPHU7jQGS0s2BvkwQTjd15IIFvcoMGWY3pHOIAJURwgzEoHhAAAP1hCq');
B[5] := DTMFromString('mlwAAAHicY2dgYJjAxMBQD8QNUAxirwDiHiCOAMpXAXEeEIcDsTUQWwCxJRBv6kpjMNLkYtBPEGWQDxME0zAsApTHhRnxYCgAALMIC8s=');
MakeCompass ('n')
if FindDTMRotated(B[4], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(6);
FreeDTM(B[4]);
repeat
Wait(50 + Random(25));
until FindDTMRotated(B[5], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound);
end;
if FindDTMRotated(B[5], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(6);
FreeDTM(B[5]);
end;
end;
Procedure Bankit;
Begin
B[3] := DTMFromString('mlwAAAHicY2dgYOBgZGD4DqTFgPQfIC0IpP9B6RIgHQXEkUBcCcW5QFwIxEnBTgz21uYMtpYmDBVpgQxx/vYMt3ZOZqjJDGYQAcrjwox4MBQAAF81DpI=');
MakeCompass ('w')
repeat
Wait(50 + Random(25));
until FindDTMRotated(B[3], x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound);
If FindDTMRotated(B[3], x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
Wait(1500)
if not (bankscreen) then
repeat
Wait(50 + Random(25));
until FindDTMRotated(B[3], x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound);
If FindDTMRotated(B[3], x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
Wait(1500)
Withdraw(0, 0, 28);
CloseBank;
FreeDTM(B[3])
end;
end;
end;
Procedure LowHPLetsEat;
var
I, x, y: Integer;
test: boolean;
begin
test := (HPPercent < 70) and (LoggedIn);
If(not(test)) then
Exit;
if test then
If InvEmpty then
begin
ToBank;
Bankit;
FromBank;
end else
begin
if FindDTM( Food, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x ,y, 5, 5, true);
Wait(100);
WriteLn('Having a bite of tuna');
end else
begin
WriteLn('couldn''t find any tuna');
end;
end else
WriteLn('health isn''t low enough to eat');
end;
procedure Report;
begin
GoblinKilled := (GoblinKilled + 1);
TotalEXP := (GoblinKilled*27);
Writeln('############ MegaGoblinKiller ###########');
Writeln('|= Player : ' + Players[CurrentPlayer].Name);
Writeln('|= Time Running : ' + TimeRunning);
Writeln('|= Goblins Killed : ' + IntToStr(GoblinKilled));
Writeln('|= EXP Gained : ' + IntToStr(TotalEXP));
Writeln('#########################################');
end;
procedure FailSafe2 (Reason:String); // Credit to Laakerules
var
Z:TPoint;
begin
Z:= SPS_GetMyPos;
if (Not (Distance(Z.X, Z.Y, 4830, 3700) < 25)) then//Change the 25 to whatever you want your distance checking to be.
Begin
BoredHuman;
SPS_WalkToPos(Point(4830, 3700));
end;
end;
procedure Gobbling;
var
Xi, Yi, x: Integer;
begin
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('N');
if InFight then
begin
repeat
FindNormalRandoms;
until (not (OthersInFight) or (not LoggedIn) or (not InFight))
end;
x := Random(8)
if FindObjEx(Xi, Yi, ['ttack'], [4430477, 4033671, 1858905, 3253129], Tolerance, 50, 1, 5, 690, 400) then
begin
if not (IsFightAt(Xi, Yi) and not InFight) then
begin
GetMousePos(Xi, Yi);
Mouse(Xi, Yi, 5, 5, True);
end;
while IsMoving do
begin
Wait(250);
end;
end
else
begin
wait(800)
end;
end;
procedure AntiBan;
begin
if(not(LoggedIn))then
exit;
FindNormalRandoms;
case Random(2) of
0:
begin
WriteLn('AntiBan, Move Camera');
MakeCompass('N');
wait(150+random(100));
MakeCompass('E');
wait(50+random(100));
MakeCompass('S');
end;
1:
begin
WriteLn('Skill1');
HoverSkill('Attack', False);
Wait(1000 + Random(200));
end;
2:
begin
WriteLn('Bored.');
BoredHuman;
end;
end;
end;
procedure DropVars;
begin
Drops :=['ones']
end;
Procedure Bury;
var
i : Integer;
begin
if (InvFull) then
begin
for i := 1 to 28 do
begin
InvMouse(I, 3);
if IsUpText('Bury') then
begin
ClickMouse2(True);
Wait(RandomRange(200, 300));
end;
end;
end;
end;
function FindBones(Var X,Y: Integer): Boolean;
var
CTS: Integer;
TPA: TPointArray;
begin
Result := False;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0, 0.1255325704692993);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 9539993, MSX1, MSY1, MSX2, MSY2, 7);
ColorToleranceSpeed(CTS);
if (Length(TPA) < 1) then
Exit;
MMouse(TPA[0].X, TPA[0].Y, 5, 5);
if WaitUpText('Take', 250) then
begin
GetMousePos(X, Y);
Mouse(x, y, 0, 0, False);
ChooseOptionMulti(Drops);
Result := True;
Inc(Bones);
Exit;
end;
end;
function PickupBones:Boolean;
var
x, y: Integer;
begin
FindNormalRandoms;
If FindBones(x, y) Then
begin
While IsMoving do
Wait(25);
FindNormalRandoms;
Wait(RandomRange(300,400));
Mouse(x, y, 0, 0, False);
ChooseOption('Take Bones');
Result := True;
end;
end;
begin
Smart_Signed := TRUE;
Smart_Members := MEMBERS;
Smart_SuperDetail := FALSE;
Smart_Server := 30;
ActivateClient;
SetupSRL;
DeclarePlayers;
if not (LoggedIn) then
LoginPlayer;
Wait(4000+random(400));
repeat
Gobbling;
Report;
if not InFight then
begin
PickupBones;
Bury;
end;
until(False)
end.