Athylus
2014-06-26 17:35:33
Hey all! I've made a script here before if someone remembers (must've been a year ago or so) and I decided to get back in the game. So I'm giving this all a go again and noticed that reflection is working pretty well right now. But the includes need to be updated or so it says in the debug bog, so I'm trying to make some color only scripts.
Right now I am making a wood chopper, and first it would move the mouse and click a lot. So I searched up for some animating stuff and after some hard work I got the pixelshift to work, so now it only chooses the chop down option when I am idle below 400 pixels in half a second. However after chopping it has to find a tree, but the tree stump is left after chopping one down which has the same color as the regular tree trunks. So it will often shoot from trunk to trunk till it finds a tree. How do I go about fixing this?
Right now I am making a wood chopper, and first it would move the mouse and click a lot. So I searched up for some animating stuff and after some hard work I got the pixelshift to work, so now it only chooses the chop down option when I am idle below 400 pixels in half a second. However after chopping it has to find a tree, but the tree stump is left after chopping one down which has the same color as the regular tree trunks. So it will often shoot from trunk to trunk till it finds a tree. How do I go about fixing this?
program new;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Active := true;
end;
end;
function TreeColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.05, 0.44);
if not (FindColorsTolerance(arP, 5735072, MSX1, MSY1, MSX2, MSY2, 18)) 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
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;
//Use this function to get average pixels
function AnimatingCheck: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 295, 195);
WriteLn(IntToStr(AveragePixelShift(PBox, 250, 500)));
end;
function Chopping: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 295, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 400);
end;
procedure ChopTree;
var
x, y: Integer;
begin
if not Chopping then
begin
if FindObj(x, y, 'hop do', TreeColor, 5) then
begin
WriteLn('Tree found');
Mouse(x, y, 5, 5, false);
ChooseOption('Chop down');
Wait(1200 + random(450));
end;
end else
WriteLn('Chopping...');
Wait(1000);
end;
begin
SetupSRL;
//SetupReflection;
DeclarePlayers;
LoginPlayer;
(*repeat
AnimatingCheck;
until(False);*)
repeat
ChopTree;
until(false);
end.