SRL Archive - RS3 Outdated / Broken Scripts

Eduard's Draynor Chopper - ATPA custom object Based


Eduard

2013-01-01 23:44:39



One of the most advanced draynor willow chopper/banker!
Current status: Stable and almost flawless!
Latest update: 04-01-2013 at 22:02 GMT+1

Known issues
Currently none!


Current functions
  • Version checker/downloader
  • Map walking through SPS
  • Smart paint debugging
  • ACA based color system for autocoloring tree finding
  • Live updated smart paint progress report
  • Live all user stats updater
  • ATPA to TBox tree finding function
  • Anti-ban
  • Login Handler
  • Failsafes for walking

Next update function(s) update(s)
  • More efficient human like mouse functions
  • Requirement checker
  • Teleporting and relocation using SPS and lodestone teleport failsafes
  • Form(?)




program EduardsWillowChopper;
{$Define SMART8}
{$include SRL/SRL.simba}
{$include SPS/SPS.simba}
{$include SRL/SRL/Misc/SmartGraphics.simba}

var
StartXP, TreeAttempts, UserStatsLogsChopped, UserStatsXPgain: integer;
TimeInMinutes: string;
XpPerHour: Extended;

const
CurrentVersion = '22';
Update = 'on';
SD = 'on';
MSDB = 'on';

TextDebug = true;

WillowCol = 2569268;
WillowSat = 0.43;
WillowHue = 0.48;
WillowTol = 7;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := true;
end;
end;

function VersionChecker: string;
var
MyHttpClient: integer;
begin
MyHttpClient := InitializeHttpClient(true, false);
result := GetHTTPPage(MyHttpClient, 'http://pastebin.com/raw.php?i=anP5DPNF');
FreeHTTPClient(MyHttpClient);
end;

