Theron
2014-12-30 15:20:54
Hey guys, first script here. It's currently not functional, it'll walk to willows, detect the color for the tree, and click, but then it quits. I'm posting it here so hopefully I can get some good advice on how to make it functional. Maybe I don't have enough specific colors because after it clicks the first willow, it doesn't detect another one. I believe I may have fixed that by adding repeat…until in the main loop, but when it runs the next procedure (runToDepositBox(); ), it clicks on the 'HERO' menu rather than walking to the box. Do I need to change the SPS path to make it functional? I used the same points that I did to walk from the DepositBox and it'll correctly walk to the trees. It also doesn't have any angle changes or antiban. Any advice would be greatly, greatly appreciated. Big thanks to @KeepBotting for helping me out over Skype whenever I had any questions and to @The Mayor for his beginners tutorials.
An image is included at the bottom. Needs to be saved in RUNESCAPE_OTHER.
A copy of the script is also available.
program tWillows;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'UN';
password := 'PW';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;
procedure runToWillows();
var
pathToWillows: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToWillows := [Point(197, 181), Point(179, 183), Point(167,163), Point(171, 138), Point(194, 134), Point(217, 125), Point(235,112), Point(254,100)];
if SPS.walkPath(pathToWillows) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the Willows');
end;
procedure clickWillowTree();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
findColorsSpiralTolerance(x, y, TPA, 1582627, mainScreen.getBounds(), 3, colorSetting(2, 0.67, 0.41));
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['illow'], 500) then
begin
repeat
fastClick(MOUSE_LEFT);
wait(10000);
until tabBackPack.isFull();
end;
end;
end;
procedure runToDepositBox();
var
pathToDepositBox: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToDepositBox := [Point(254, 100), Point(235, 112), Point(217,125), Point(194, 134), Point(171, 138), Point(167, 163), Point(179,183), Point(197,181)];
if SPS.walkPath(pathToDepositBox) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the Deposit Box');
end;
procedure findDepositBox();
var
x, y, i: integer;
begin
if not isLoggedIn() then
exit;
repeat
mainscreen.findObject(x, y, 4084066, 7, colorSetting(2, 0.06, 0.19), mainscreen.playerPoint, 30, 50, 50, ['eposit', 'box'], MOUSE_LEFT);
wait(randomRange(1000, 2000));
inc(i);
until depositBox.isOpen() or (i >= 15);
end;
procedure depositWillows();
var
bankTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
if depositBox.isOpen() then
begin
bankTimer.start();
repeat
if (depositBox.count > 0) then
begin
depositBox.quickDeposit(QUICK_DEPOSITBOX_INVENTORY);
wait(gaussRangeInt(500, 750));
end;
until(depositBox.isEmpty()) or (not isLoggedIn()) or (bankTimer.getTime() > 10000);
end;
depositBox.close();
end;
{Main Loop}
begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
declarePlayers();
SPS.setup('SarimWillows', RUNESCAPE_OTHER); // Setup our map
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitTreasure();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;
repeat
runToWillows();
repeat
clickWillowTree();
until tabBackPack.isFull();
runToDepositBox();
findDepositBox();
depositWillows();
until false;
end.An image is included at the bottom. Needs to be saved in RUNESCAPE_OTHER.
A copy of the script is also available.