Simba Code:
program ApeAtolAgility;
{$DEFINE SMART}
{$i srl/srl.scar}
{$i sps/sps.simba}
{$I SRL/SRL/misc/paintsmart.scar}
// author: [Nathan]
// Version: 1.1 Beta
// Runs ape atol agility course
// Start in the course with a ninja greegree equipped
// Does not eat currently so only run if your are 70+ agility
// No antiban and no breaks yet, be cautious
//SETUP
const
SERVER = 114; //Replace with desired server number
Username = 'user';
Password = 'pass';
//Vars
var i,x,y,ourLoc:LongInt;
var Spots : Array [0..5] of Integer;
var p:TPointArray;
var stone,passed:Integer;
var startingExp,currentExp,laps,gainedExp:Integer;
function mmBlack:Boolean;
var blackSpot : Array [0..3] of TPoint;
var color : Array [0..3] of Integer;
var i,kk,res:Integer;
begin
result:= false;
blackSpot[0]:= Point(587,43);
blackSpot[1]:= Point(667,55);
blackSpot[2]:= Point(577,115);
blackSpot[3]:= Point(672,122);
color[0]:= 512;
color[1]:= 393990;
color[2]:= 0;
color[3]:= 65537;
res:=0;
for i:=0 to 3 do
begin
for kk:=0 to 3 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;
end;
end;
end;
if(res > 3) then
result:= true;
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
ClearRSCanvas(SMART_Canvas.canvas);
//SMART_FreeDebug; <- contains a bug, don't use this.
writeln('free');
end;
procedure Paint;
begin
SMART_DrawBox(IntToBox(5,35,350,120));
SMART_DrawTextEx(False,80,40,'UpChars','Ape Atoll Agility By: [Nathan]', clBlue);
SMART_DrawTextEx(False,10,60,'UpChars','Time running: ' + TimeRunning, clBlue);
SMART_DrawTextEx(False,10,80,'UpChars','Laps run: ' + inttostr(laps), clBlue);
SMART_DrawTextEx(False,10,100,'UpChars','Experience gained: ' + inttostr( (currentExp-startingExp) ), clBlue);
end;
function checkAgility:Integer;
begin
currentExp:=GetXP(SKILL_AGILITY);
if(currentExp=-1) then
currentExp:=GetXP(SKILL_AGILITY);
if(currentExp=-1) then
currentExp:=GetXP(SKILL_AGILITY);
if(currentExp=-1) then
currentExp:=GetXP(SKILL_AGILITY);
if(currentExp=-1) then
currentExp:=GetXP(SKILL_AGILITY);
if(currentExp=-1) then
currentExp:=GetXP(SKILL_AGILITY);
if(currentExp=-1) then
currentExp:=GetXP(SKILL_AGILITY);
result:=currentExp;
end;
//Rewrite of FindObjEx to try a max of 12 times before giving up
//Useful in case we move and script doesn't detect it
function FindObjEx2(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;
var
CurX, CurY, a, b, c, i, zzz: Integer;
Start: Boolean;
begin
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorSpiralTolerance(cx, cy, color[b], xs, ys, xe, ye, Tol)) then
begin
zzz:= zzz+1;
Start := True;
Break;
end;
end;
if (Start) then
begin
CurX := Round((xs + xe) div 2);
CurY := Round((ys + ye) div 2) - Step;
i := 1;
repeat
for c := 1 to i do
begin
case a of
0: begin //To allow for beginning offset and loop
a := a + 1;
i := 0;
CurY := CurY + Step;
end;
1: CurX := CurX + Step;
2: CurY := CurY - Step;
3: CurX := CurX - Step;
4: CurY := CurY + Step;
end;
if (CurX >= xs) and (CurX <= xe) and (CurY >= ys) and (CurY <= ye) then
begin
try
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorTolerance(cx, cy, Color[b], CurX-(Step div 2), CurY-(Step div 2), CurX+(Step div 2), CurY+(Step div 2), Tol)) then
begin
MMouse(cx, cy, 3, 3);
zzz:= zzz+1;
writeln('zzz:');
writeln(zzz);
If (WaitUptextMulti(Text, 300)) then
begin
GetMousePos(cx, cy);
Result := True;
Exit;
end;
end;
end;
except
end;
end;
end;
a := a + 1;
if a mod 5 = 0 then a := 1;
if (a = 1) or (a = 3) then i := i + 1;
until (zzz > 12) or (Result) or ((CurX > xe) and (CurY > ye))
end;
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;
function getLocation(): integer;
var myPos, First, Second,Fourth, Fourth2: TPoint;
var x,y:LongInt;
begin
result := 0;
First := Point(2835, 5670); //Befoer the Stepping stone
Second := Point(2830, 5670); //On the island, needs to climb tree
//Third -> On top, needs to click on monkey bars
Fourth := Point(2805,5670); //Needs to climb skull wall
Fourth2 := Point(2805,5675); //Needs to climb skull wall
//Firth -> Is player in [] area?
//Fifth -> Area 2, slide down vine
Spots[0]:=0;
Spots[1]:=0;
Spots[2]:=0;
Spots[3]:=0;
Spots[4]:=0;
Spots[5]:=0;
myPos := SPS_GetMyPos();
if(distanceTo(First) < 15) then
begin
Spots[0]:=1;
result:=1;
end;
if((myPos = Second) or(myPos.x=2830)) then
begin
Spots[1]:=1;
result:=2;
end;
if(passed > 3) then
begin
Spots[1]:=1;
result:=2;
end;
if(( (FindColorTolerance(x,y,393220,604,53,604,53,15)) or FindColorTolerance(x,y,1025,604,53,604,53,25) ) and (FindColorTolerance(x,y,1850450,617,79,635,93,15)) ) then
begin
if not(FindColorTolerance(x,y,11377544,572,27,687,145,30)) then
begin
Spots[2]:=1;
result:=3;
end;
end;
if( (myPos.x > 2777) and (myPos.x < 2824) and (myPos.y > 5667) and (myPos.y < 5732) ) then
begin
Spots[4]:=1;
result:=5;
end;
if( (myPos = Fourth) or (myPos = Fourth2) ) then
begin
Spots[3]:=1;
result:=4;
end;
if( (myPos.x > 2836) and (myPos.x < 2856) and (myPos.y > 5692) and (myPos.y < 5727) ) then
begin
Spots[5]:=1;
result:=6;
end;
if(Spots[2] = 1) then
result:=3;
end;
procedure handleObstacle(spot: integer);
var monkeycolor,treecolor:Integer;
var waste:T2DExtendedArray;
var tree5:TPoint;
begin
if (spot = 0) then
begin
writeln('Walk to beginning Point(2835, 5670)');
SPS_WalkToPos(Point(2835, 5670));
sleepWhileMoving();
end;
if (spot = 1) then
begin
writeln('Click on stepping stone');
if FindObjEx2(x, y, ['ump', 'tone'], [1783870,2774367], 5, 50, MSX1, MSY1, MSX2, MSY2) then
begin
passed:=passed+1;
Mouse(x, y, 3, 3, True);
sleep(2500+random(175));
sleepWhileMoving();
end;
end;
if (spot = 2) then
begin
writeln('Climb tree');
passed:=0;
if FindObjEx2(x, y, ['Climb'], [5675969, 4684193], 5, 50, MSX1, MSY1, MSX2, MSY2) then
begin
Mouse(x, y, 3, 3, True);
sleep(2200+random(150));
sleepWhileMoving();
end;
end;
if (spot = 3) then
begin
writeln('Click on monkey bars');
monkeycolor:= 2442074;
if (FindObjEx2(x, y, ['wing', 'oss'], [monkeycolor], 12, 20, 189,150,296,228)) then
begin
Mouse(x, y, 3, 3, True);
sleepWhileMoving();
sleepWhileMMBlack();
end;
end;
if (spot = 4) then
begin
writeln('Climb skull wall');
if FindObjEx2(x, y, ['kull', 'ope'], [1519155, 1849921, 2776937], 10, 20, 190,145,240,194) then
begin
Mouse(x, y, 2, 2, True);
sleepWhileMoving();
sleep(100+random(50));
end;
end;
if (spot = 5) then
begin
tree5:= Point(2820, 5710);
if(distanceTo(tree5) > 13) then
begin
writeln('Walk to lower spot (2820, 5705)');
SPS_WalkToPos(Point(2820, 5710));
sleepWhileMoving();
sleep(100+random(50));
end;
if(distanceTo(tree5) <14) then
begin
writeln('Click tree (swing rope)');
if FindObjEx2(x, y, ['ing', 'ope'], [740681, 1860447, 3439209], 5, 50, 275,32,516,290) then
begin
Mouse(x, y, 2, 2, True);
sleep(250+random(250));
sleepWhileMoving();
end;
end;
end;
if (spot = 6) then
begin
writeln('click climb down tree');
if FindObjEx2(x, y, ['own'], [4422296,3694463], 5, 20, 224, 3, 403, 104) then
begin
Mouse(x, y, 2, 2, True);
laps:=laps+1;
sleep(1000+random(350));
if(Random(100) > 75) then
checkAgility;
sleepWhileMoving();
sleepWhileMMBlack();
end;
end;
end;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := Username;
Players[0].Pass := Password;
Players[0].Nick := 'player';
Players[0].Active := True;
end;
begin
Smart_Server := SERVER;
Smart_Members := True;
//Setup
SetupSRL;
DeclarePlayers;
SPS_Setup(RUNESCAPE_SURFACE, ['6_14','7_14']);
AddOnTerminate('FreeAll');
while not(LoggedIn) do
sleep(1000);
startingExp:= checkAgility();
Writeln('Starting exp: ' + inttostr(startingExp));
while(true) do //Main loop
begin
gainedExp:= (currentExp-startingExp);
FindNormalRandoms();
ourLoc:= getLocation();
Writeln(Spots);
Paint;
if(ourLoc = 0) then
begin
sleep(Random(300)+250);
ourLoc:= getLocation();
end;
handleObstacle(ourLoc);
sleep(10+random(90));
sleepWhileMoving();
end
end.