SRL Archive - OSR Help

Need Woodcutting Stump Detection Help


h4x0rdafuq

2012-10-02 20:58:23

Hey well basically i am making a script to test out my server's bot detection i am currently writing and would like to test out the stability of my woodcutting base and implement a bot detection. I have coded a simple color bot to detect the magic tree color and click it. I have then tried adding a full inventory detection as the until(invFull) would not work for an RSPS. I also added a stump detection so that for obvious reasons I can know when to look for the tree again. all being well I cannot for the life of me get the stump detection to work properly. It could possibly be because the color pixel is so small but i wouldn't expect that to happen because i can still see the pixels with my eyes. the tree and stump and inventory detection is here:


procedure ChopTree;
begin
repeat
if FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2, TreeColourTolerance) then
begin
writeln('Chopping magic tree...');
Mouse (x ,y ,0 , 0, True);
end;
repeat
Wait(1000);
writeln('Waiting...');
Until (FindColorSpiralTolerance(x, y, StumpColour, TreeX1, TreeY1, TreeX2, TreeY2, StumpColourTolerance)
or (FindColorSpiralTolerance (x, y, 3029313, 653, 438, 669, 449, 20)) = False)
writeln('Stump Detected, Waiting for magic tree');
wait(3000);
until not(FindColorSpiralTolerance(x, y, 3029313, 653, 438, 669, 449, 20)); //the color code is the color of the last slot in inventory and is covered by logs
Writeln('Inventory full, Walking to bank.');
end;

Will this work or am I doing something wrong because it is beginning to get on my nerves and i wish to put my detection to the test as i have the developers waiting for me to make a script to test it. Thank you SO much in advance!

Also, I forgot to add that upon start up i get the message "Chopping Magic Tree…" then the bot clicks the magic tree then i get the message "waiting…" on a loop and once the tree falls down I continue to get the message "Waiting…".

___

2012-10-02 22:03:24

I put some comments in.


procedure ChopTree;
// ALWAYS DECLARE X AND Y LOCALLY! I added it for you.
var
x,y: integer;
begin
repeat
if FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2, TreeColourTolerance) then
begin
writeln('Chopping magic tree...');
Mouse (x ,y ,0 , 0, True); // Add some randomness... it could help you to both avoid bot detection and click the tree
// What you could also do is:
Mouse(x,y,2,2,False);
Clickmouse2(False);
Chooseoption('hop');
end;
repeat
Wait(1000); // I would change this to 100 or less.
writeln('Waiting...');
Until (FindColorSpiralTolerance(x, y, StumpColour, TreeX1, TreeY1, TreeX2, TreeY2, StumpColourTolerance)
or (FindColorSpiralTolerance (x, y, 3029313, 653, 438, 669, 449, 20)) = False)
writeln('Stump Detected, Waiting for magic tree');
// So if I read this right, you are saying that you will wait for a stump basically forever?
wait(3000); //Again, a bit long in terms of wating
until not(FindColorSpiralTolerance(x, y, 3029313, 653, 438, 669, 449, 20)); //the color code is the color of the last slot in inventory and is covered by logs
//So it waits until the last slot of the inventory is full? Even when they are waiting for the stump?
Writeln('Inventory full, Walking to bank.');
end;

You are getting the error because you say that when you click on the tree, spam "waiting" every 3 seconds until you find a stump- which after that will continue to wait for even longer.

Trying to help

EDIT: This is all from memory, so it may be incorrect.

EDIT2: I'll try to rewrite this to my liking using your code… with no compiler help so it may not work. :$


procedure ChopTree;
var
x,y: integer;

begin
repeat
if FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2, TreeColourTolerance) then
begin
Mouse (x ,y ,2 , 3, False);
Clickmouse2(False);
ChooseOption('hop');
if (didredclick) then writeln('We are chopping a magic tree');
end;
repeat
Wait(100);
if (FindColorSpiralTolerance(x, y, StumpColour, TreeX1, TreeY1, TreeX2, TreeY2, StumpColourTolerance)
or (FindColorSpiralTolerance (x, y, 3029313, 653, 438, 669, 449, 20)) = False)
wait(3000);
until(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2, TreeColourTolerance));
Writeln('There is a new magic tree for us to cut');
until(invfull);
end;

