PDA

View Full Version : Help with Chopper!



Amsterdamn
10-22-2012, 11:44 PM
Hi. I've made countless scripts using simba for a private server. However I'm having trouble with my woodcutting + firemaking one. I can't figure out how to make it detect if you have a full inventory of logs, so i can stop chopping and just start burning them. Any ideas on how?

Here is the script...

program Chopperd;
{$i SRL/SRL.simba}

const
Tree = 4287091;

var
x, y:Integer;

Procedure Choppyss;
begin
if (FindColorSpiralTolerance (x, y, Tree, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
Mouse (x, y, 5, 5, true);
wait (20000);
end;
begin
if (FindColorSpiralTolerance (x, y, Tree, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
Mouse (x, y, 5, 5, true);
wait (20000);
end;
begin
if (FindColorSpiralTolerance (x, y, Tree, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
Mouse (x, y, 5, 5, true);
wait (20000);
end;
begin
if (FindColorSpiralTolerance (x, y, Tree, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
Mouse (x, y, 5, 5, true);
wait (20000);
end;
begin
if (FindColorSpiralTolerance (x, y, Tree, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
Mouse (x, y, 5, 5, true);
wait (20000);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
begin
Mouse (724, 443, 0, 0, true);
wait (100);
Mouse (684, 442, 0, 0, true);
wait (100);
end;
end;
end;
end;
end;
end;

Procedure main;
begin
repeat
Choppyss;
until(IsKeyDown (114)); //Press f3 to stop
end;

begin
ClearDebug;
SetUpSrl;
SRL_EnableNavBar; // Added for offset for new navbar at the top, otherwise it will get the wrong coordinates
ActivateClient;
main;
end.

Olly
10-23-2012, 12:25 AM
hmm for a private server... what you wanna do is get a full invent of logs then get the length using this

writeln(inttostr(countcolortolerance(log colour,cords,cords,cords,cords,tolerance)

then lets say the length of a full invent of logs was 3000 make it like 2900

and then make a function such as

function inventfull:boolean;
begin
result := countcolortolerance(log colour,cords,cords,cords,cords,tolerance) > 3000; (the length we got above)
end;

riwu
10-23-2012, 12:36 AM
imo it's pointless to make 1 liner functions (unless it is used as wrapper to remove param for WaitFunc etc). You can just detect color on the last slot i think, since the last slot won't be filled until all the other slots are filled. Also you have whole trunk of repetitive code that could be simplified 10 times. Go read up about loops ;)

Olly
10-23-2012, 02:53 AM
imo it's pointless to make 1 liner functions (unless it is used as wrapper to remove param for WaitFunc etc). You can just detect color on the last slot i think, since the last slot won't be filled until all the other slots are filled. Also you have whole trunk of repetitive code that could be simplified 10 times. Go read up about loops ;)

Mhmmm do that ^
didn't come across my mind haha.

Amsterdamn
10-24-2012, 08:28 AM
Thanks guys, got it too work! but for the loop thing, have to keep learning stuff about it, just tried it and i failed! :( But other than that, the script works perfect, thank you :D

riwu
10-24-2012, 08:52 AM
Thanks guys, got it too work! but for the loop thing, have to keep learning stuff about it, just tried it and i failed! :( But other than that, the script works perfect, thank you :D
Loops are one of the first thing you should learn, it will save you countless sweats :p

You can try to just learn the most easy loop:
repeat
//actions
until Conditions;

Contrary to popular belief, the effects of all other loops (for..to..do, while..do) can be achieved with this most basic type of loop too. They are easier to use in many cases once you mastered them though.

Take it slowly though, as long as you are learning, you are making progress towards a great scripter ;)