function DownloadNewVersion: boolean;
var
UpdatedFile, MyHttpClient: integer;
UpdatePath, UpdatedFileString: string;
begin
result := false;
UpdatePath := (AppPath + 'Scripts\' + 'EduardDraynorCutter' + VersionChecker + '.simba');
UpdatedFile := RewriteFile(UpdatePath, false);
MyHttpClient := InitializeHttpClient(true, false);
UpdatedFileString := GetHTTPPage(MyHttpClient, 'http://pastebin.com/raw.php?i=2ns6BWHT');
if (WriteFileString(UpdatedFile, UpdatedFileString)) then
result := true;
FreeHTTPClient(MyHttpClient);
CloseFile(UpdatedFile);
end;

procedure PaintDebug(Txt: string);
var
ClearBox: Tbox;
begin
if (SD = 'on') then
begin
ClearBox.x1 := 350;
ClearBox.X2 := 525;
ClearBox.Y1 := 75;
ClearBox.Y2 := 130;
SMART_ClearCanvas;
Smart_DrawText(375, 26, 'FriendChars', 'Eduard Willow Chopper V1', clWhite);
Smart_DrawText(375, 41, 'FriendChars', txt, ClYellow);
if (TextDebug) then
writeln(txt);
end
end;

function SendData: Boolean;
var
i: integer;
begin
i := InitializeHTTPClientWrap(False);
writeln('Time ran:' + IntToStr(GetTimeRunning / 1000));
writeln('XP Gained:' + IntToSTr(UserStatsXpGain));
writeln('Logs chopped:' + IntToStr(UserStatsLogsChopped));
AddPostVariable(i, 'time', IntToStr(GetTimeRunning / 1000));
AddPostVariable(i, 'xp', IntToStr(UserStatsXpGain));
AddPostVariable(i, 'logs', IntToStr(UserStatsLogsChopped));
Result := Pos('true', Lowercase(PostHTTPPageEx(i, 'draynorcuttereduard.hostei.com/update.php'))) <> 0;
FreeHTTPClient(i);
end;

procedure PaintDebugProgress;
var
CharBox: Tbox;
TimeRan, LogsChopped, XpGain, XpBar: integer;
begin
CharBox.x1 := 375;
CharBox.X2 := 500;
CharBox.Y1 := 105;
CharBox.Y2 := 220;
Smart_ClearCanvasArea(CharBox);
XpBar := GetXpBarTotal;
XpGain := XpBar - StartXp;
LogsChopped := XpGain / 67;
UserStatsLogsChopped := LogsChopped;
UserStatsXPgain := XpGain;
Smart_DrawText(375, 56, 'FriendChars', ('XP Gain ' + inttostr(XpGain)), Clpurple);
Smart_DrawText(375, 71, 'FriendChars', ('Logs Chopped ' + inttostr(LogsChopped)), Clred);
if (LogsChopped > 0) then
begin
TimeRan := GetTimeRunning;
XpPerHour := ((TimeRan / XpGain) * 360);
TimeInMinutes := MsToTime(TimeRan, Time_Abbrev);
Smart_DrawText(375, 86, 'FriendChars', ('Xp per hour ' + floattostr(XpPerHour) + 'xp'), ClWhite);
Smart_DrawText(375, 101, 'FriendChars', (TimeInMinutes), Clgreen);
end;
end;

function WillowAutoColorMS: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(WillowHue, WillowSat);
FindColorsSpiralTolerance(MSCX, MSCY, arP, WillowCol, MSX1, MSY1, MSX2, MSY2, WillowTol);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 1.31) and (X <= 5.40) and (Y >= 1.50) and (Y <= 5.97) and (Z >= 1.07) and (Z <= 4.37) then
begin
Result := arC[i];
PaintDebug('Willow tree color ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function Antiban: boolean;
begin
case Random(500) of
1:
begin
PaintDebug('Antiban hovering woodcutting');
HoverSkill('woodcutting', False);
end;
2:
begin
PaintDebug('Antiban hovering random skill');
HoverSkill('random', False);
end;
3:
begin
PaintDebug('Antiban Bored human');
Boredhuman;
end;
4:
begin
PaintDebug('Antiban waiting random 2 to 7 seconds');
Wait(2500 + random(4500));
end;
5:
begin
PaintDebug('Antiban picking up mouse');
PickUpMouse;
end;
6:
begin
PaintDebug('Antiban RandomMovement');
RandomMovement;
end;
7:
begin
PaintDebug('Antiban RandomRClick');
RandomRClick;
end;
end;
result := false;
end;

function WaitLoggedIn(Time: Integer): Boolean;
var
T: Integer;
begin
MarkTime(T);
repeat
SRL_ResetNavBar;
if TimeFromMark(T) > Time then
begin
Result := False;
Exit;
end;
until (GetColor(472, 490) = 16777215);
result := True;
end;

function StillCutting: boolean;
var
CharBox: Tbox;
PixelShiftMS: integer;
begin
CharBox.x1 := 240;
CharBox.X2 := 280;
CharBox.Y1 := 140;
CharBox.Y2 := 200;
PixelShiftMS := AveragePixelShift(CharBox, 200, 500);
if (PixelShiftMS > 150) then
begin
PaintDebugProgress;
AntiBan;
result := true;
end
else
result := false;
end;

function StillRunning: boolean;
var
CharBox: Tbox;
iShift: integer;
begin
CharBox.x1 := 240;
CharBox.X2 := 275;
CharBox.Y1 := 140;
CharBox.Y2 := 190;
iShift := AveragePixelShift(CharBox, 200, 500);
if (Ishift > 200) then
result := true;
result := false
end;

procedure WalkToBank;
var
WillowsToBank: TPointArray;
begin
WillowsToBank := [Point(4148, 3672), Point(4132, 3646), Point(4136, 3627), Point(4140, 3613), Point(4158, 3609), Point(4164, 3627)];
SPS_WalkPath(WillowsToBank);
end;

procedure WalkToWillows;
var
BankToWillows: TPointArray;
begin
BankToWillows := [Point(4172, 3628), Point(4157, 3610), Point(4141, 3613), Point(4136, 3634), Point(4141, 3667)];
SPS_WalkPath(BankToWillows);
end;

procedure FindBanker;
var
Attempts: integer;
begin
if (not (LoggedIn)) then
Exit;
repeat
if (OpenBankFast('db')) then
begin
if (Bankscreen) then
begin
DepositAll;
CloseBank;
Wait(200 + random(200));
Exit;
end
else
begin
PaintDebug('Bankscreen failed!');
Exit;
end;
end
else
begin
PaintDebug('OpenBankFast failed!');
inc(Attempts);
end;
until (Attempts > 4) if (Attempts > 4) then
begin
Exit;
PaintDebug('failed opening bank, walking to bank again.');
end;
Exit;
end;

procedure CutTree;
var
MiddleBoxTP: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
ATPABox: Tbox;
x, y, i: integer;
begin
if (FindColorsSpiralTolerance(x, y, TPA, WillowAutoColorMS, MSX1, MSY1, MSX2, MSY2, WillowTol)) then
begin
TPAtoATPAExWrap(TPA, 25, 25, ATPA);
SortATPASize(ATPA, true);
for i := 0 to High(ATPA) do
begin
ATPABox := GetTPABounds(ATPA[i]);
MiddleBoxTP := MiddleBox(ATPABox);
if (MSDB = 'on') then
begin
Smart_DrawBoxEx(false, false, ATPABox, ClPurple);
Smart_DrawDotsMulti(False, ATPA);
end;
MMouse(MiddleBoxTP.x, MiddleBoxTP.y, 0, 0);
Wait(400 + random(100));
PaintDebug('Finding tree');
inc(TreeAttempts);
if (TreeAttempts > 6) then
begin
PaintDebug('Cant find tree walking back to Willow spot');
WalkToWillows;
TreeAttempts := 0;
Exit;
end;
if (WaitUpText('illow', 30)) then
begin
Mouse(MiddleBoxTP.x, MiddleBoxTP.y, 0, 0, 1);
Wait(300 + random(200));
PaintDebug('Cutting tree');
TreeAttempts := 0;
while StillCutting do
begin
Wait(20);
end;
Exit;
end;
end;
end;
end;

procedure BankInventory;
begin
PaintDebug('Inventory is full');
WalkToBank;
FindBanker;
Wait(500 + random(500));
if Bankscreen then
begin
DepositAll;
CloseBank;
end;
Wait(350 + random(200));
end;

procedure UpdateScript;
begin
if (Update = 'on') then
begin
writeln('Current version: ' + (CurrentVersion) + '.');
if (CurrentVersion <> VersionChecker) then
begin
if (VersionChecker <> '') then
begin
writeln('Newest version: ' + (VersionChecker) + '');
if (DownloadNewVersion) then
begin
writeln('Succesfully downloaded newest version, its located in your script path. Please open this version!');
TerminateScript;
end
else
begin
writeln('Could not download newest version, this is a filewriting error! Please check your file access!');
TerminateScript;
end;
end
else
begin
writeln('Newest version: Unavailable, please check the forums or disable updater');
TerminateScript;
end;
end
else
writeln('You have the newest version');
end;
end;

procedure Setup;
begin
{$IFDEF SIMBAMAJOR980}
SMART_SERVER := 10;
SMART_MEMBERS := TRUE;
SMART_SIGNED := TRUE;
SMART_SUPERDETAIL := FALSE;
{$ELSE}
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
{$ENDIF}
ClearDebug;
UpdateScript;
SPS_Setup(RUNESCAPE_SURFACE, ['10_8', '10_9']);
SetupSRL;
DeclarePlayers;
Smart_ClearCanvas;
SetRun(true);
StartXp := GetXpBarTotal;
LoadSRLFonts;
ClickNorth(SRL_ANGLE_HIGH);
Gametab(tab_inv);
Smart_DrawText(200, 14, 'FriendChars', 'Eduard Willow Chopper V1', clWhite);
end;

procedure MainLoop;
begin
if not WaitLoggedIn(1000) then
LoginPlayer;
PaintDebugProgress;
FindNormalRandoms;
if (InvFull) then
begin
BankInventory;
WalkToWillows;
end;
CutTree;
end;

begin
Setup;
repeat
if (not (LoggedIn)) then
LoginPlayer;
MainLoop;
AddOnTerminate('SendData');
until (false)
end.



F.A.Q



Q: 'When I run the script it sets itselp up North and then randomly clicks somewhere on the screen!'
A: 'Setup new ACA color's in the const section. Please search for ACA for more information. Building in more advanced auto coloring methods later.'

Q: 'The scripts works great but somehow I ended up at X location after a while..'
A: 'Please wait till I release a newer more stable version with more failsafes'



Latest progress reports for stability checking


Stability test version 2.2
Date: 05-01-2013



Update Log:


01/01/2013 - Version 1.0
Update note: First release


02/01/2013 - Version 1.2
Update note: Added:
  • Anti ban
  • Failsafe bank minimap
  • Improved StillRunning(); procedure
  • More debug report stats
  • 6 hour login
  • Login handler
  • Script updater



03/01/2013 - Version 1.3
Updates:
  • Completely rewritten script skeleton
  • Should now have good failsafes
  • Actual good autocoloring methods
  • should be running nearly flawless

Pod

2013-01-02 00:00:52



Looks awesome, I'll be using this thanks. :)

~Pod
This is an automated message to automate my automated signature.
Thanks to IsoMorphic for the signature.

Eduard

2013-01-02 00:03:47

It's not stable yet. I would suggest trying this out while babysitting it. A fully stable version will come out this week. Becoming the best written Woodcutter for simba ever.

Pod

2013-01-02 00:08:20



Ok awesome, although I've noticed something already. It sometimes after a while has dificulties finding the trees, any ideas?

~Pod
This is an automated message to automate my automated signature.
Thanks to IsoMorphic for the signature.

Eduard

2013-01-02 00:11:39

Depends, has it trouble finding the tree's on the minimap or on the mainscreen? It's probably not fine-tuned autocoloring.
Will add that later :)

