Simba Code:
program AdvanceBarbarianAgility;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}
{$I SRL/SRL/misc/paintsmart.simba}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Developer Log:
Original Author: Anyhow
Rewritten by: Failed4life
Johnnimms13
A hattip to [Nathan] for his skeleton of this script
--------------------------------------------------------------------------------
Version History:
0: Original by Anyhow
v1.0 - Initial Release
v1.01 - DTMs added, antiban fixed
v1.02 - Progress Report added! Thanks RyGuy for the help :)
v1.021 - Pie Support Added!
v1.022 - Bug fixes and SMART Paint added
v1.023 - New gap DMT, Pie Toggle Switch added
v1.03 - Customizable Hp checker, logs out if Hp is low
v1.031 - Bug Fixes
-------------------------------------------------------------------------------
Instructions:
Use the Setup and position your player in the agility course by the ropes.
If you wish to use Summer Pies to boost your Agility level, have them in your
inventory.
Note: This Script requires atleast 85 agility to run with boosts, 90 to run
Without boosts, and 93+ to run without mistakes.
---------------------------------------SETUP-----------------------------------}
const
//User Options
SERVER = 23; //Replace with desired server number
Username = ''; //Enter your Username
Password = ''; //Enter your Password
Nickname = ''; //Enter 3-4 digits of your Username
ar = 0; //AntiRandom switch (0 = off, 1 = on)
PieLevel = 90; //What level would u like to eat a summer pie at? (0 to disable)
PLogOut = True; //True logs out when summer pies are gone
HP = 20; //LogsOut if below this percentage of HP
{---------------------------------Do Not Touch---------------------------------}
mmdebug = 0; //mmBlack function debug switch (0 = off, 1 = on)
debugwfloor = 0; //Wfloor function debug switch (0 = off, 10~14 = on)
var
x,y:LongInt;
Rope, Log, Plate, Ledge, Launch, Pole, Gap, Roof, TimeBegan, Exp, ExpHr,
laps, StartingXP:Integer;
aFound:Extended;
myPos: TPoint;
reRunUpWall: Boolean;
Clock: TIntegerArray;
procedure AntiBan;
begin
if not(LoggedIn)then
Exit;
case Random(300)of
0: HoverSkill('Agility', false);
1: PickUpMouse;
2: RandomMovement;
3: RandomRClick;
end;
end;
{///////////////////RyGay's Style DTM setting by Johnnimms13///////////////////}
procedure SetDTMs;
begin
Rope := DTMFromString('mlwAAAHicY2dgYFjNyMAwF4h3MELYa4B4HxBPA+ImIK6D4i6oGIhdD8RaqrwMlYWxYGygzc+gq8EH5/MDzcWFGfFgKAAA+1wPEQ==');
Log := DTMFromString('m6wAAAHic42ZgYMhgZGBIZ4TQAUAcBMTNQFwBxIFQ2hGKZwLxciCeAMTrgLgdiFcDcQcQzwbiGUC8Foi7gbi/qZohNFSKwd9PgiEq0IYhyV+bIT1IlyE91oXB1VANTKcXdTHU96xk4Ae6g1jMRAJGAgB2cRcQ');
Plate := DTMFromString('mkwEAAHicE2ZgYKhhZGAoBuIiIC4E4gJGiFg7EHdAcRuUDxKPB+J6IF4OxIlAXAfE04F4IxBrAbEVEOsAsQwQCwCxMJSWBmJVINaDqjEEYk8g9oZiFiD+BXQPO5AWAuKqJBeGzjxfhuIYB4byeCeG2TXhDPPrIxlmVocxlMY6MlQkOINxd74fWK2/owQYh7pJMQTbSzL4WIkzxIXagzE/0FxqYSYqYiwAAPEbInA=');
Ledge := DTMFromString('mKgEAAHic42NgYPBnZGB4CKQFgbQbEMcBcQ0QLwTidUC8CohXAvFMIM4BYjsg/g1U/xqIbYBsDyAOA+IyII4C4mAgtgdifiB+B1RzBIj3APECIJ4PxCkBFgzBbnoM6UGWDFEeRgz+NhIMMZ7GDMHOKgxJkU4MSd5yDHEesgyhjlJgfHx5PsOBhdkM/4F6+cnATGRiVAAA+zEdZw==');
Launch := DTMFromString('mrAAAAHic42BgYDBiZGBQBGInIA4EYl4gNgBiLSC2AuI2IO4E4g4gngPEs4B4GRCXQPHzhycYGnI8GFryvRh2bN3AMLs5nOHlo5MMp1cVMhxclMPwH2gHPx7MSADDAACXeBZH');
Pole := DTMFromString('mggAAAHicY2NgYJgKxIpAzMIAAdFA/AaIvaF8eShbEIh9gLgwP4chPVSBwdnWhCEiwIXhx4dlDFH+Ngz8QDlsmBEHhgAAN88KtQ==');
Gap := DTMFromString('mrAAAAHic42BgYLBgZGBwg2IjIDYEYhUgDgdiaSA+CVRzB4i3AvEbIN4ExK+A+AQQHwPiIA9zhqQgc4boYDeGJC9thgw/PYbG+hqGtFg/hkgXGQYRoBp8mJEAhgEA+WsQlw==');
Roof := DTMFromString('m6wAAAHic42ZgYLjPyMCgzMTAIA3E54DsXUB8FYgPAPEdIH4CxPuB+AgQ1wDxHiDOAOJOIG4H4iwgTgHiBUAcDcTWQLwYiJ1sjBlC3Q0YYkLcGZysdFAwSCwuyJ7h4KJchu2z0hn4ge4gFjOSgJEAAMpXGCo=');
end;
Procedure FreeDTMs;
begin
FreeDTM(Rope);
FreeDTM(Log);
FreeDTM(Plate);
FreeDTM(Ledge);
FreeDTM(Launch);
FreeDTM(Pole);
FreeDTM(Gap);
FreeDTM(Roof);
end;
{//////////////////////////////////////////////////////////////////////////////}
function MSToHour(mstime :Extended): Extended;
begin
result := mstime/3600000;
end;
{///////////////////////////////by RyGay///////////////////////////////////////}
procedure Report;
var
TimeRan: integer;
begin
TimeRan := (1+((GetSystemTime - TimeBegan) / 1000));
Exp := (GetXPBarTotal - StartingXP);
ExpHr := Round((Exp * 3600) / (TimeRan));
WriteLn('Time: ' + TimeRunning);
WriteLn('We have gained ' + IntToStr(Exp) + ' Agility Experience!');
WriteLn('We are gaining ' + IntToStr(ExpHr) + ' Agility Experience per Hour!');
end;
{//////////////////////////////////////////////////////////////////////////////}
Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;
{///////////////////////////////Johnnimms13////////////////////////////////////}
procedure PaintReport;
begin
Clock := [0,0,0];
ConvertTime(GetTimeRunning,Clock[0],Clock[1],Clock[2]);
PrintOnSmart(['ABBA', 'Time Ran: '+tostr(Clock[0])+':'+tostr(Clock[1])+':'+tostr(Clock[2]),
'Laps Done: '+IntToStr(laps), 'EXP Gained: '+tostr(EXP), 'EXP Per Hour: '+ToStr(EXPhr)], Point(10, 255), 255);
end;
{//////////////////////////////////////////////////////////////////////////////}
procedure AntiRandoms;
begin
if ((not LoggedIn) or (ar = 0)) then Exit;
FindNormalRandoms; // find random events
end;
function mmBlack:Boolean;
var
blackSpot : array [0..7] of TPoint;
color : array [0..7] of Integer;
i,kk,res:Integer;
begin
result:= false;
blackSpot[0]:= Point(587,43);
blackSpot[1]:= Point(575,112);
blackSpot[2]:= Point(577,115);
blackSpot[3]:= Point(672,122);
blackSpot[4]:= Point(627,139);
blackSpot[5]:= Point(611,134);
blackSpot[6]:= Point(622,152);
blackSpot[7]:= Point(622,152);
color[0]:= 512;
color[1]:= 393990;
color[2]:= 198400;
color[3]:= 65537;
color[4]:= 131072;
color[5]:= 1797;
color[6]:= 459782;
color[7]:= 328705;
res := 0;
for i := 0 to 7 do
begin
for kk := 0 to 7 do
begin
if(FindColorTolerance(x,y,color[kk],blackSpot[i].x,blackSpot[i].y,blackSpot[i].x,blackSpot[i].y,7)) then
begin
res := res + 1;
//debug
if mmdebug = 1 then
writeln('i = ' + inttostr(i) + ' kk = ' + inttostr(kk));
end;
end;
end;
if(res > 7) then
result:= true;
end;
function Wfloor:Integer;
begin
result:= 99;
if((FindColorTolerance(x,y,2247007,633,56,633,56,15) or
FindColorTolerance(x,y,2247007,629,52,629,52,15) or
FindColorTolerance(x,y,2247007,628,60,628,60,15) or
FindColorTolerance(x,y,2247007,634,51,634,51,15) or
FindColorTolerance(x,y,2247007,633,60,633,60,15) or
FindColorTolerance(x,y,2247007,629,49,629,49,15)) and
FindColorTolerance(x,y,395009,634,84,634,84,15) and
(mmblack())) then
result:= 10;
if((FindColorTolerance(x,y,1655633,615,84,615,84,15) or
FindColorTolerance(x,y,1521998,621,57,621,57,15)) and
(mmblack())) then
result:= 11;
if((FindColorTolerance(x,y,1853268,630,113,630,113,15) or
FindColorTolerance(x,y,1853268,636,116,636,116,15)) and (mmblack())) then
result:= 12;
if(FindColorTolerance(x,y,4873321,530,184,530,184,15) and (mmblack())) then
result:= 13;
if((FindColorTolerance(x,y,2180188,621,113,621,113,15) or
FindColorTolerance(x,y,2180188,625,114,625,114,15) or
FindColorTolerance(x,y,2180188,627,112,627,112,15) or
FindColorTolerance(x,y,2180188,622,113,622,113,15)) and
FindColorTolerance(x,y,393218,643,114,643,114,15) and
FindColorTolerance(x,y,393218,632,114,632,114,15) and
not(FindColorTolerance(x,y,4873321,530,184,530,184,15))and
(mmblack())) then
result:= 14;
//Debug
if debugwfloor = 10 then
begin
writeln('Debug Start');
writeln(FindColorTolerance(x,y,2247007,633,56,633,56,15));
writeln(FindColorTolerance(x,y,2247007,629,52,629,52,15));
writeln(FindColorTolerance(x,y,2247007,628,60,628,60,15));
writeln(FindColorTolerance(x,y,2247007,634,51,634,51,15));
writeln(FindColorTolerance(x,y,2247007,633,60,633,60,15));
writeln('Debug End');
end;
if debugwfloor = 14 then
begin
writeln('Debug Start');
writeln(FindColorTolerance(x,y,2180188,621,113,621,113,15));
writeln(FindColorTolerance(x,y,2180188,625,114,625,114,15));
writeln(FindColorTolerance(x,y,2180188,627,112,627,112,15));
writeln(FindColorTolerance(x,y,393218,643,114,643,114,15));
writeln(FindColorTolerance(x,y,393218,632,114,632,114,15));
writeln(FindColorTolerance(x,y,4873321,530,184,530,184,15));
writeln('Debug End');
end;
end;
Procedure sleepWhileMMBlack();
var t:Integer;
begin
t := 0;
while((mmBlack) and (t < 25)) do
begin
sleep(250+random(5))
t:=t+1;
writeln('SLeeping while mm is blacked');
end;
end;
function distanceTo(var point:TPoint): Extended;
var myLoc:TPoint;
begin
myLoc:= SPS_GetMyPos();
Result:= Sqrt((Sqr((Abs((point.x - myLoc.x)))) + Sqr((Abs((point.y - myLoc.y))))))
end;
procedure FreeAll;
begin
SMART_ClearCanvas;
writeln('free');
end;
procedure sleepWhileMoving();
var t:Integer;
begin
t := 0;
while((IsMoving) and (t < 12)) do
begin
sleep(250+random(5))
writeln('Sleeping while moving');
t:=t+1;
end;
end;
{/////////////////////////////by Johnnimms13//////////////////////////////////}
procedure EatPie;
var SPie, HPie, x, y: integer;
begin
if PieLevel > 0 then
begin;
SPie := DTMFromString('mlwAAAHicY2dgYPjIxMDwFoi/I9FfgPgDEL9kZGB4xgih3wPxYyB+B8SPgDhLTxGOK9JMGVJCdRiyovQZov00GPiB5uLCjHgwFAAAE+UTaw==');
HPie := DTMFromString('mlwAAAHicY2dgYDjBxMBwBIhPA/FhID4OxKeA+CIQH2NkYDgJxIegeD8QnwXiI0DsrSDOEKAsCcYZugoMScHaDNEBtgwp4c4M+AAjHgwFALfwEBg=');
if GetSkillInfo('agility', True) < (PieLevel+1) then
begin
writeln('below 91 agility, trying to find pie');
if ExistsItemDTM(spie, x, y) then
begin
writeln('found pie');
mouse(x, y, 2, 2, true);
end else
if ExistsItemDTM(hpie, x, y) then
begin
writeln('found 1/2 pie');
mouse(x, y, 2, 2, true);
end else
begin
writeln('no pies!')
if PLogOut = True then
begin
logout;
TerminateScript;
end;
end;
end else
begin
writeln('No Pie for you!');
end;
freedtm(SPie);
FreeDtm(HPie);
end;
end;
{//////////////////////////////////////////////////////////////////////////////}
function getLocation(): integer;
var myPos, First, Second, Third, Fourth: TPoint;
begin
result := 0;
if (mmblack = true) then
result := Wfloor()
else
begin
First := Point(2045, 2430); //Beginning Point
Second := Point(2045, 2445); //After swinging the rope
Third := Point(2005, 2460); //After log balancing
Fourth := Point(1940, 2415); //Before running up the wall
myPos := SPS_GetMyPos();
if ((distanceTo(First) <= 5) and (myPos.y < 2435)) then
begin
result:=1;
end;
if (distanceTo(Second) <= 5) then
begin
result:=2;
end;
if (distanceTo(Third) <= 15) then
begin
reRunUpWall := True;
result:=3;
end;
if (reRunUpWall = True) then
result:=3;
if (myPos = Fourth) then
begin
result:=4;
end;
end;
end;
procedure handleObstacle(spot: integer);
begin
SetDTMs;
writeln(spot);
if (spot = 0) then
begin
AntiRandoms;
EatPie;
writeln('Walk to beginning Point(2045, 2430)');
SPS_WalkToPos(Point(2045, 2430));
sleepWhileMoving();
end;
if (spot = 1) then
begin
writeln('Swing on rope');
if FindDTMRotated(Rope, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
Mouse(x, y, 3, 3, True);
sleep(2300+random(175));
sleepWhileMoving();
Report;
PaintReport;
end;
end;
if (spot = 2) then
begin
writeln('Walk across log balance');
if FindDTMRotated(Log, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
MMouse(x,y,5,5);
Mouse(x, y, 3, 3, True);
sleep(1900+random(150));
sleepWhileMoving();
end;
end;
if (spot = 3) then
begin
writeln('Run up and jump the plate');
SPS_WalkToPos(Point(1996, 2478));
writeln(SPS_GetMyPos());
if FindDTMRotated(Plate, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
Mouse(x, y, 3, 3, True);
sleep(6400+random(150));
sleepWhileMoving();
end;
end;
if (spot = 10) then
begin
if (reRunUpwall = True) then
reRunUpwall := False;
AntiRandoms;
writeln('Climb up Ledge');
if FindDTMRotated(Ledge, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
MakeCompass('n');
Mouse(x, y, 0, 0, True);
sleep(3300+random(150));
sleepWhileMoving();
end;
end;
if (spot = 11) then
begin
writeln('Fire Spring Device');
if FindDTMRotated(Launch, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
Mouse(x, y, 0, 0, True);
sleep(4300+random(150));
sleepWhileMoving();
end;
end;
if (spot = 12) then
begin
writeln('Cross Balance Beam if Healthy');
If not HPPercent > HP then
begin
logout;
TerminateScript;
end;
if FindDTMRotated(Pole, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
Mouse(x, y, 0, 0, True);
sleep(2000+random(150));
sleepWhileMoving();
end;
end;
if (spot = 13) then
begin
writeln('Jump over gap');
if not MakeCompass('n') then
begin
MakeCompass('n');
end;
if FindDTMRotated(Gap, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
Mouse(x, y, 0, 0, True);
sleep(2000+random(150));
sleepWhileMoving();
end;
end;
if (spot = 14) then
begin
AntiRandoms;
writeln('Slide down roof');
if FindDTMRotated(Roof, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
Mouse(x, y, 0, 0, True);
sleep(1800+random(150));
sleepWhileMoving();
IncEx(Laps, 1);
PaintReport;
end;
end;
FreeDTMs;
end;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := Username;
Players[0].Pass := Password;
Players[0].Nick := Nickname;
Players[0].Active := True;
end;
procedure LogMeIn;
begin
LoginPlayerToLob;
OpenWorldScreen;
SelectWorld(SERVER);
LoginPlayer;
end;
{//////////////////////////////////Main Loop///////////////////////////////////}
begin
Smart_Server := SERVER;
Smart_Members := True;
SetupSRL;
DeclarePlayers;
SPS_Setup(RUNESCAPE_SURFACE, ['4_5','4_6']);
TimeBegan := GetSystemTime;
ToggleXPBar(True);
StartingXP := (GetXPBarTotal);
AddOnTerminate('FreeAll');
if not(LoggedIn) then
LogMeIn;
while not(LoggedIn) do
sleep(1000);
MakeCompass('n');
SetAngle(SRL_ANGLE_HIGH);
while(true) do //Main loop
begin
while not(LoggedIn) do
LoginPlayer;
handleObstacle(getLocation());
myPos := SPS_GetMyPos();
writeln(Wfloor());
writeln(myPos);
writeln(mmBlack);
end;
end.