From: masterBB
An easier way to read would be:
function correctPosition(): Boolean;
begin
result := true;
if(isInCorrectArea()) then Exit;
SPS.walkToPos(point(randomRange(174, 164), randomRange(210,197)));
if(isInCorrectArea()) then Exit;
//blindwalk code
if(isInCorrectArea()) then Exit;
//teleport code
result := isInCorrectArea();
end;
okay thanks. What do you mean by blind walk? Also, when i use that code is clicks on the mini map pretty much every time it clicks a tree.
Here's the script:
program scriptTemplate;
{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;
var
TreeCount: integer; //global variable
CraftCount: integer;
timer: TTimeMarker; //declared it here
ShaftCount: integer;
procedure ChopTree();
var
x, y: integer;
begin // colour, tol CTS, hue, sat
if mainscreen.findObject(x, y, 1455914, 11, colorSetting(2, 0.17, 0.58), mainscreen.playerPoint, 72, 131, 100, ['down Ever','last','ever'], MOUSE_LEFT) then
writeLn('Clicking Tree') //this is the exception for the semicolon because it is followed by an else statement
else
SPS.walkToPos(point(randomRange(153, 161), randomRange(231 ,250)));
if tabBackPack.waitForShift(randomRange(3000,5000)) then
begin
writeLn('Tree cut. We got a log.');
TreeCount := TreeCount + 1 ;
end;
if (TreeCount > 3) and (TreeCount < 7) then
begin
writeLn('rotating camera angle');
randomCompass(0, 360, false);
TreeCount := 0;
end;
end;
procedure Shaft_antiBan();
begin
Case Random(6) of
0 : hoverSkill(SKILL_WOODCUTTING);
1 : mouseOffClient(OFF_CLIENT_RANDOM);
2 : randomGameTab(true);
3 : randomRClickItem();
4 : sleepAndMoveMouse(1000 + random(2000));
5 : randomCompass(10, 30, true);
end;
end;
procedure CutShafts();
begin
tabBackpack.Open;
writeLn('Crafting logs into shafts.')
if tabBackpack.isFull() then
begin
tabBackpack.mouseSlot(RandomRange(2 ,5), MOUSE_LEFT);
CraftCount := CraftCount + 1 ;
ShaftCount := ShaftCount + 405;
end;
if (CraftCount = 1) then
begin
wait(randomRange(700,1400));
Mouse(285, 209, 20, 20, MOUSE_LEFT);
wait(randomRange(700,1400));
productionScreen.clickStart();
mouseOffClient(OFF_CLIENT_RANDOM);
Shaft_antiBan();
wait(randomRange(46000,50000));
end;
if (CraftCount > 1) then
begin
wait(randomRange(700,1400));
productionScreen.clickStart();
Shaft_antiBan();
wait(randomRange(46000,50000));
end;
end;
function isInCorrectArea(): Boolean;
var
myPos: TPoint;
correctArea: TBox;
begin
myPos := sps.getPlayerPos();
correctArea := IntToBox(164, 197, 174, 210);
result := PointInBox(myPos, correctArea);
end;
function correctPosition(): Boolean;
begin
result := true;
if(isInCorrectArea()) then Exit;
SPS.walkToPos(point(randomRange(174, 164), randomRange(210,197)));
if(isInCorrectArea()) then Exit;
//blindwalk code
if(isInCorrectArea()) then Exit;
//teleport code
result := isInCorrectArea();
end;
// main loop
begin
disableSRLDebug := true;
smartEnableDrawing := false;
setupSRL();
SPS.setup('Maps', RUNESCAPE_OTHER);
spsAnyAngle := true;
declarePlayers();
if not isLoggedIn() then
begin
players[currentPlayer].login();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
mainScreen.setZoom(true)
end;
timer.start(); // start the timer initially here
repeat
repeat
isInCorrectArea();
correctPosition();
chopTree();
until tabBackpack.isFull();
CutShafts();
writeln(msToTime(getTimeRunning(), TIME_FORMAL));
until false;
end.