Pod

2013-01-02 00:13:42

From: Eduard
Depends, has it trouble finding the tree's on the minimap or on the mainscreen? It's probably not fine-tuned autocoloring.
Will add that later :)




On the minimap, ok awesome. May I ask what tuts you've been looking at? :)

~Pod
This is an automated message to automate my automated signature.
Thanks to IsoMorphic for the signature.

Eduard

2013-01-02 00:19:06

I've been looking through all the advanced/intermitent and beginner guides. I've also been quite experienced with programming that's why I pick it up quite fast.

Pod

2013-01-02 00:19:58

From: Eduard
I've been looking through all the advanced/intermitent and beginner guides. I've also been quite experienced with programming that's why I pick it up quite fast.




Ok thanks, I'm not very good at programing but willing to learn. Any tips? :p

~Pod
This is an automated message to automate my automated signature.
Thanks to IsoMorphic for the signature.

Eduard

2013-01-02 00:21:26

Yeah, just read the tutorial about what you want to learn. Then without looking at the tutorial try make a script with the functions you just learn.

It will be frustrating, you will be tempted to look at the tutorial again. But if you do this, you'll eventually have the 'aha' moment and it's easy.

Pod

2013-01-02 00:22:29

From: Eduard
Yeah, just read the tutorial about what you want to learn. Then without looking at the tutorial try make a script with the functions you just learn.

