Originally Posted by
Harrier
Looks great Harrier, thanks a lot!
Originally Posted by
The Mayor
If you know what good standards look like, you should run it through the parser (it will remove all comments though). You can enable formatter.sex via extensions.
Oh wow, this is definitely a good extension, I just used it on my script one section isn't formatted though because I just wrote it.
Thanks The Mayor
------
Here is what I have been up to today:
Simba Code:
{{TODO: In chopDownTree function, move to different area or rotate the display
instead of exiting the script.
Perfect chopDownTree, seems to be an issue chopping more than one tree at
a time.
Clean up code.
Anti-ban.
Progress report.
Fix up fletching/chopping not working with seperate procedures
}
program ChopnFletch;
{$DEFINE SMART}
{$i srl-6/srl.simba}
procedure prepareplayer;
begin
ClearDebug;
Writeln('Please Wait...Setting Player up');
if not isLoggedIn() then
exit;
exitTreasure;
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;
procedure chopDownTree;
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not tabBackpack.isfull then
begin
prepareplayer;
FindColorsSpiralTolerance(x, y, TPA, 2107688, mainscreen.getBounds(), 2, colorSetting(2, 1.69, 0.80));
fletchLogs;
if length(TPA) < 10 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(['ree'], 500) then
begin
writeln('Found a Normal tree');
wait(randomrange(300, 800));
fastClick(MOUSE_RIGHT);
chooseOption.select(['hop down']);
tabBackpack.waitForShift(7900);
end else
begin
writeln('No trees found, please adjust color' + ' ' + 'or move to a section with trees');
exit;
end;
end;
end else
writeln('Inventory full, fletching the logs');
fletchLogs;
end;
procedure findLog;
var
Log, l, o: Integer;
begin
Log := DTMFromString('mlwAAAHicY2dgYHjHzMDwEIj/MUPY74H4JxA/AuJ5jAwMK4F4KRBPA+JVQDwDiGcDcYKHNlA3ExAzQmlkjBsw4sFQAAClmgvt');
if findDTM(Log, l, o, tabBackpack.getBounds()) then
begin
mouse(l, o, 3, 3, MOUSE_MOVE);
fastClick(MOUSE_LEFT);
FreeDTM(Log);
end else
FreeDTM(Log);
exit;
end;
procedure fletchLogs;
begin
//if tabBackpack.isFull then
begin
findLog;
if toolScreen.isOpen(3000) then
toolScreen.select('Knife');
if productionScreen.isOpen(10000) then
else end
writeln('Inventory isnt full');
begin
productionScreen.selectBox(1);
productionScreen.clickStart();
if progressScreen.isOpen(10000) then
begin
repeat
wait(1000);
until(not progressScreen.isOpen());
end;
end;
end;
begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
fletchLogs;
{repeat
chopDownTree;
until (not isLoggedIn() or tabBackpack.isFull())}
end.
Ran into a few bugs today, when writing the fletchLogs function I ran into an issue where I was dependent on the logs always being in whichever slot was hardcoded. Instead I decided to use DTMs which I remember reading about in The Mayors tutorial, so I went back to the tutorial and incorporated it into my script to find the logs.
This allows a log to be anywhere in the inventory and it will still find it/fletch it.
Fletching is working as expected, tying it together is going to be a bit harder though. I can't call fletchLogs from chopDownTree and the other way around pretty sure that's because of the order I have written the procedures, won't help changing it.
Thinking about placing fletching on top of chopDownTree, then inside chopDownTree running a check if the inventory is full, then if it is will find the log dtm, fletch the logs whilst waiting until there is no change in the inventory. Do another check if the inventory is full then start chopping.
Not sure if that is the most efficent way though.