beefman
2014-06-30 07:05:46
How do i stop my script from running out of the map? The script cuts down evergreen trees, south of the edgeville monastery, east of dwarven mine and west of Barbarian village. I would run the script for about an hour or two until it randomly runs out of the map. Please can someone check my script? Thanks
[ATTACH=CONFIG]23466[/ATTACH]
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
procedure WalkToCoords();
begin
writeLn('WALKING TO CORDS.');
SPS.walkToPos(point(randomRange(206, 157), randomRange(212,174)));
end;
function choptree(): boolean;
var
x, y: integer;
begin // colour, tol CTS, hue, sat
if mainscreen.findObject(x, y, 529679, 6, colorSetting(2, 0.65, 9.02), mainscreen.playerPoint, 86, 50, 40, ['down Ever','last','ever'], MOUSE_LEFT) then
begin
result := true;
treeCount := treeCount + 1 ;
writeLn('Yay we clicked a tree');
wait(1500);
end;
if tabBackPack.waitForShift(randomRange(2500,4000)) then
writeLn('We got a log');
if (treeCount > 5) and (treeCount < 13) then
begin
walkToCoords(); //so we dont double up on code
randomCompass(0, 360, false);
TreeCount := 0;
writeLn('Chopped 5 - 13 Logs.');
end;
end;
procedure Shafts();
begin
tabBackpack.Open;
tabBackpack.mouseSlot(2, MOUSE_LEFT);
wait(randomRange(700,1400));
Mouse(285, 209, 10, 10, MOUSE_LEFT);
wait(randomRange(700,1400));
productionScreen.clickStart();
wait(randomRange(49000,53000));
end;
// main loop
begin
disableSRLDebug := true;
smartEnableDrawing := true;
setupSRL();
SPS.setup('Map', RUNESCAPE_OTHER);
spsAnyAngle := true;
declarePlayers();
repeat
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
mainScreen.setZoom(true)
end;
TreeCount;
if chopTree() = false then
begin
WalkToCoords();
end;
writeLn(toStr(tabBackpack.count()));
until tabBackpack.isFull();
Shafts()
until false
end.[ATTACH=CONFIG]23466[/ATTACH]