It will be frustrating, you will be tempted to look at the tutorial again. But if you do this, you'll eventually have the 'aha' moment and it's easy.




Ok thanks, time to get scripting! :p

~Pod
This is an automated message to automate my automated signature.
Thanks to IsoMorphic for the signature.

TheBrish

2013-01-06 14:44:13

[Error] C:\Simba\Includes\SRL/SRL/misc/SmartParams.Simba(281:149): Invalid number of parameters at line 280
Compiling failed.

Eduard

2013-01-06 22:46:51

From: TheBrish
[Error] C:\Simba\Includes\SRL/SRL/misc/SmartParams.Simba(281:149): Invalid number of parameters at line 280
Compiling failed.


install smart 8.0 (look at the s.m.a.r.t. section of the forum)

ghks204

2013-01-07 15:25:33

thank you so much for your work but i'm very sorry i'm a noob,, when i copy and paste your script, it all fits in line 1, so i had to copy and paste line by line.. and i get this error.
ERROR comes from a non-existing file (C:\Simba\Eduard's Draynor Chopper.simba)
[Error] C:\Simba\Eduard's Draynor Chopper.simba(16:3): Semicolon (';') Compiling failed. expected at line 15
please help……

Eduard

2013-01-08 17:51:50

From: ghks204
thank you so much for your work but i'm very sorry i'm a noob,, when i copy and paste your script, it all fits in line 1, so i had to copy and paste line by line.. and i get this error.
ERROR comes from a non-existing file (C:\Simba\Eduard's Draynor Chopper.simba)
[Error] C:\Simba\Eduard's Draynor Chopper.simba(16:3): Semicolon (';') Compiling failed. expected at line 15
please help……


I will help you out. Go to: http://pastebin.com/raw.php?i=2ns6BWHT

Then copy/paste in simba. Pm/post here to get some help :)

ghks204

2013-01-09 08:50:49

thanks you are very kind :) but looks like I got the problem that's mentioned on your FAQ How do I set up ACA color? There is no serching result of ACA on this forum :s :google:

