jamesayo
2015-04-07 23:51:14
Hi, I'm new to Simba and SRL in general. Following along with a few tutorials on how to make scripts, I attempted to make a yew cutting script. It home teles to Port Sarim, runs to the Remmy yews, and banks by hometeleing to Burthorpe and banking there.
It mostly works fine, except that it is very bad at click on the yew trees and i'm not sure how to keep it from clicking away while chopping without having to wait a long time before moving to the next tree when the current tree gets chopped down.
I'm looking for any suggestions!
Here's my script:
It mostly works fine, except that it is very bad at click on the yew trees and i'm not sure how to keep it from clicking away while chopping without having to wait a long time before moving to the next tree when the current tree gets chopped down.
I'm looking for any suggestions!
Here's my script:
program yewCutter;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
var
LoadsDone: integer;
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;
procedure teleToPortSarim();
var
p: TPoint;
begin
if not isLoggedIn() then
exit;
repeat
lodestoneScreen.teleportTo(LOCATION_PORT_SARIM);
wait(randomRange(14500, 16000));
until (not isLoggedIn()) or minimap.findSymbol(p, MM_SYMBOL_SHOP_FISHING, minimap.getBounds());
end;
procedure runToTrees();
var
pathToTrees: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToTrees := [Point(354, 183), Point(322, 175), Point(294, 158), Point(256, 154), Point(223, 153), Point(193, 145), Point(166, 144), Point(141, 130), Point(120, 116), Point(92, 110), Point(63, 109), Point(50, 114)]
if SPS.walkPath(pathToTrees) then
minimap.waitPlayerMoving()
else
writeLn('Failed to walk to the trees');
end;
procedure cutTrees();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
cutTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
cutTimer.start();
repeat
findColorsSpiralTolerance(x, y, TPA, 2574889, mainScreen.getBounds(), 6, colorSetting(2, 1.09, 1.05))
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Yew', 'ew'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clear;
break;
end;
end;
tabBackpack.waitForShift(20000);
until tabBackpack.isFull() or (cutTimer.getTime() > 2700000);
end;
procedure teleToBurthorpe();
var
p: TPoint;
begin
if not isLoggedIn() then
exit;
repeat
lodestoneScreen.teleportTo(LOCATION_BURTHORPE);
wait(randomRange(14500, 16000));
until (not isLoggedIn()) or minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds());
end;
procedure findBanker();
var
pathToBank: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToBank := [Point(210, 168), Point(199, 178), Point(185, 191), Point(163, 200)]
if SPS.walkPath(pathToBank) then
minimap.waitPlayerMoving()
else
writeLn('Failed to walk to the bank');
end;
procedure depositYews();
var
bankTimer: TTimeMarker;
begin
if not isLoggedIN() then
exit;
if bankScreen.open(BANK_TABLE_BURTHORPE) then
repeat
if (tabBackPack.count > 0) then
begin
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(1000, 2000));
end;
until(tabBackPack.isEmpty()) or (not isLoggedIN()) or (bankTimer.getTime() > 10000);
inc(LoadsDone);
bankScreen.close();
end;
procedure progressReport();
var
logsCut, profit, profitPerHour, exp, expPerHour: integer;
begin
logsCut := LoadsDone * 28;
profit := (logsCut * 250);
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));
exp := logsCut * 175;
expPerHour := round((exp*60) / (getTimeRunning() / 60000));
writeLn('===============================');
writeLn('James Ayo''s Yew Power House Cutter');
writeLn('Time Run: ' + timeRunning);
writeLn('Logs Cut: ' + intToStr(logsCut));
writeLn('Loads Done: ' + intToStr(loadsDone));
writeLn('Profit Made: ' + intToStr(profit));
writeLn('Profit/hour: ' + intToStr(profitPerHour));
writeLn('Exp gained: ' + intToStr(exp));
writeLn('Exp/hr: ' + intToStr(expPerHour));
end;
// main loop
begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
declarePlayers();
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
exitTreasure();
end;
if tabBackpack.isFull() then
begin
teleToBurthorpe();
findBanker();
depositYews();
end;
progressReport();
SPS.setup('RIMM_MAP', RUNESCAPE_OTHER);
teleToPortSarim();
runToTrees();
cutTrees();
SPS.setup('BURTH_MAP', RUNESCAPE_OTHER);
teleToBurthorpe();
findBanker();
depositYews();
until(false);
end.