Claymore
2011-12-31 15:34:51
function isChopping: Boolean; //Not functional, player tends to hide under tree leaves >,>
var
i: Integer;
b: TBox;
begin
b := IntToBox(MSCX - 20, MSCY - 25, MSCX + 15, MSCY + 20);
Smart_DrawBox(b);
i := AveragePixelShift(b, 150, 450);
if (i > 400) or (i < 200) then //still doesnt work. Hiding under leaves has the same change in pixel as idling.
begin
WriteLn('[CUTTING] Change in pixel over .15s = ' + IntToStr(i));
Result := True;
end else
WriteLn('[IDLE] Change in pixel over .15s = ' + IntToStr(i));
if i < 50 then //When player is completely invisible from the screen, it will give you less than 50.
begin
WriteLn('[ERROR] False readings!');
Result := False;
end;
end;
Alright I am currently working on a Yew cutter and i wanted to experiment with animation. So far it was working well until the player started to get around different places around the tree.
The problem with that is the change in pixel will change and be about the same as idling making it difficult to tell if the player is idling.
So anyone know a good idea to get around this?
Also i wanted to experiment on "tracking the colors" of the point i found using FindObj. So when it finds the Yew Tree, how can i follow the colors so than i can tell if the yew is cut down when those colors are gone. I tried simply rewriting my FindObj.
function FindObjColors(Colors, Tol: TIntegerArray; Hue, Sat: TExtendedArray; UpText: TStringArray; Width, Height, minLength, x1, y1, x2, y2: Integer; leftClick: Boolean): Boolean;
var
CTS, t ,i, x, y, h: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
MarkTime(t);
MakeCompass('N');
SetAngle(True);
repeat
SetArrayLength(ATPA, Length(Colors));
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
for i := 0 to High(Colors) do
begin
SetColorSpeed2Modifiers(Hue[i], Sat[i]);
FindColorsSpiralTolerance(MSCX, MSCY, ATPA[i], Colors[i], x1, y1, x2, y2, Tol[i]);
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
TPA := MergeATPA(ATPA);
ATPA := TPAtoATPAEx(TPA, Width, Height);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
if Length(ATPA) = 0 then
Exit;
DebugATPABounds(ATPA);
h := High(ATPA);
for i := 0 to h do
begin
if Length(ATPA[i]) < minLength then
Continue;
WriteLn('[FIND] Length = ' + IntToStr(Length(ATPA[i])));
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
Wait(RandomRange(250, 350));
If IsUpTextMultiCustom(UpText) then
begin
GetMousePos(x, y);
case leftClick of
True:
begin
ClickMouse2(True);
Result := DidRedClick;
end;
False:
begin
Mouse(x, y, 0, 0, False);
Result := True;
end;
end;
end else
WriteLn('[ERROR] UpTexts not found.');
if Result then
begin
WriteLn('[Result] Length = ' + IntToStr(Length(ATPA[i])));
Exit;
end;
end;
if TimeFromMark(t) > 5000 then
Exit;
until(Result);
end;
This is my FindObj function.
Help would be appreciated :P ATM i use up text to see if the tree is down. Its good but the whole point of my script is to experiment.