brycehazen

2013-01-16 03:18:52

[Error] C:\Simba\Includes\SRL/SRL/core/globals.simba(696:5): Unknown identifier 'ImageSetClientArea' at line 695
Compiling failed.

thesis

2013-01-18 21:50:54


IROC-Z

2013-01-21 00:57:57

Is there a way to get this to work with skillers so it doesn't deposit my hatchet?

eenad

2013-01-23 00:01:06

Eduard hope you can help me out…Is there a particular place i should be standing when i start this script. Currently I tried standing next to the willows in Draynor, when i start the script. It cuts the willows but when he gets full inventory he doesn't bank. Instead it goes here http://imgur.com/Ye587YM

I tried starting in Draynor Bank, but he immediately goes to the same spot shown in the pic above.

Any help would be appreciated. I really need a Willow chopper/banker, and so far this is the only one that even starts without any compiling errors.

Thanks in advanced.

Yawsun

2013-04-27 04:45:01

How to fix this: '[Error] C:\Simba\Includes\SRL-OSR/SRL/core/flag.simba(96:20): Unknown identifier 'bmpMinimapMask' at line 95
Compiling failed.' I know it's probably anti-leech but please someone help me I am trying to get this working many hours now :(
You can add me on skype if you'd like that 'wfs_thierry'

Many Thanks

Solar

2013-05-05 10:25:51

Edited the script so that it drops the logs instead of banking since it wasn't working too well for me. Getting around 35-40k xp per hr.
I think it seemed to be buggy because I was using in F2P and it was so crowded.
One thing that I don't like about the script though, is that it will already be cutting a tree and then will try to find a tree to cut, despite already chopping. Nonetheless, it's a nice script, and I like the colours that appear when it looks for trees. :D
Thanks.

bullnyetho

2013-05-15 16:43:46

Error: Exception: Access violation at line 78
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Options Bitmap, 5]

new here and have no idea what this means…

AnonymousUser

2013-06-01 11:34:15

Possible add Hatchet in first inventory within the next update?

Peanuts

2013-06-01 12:24:53

From: bullnyetho
Error: Exception: Access violation at line 78
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Options Bitmap, 5]

new here and have no idea what this means…


It says you had an error on line 78.. ( it wouldve highlighted the line )
You need to paste the line also..
If you paste the code thn we can help with the problem.

n just ignore the 'The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Options Bitmap, 5]'
part.

toxjq

2013-06-02 01:51:28

very nice and clean code. quite easy to understand. I will play around with it trying to get it to chop oaks =)
could you explain this a little.

ColorToXYZ(arC, X, Y, Z);
if (X >= 1.31) and (X <= 5.40) and (Y >= 1.50) and (Y <= 5.97) and (Z >= 1.07) and (Z <= 4.37) then
begin
Result := arC;

I get what its doing, but how do you pick the values for X, Y , Z (so X, Y, Z are the plane coordinates right? or were you lazy to write RGB?).
So how did you pick this values?

thanks
Update:
Got this bot to chop oaks for me at draynor. Having few issues the paint is not working properly, and the mouse random move is kinda weird.
Also there it stops sometime and doesn't click anything. It stays around the oak tree and just moves is mouse around and doesn't click.
any idea what i should look into to fix this?