Sort of doesn't make sense, but I think its on to something. This isn't the coding format I regularly use (TPA's <3) and I did the best with what I had. Good start on your own script though!

h4x0rdafuq

2012-10-03 09:21:39

Hey thanks alot for replying, sorry for not replying sooner. Thank you for adding the comments to my script i will work on them as the second script you posted isn't compatible with Rune Scape Private Servers (invFull would be so helpful if it worksd D:..). So i will work around your comments :) Also where you added "Add some randomness" there is actually already some randomness to the original copy of my script but i took it out to test if my bot detection can detect the simplest of bots then i shall add randomness back in to tweak up my detection. :) i will post my results after i have taken my fiancee to the cinema.

Oh and the x and Y are declared in the beginning of the script this is simply a section :)

___

2012-10-03 15:58:02

From: h4x0rdafuq

Oh and the x and Y are declared in the beginning of the script this is simply a section :)


X and Y should be declared within a procedure or function.. globally declared could be bad if you wanted to record an integer as x or y.

h4x0rdafuq

2012-10-03 16:07:02

From: ___
X and Y should be declared within a procedure or function.. globally declared could be bad if you wanted to record an integer as x or y.


ohhh okay, i am going to start typing to get this to work, also where you said if it the inventory is full it starts again, well there's actually a banking script after this i just didn't add it to the snipplet. If you have skype I would be grateful if you could give me some help every so often when I get stuck. Thanks

___

2012-10-03 17:24:46

From: h4x0rdafuq
ohhh okay, i am going to start typing to get this to work, also where you said if it the inventory is full it starts again, well there's actually a banking script after this i just didn't add it to the snipplet. If you have skype I would be grateful if you could give me some help every so often when I get stuck. Thanks


I don't have skype, maybe you should PM a Member- after all, they did show enough skill to become a member.

h4x0rdafuq

2012-10-03 17:39:29

I decided to re-write this section. Here's my current clip
 procedure ChopTree;
begin
repeat
if FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2, TreeColourTolerance) then
begin
writeln('Found Magic Tree.');
Mouse (x ,y ,0 , 0, True);
end;
repeat
until not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2, TreeColourTolerance))
writeln('Waiting for tree');
wait(3000);
until not(FindColorSpiralTolerance(x, y, 3029313, 715, 450, 725, 460, 20));
Writeln('Full inventory, Going to bank.');
end;
This basically finds the color of a magic tree's white sparkly bits (back in 2006 graphics) this then clicks the tree ONCE until it can no longer find the color of the magic tree. It waits 3000ms until it checks for it again. If the inventory is full AND the tree is down, the script will continue on to banking.

So my problem is… If i am the only person botting, and i have a full inventory… I cannot continue to bank until the tree has fallen down… so it will keep clicking the tree because it see's the color but it will never fall down because of the current inventory is full and cannot continue to woodcut.

Basically at the part where it says "until not" find the color of the tree, there also needs to be an inventory check..

I tried adding
       or (FindColorSpiralTolerance (x, y, 3029313, 715, 450, 725, 460, 20)) = False)
so that it will continue to bank after the inventory is full EVEN IF the tree is not fallen and will look like this.

procedure ChopTree;
begin
repeat
if FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2, TreeColourTolerance) then
begin
writeln('Found Magic Tree.');
Mouse (x ,y ,0 , 0, True);
end;
repeat
until not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2, TreeColourTolerance))
or (FindColorSpiralTolerance (x, y, 3029313, 715, 450, 725, 460, 20)) = False) //added this or but is broken
writeln('Waiting for tree');
wait(3000);
until not(FindColorSpiralTolerance(x, y, 3029313, 715, 450, 725, 460, 20));
Writeln('Full inventory, Going to bank.');
end;

only problem is, i cannot get the "or" statement to work :/ i get the error:

[Error] (28:85): Identifier expected at line 27
Compiling failed.
which is at the line where the or statement is. Please could you tell me what i am missing out here

___

2012-10-03 18:25:02

Is there a certain message that appears when you have a full inventory?

h4x0rdafuq

2012-10-03 18:40:39

Literally EVERYTHING in my script works now, i have implemented banking, I have a check to see if the tree is there or not and i have a check to see if the inventory is full BUT the inventory checker will only trigger if the tree isnt there, this is because the loop starts at clicking the tree then checking if the tree's gone. It will keep doing this until the tree is gone but if i am the only person botting trees then the tree will never go because i have a full inventory. I need to make it so that it basically asks its self "Is the tree color not there? and/or is your inventory full? well then move on to banking" in layman's terms.

h4x0rdafuq

2012-10-03 18:51:03

WOOHOO!!! i fixed it!!! i basically added

or not(FindColorSpiralTolerance (x, y, 3029313, 702, 418, 710, 428, 20))

Again, Thank you very much for the help earlier. Finally completed my script and am currently botting magic logs, not to detect myself >:)