Runehack123
2013-01-21 13:04:16
Trying to get my script to find logs on lumbridge castle top floor using MMtoMS then creating TBox and then TPA/ATPA colour finding.
Maybe it's just me, but my method just fails…
And I don't understand why! I've tried doubling my tolerance from 15 to 30..even used 50, but it's doing things I don't want it to do. Tried changing the TBox..larger, smaller values. No idea what's going on, but it's just not working how I was hoping it would.
Any advice on how to improve my code and object finding would be really appreciated.
Here is a picture of the results I got using ACA tool on my last try when the mouse just moved towards the fire seen in the picture?!?!?!?!? How is that even possible! That fire has no red dot on MM:
http://i.imgur.com/2NGomWs.jpg
My code:
Maybe it's just me, but my method just fails…
And I don't understand why! I've tried doubling my tolerance from 15 to 30..even used 50, but it's doing things I don't want it to do. Tried changing the TBox..larger, smaller values. No idea what's going on, but it's just not working how I was hoping it would.
Any advice on how to improve my code and object finding would be really appreciated.
Here is a picture of the results I got using ACA tool on my last try when the mouse just moved towards the fire seen in the picture?!?!?!?!? How is that even possible! That fire has no red dot on MM:
http://i.imgur.com/2NGomWs.jpg
My code:
Function FindFloorItems: Boolean;
Var
ItemBox: TBox;
LogColours, RDots: TPointArray;
ATPA: T2DPointArray;
i, H, ii, HH, CTS: Integer;
MSItem, ItemPoint: TPoint;
Begin
Result := False;
RDots := GetMMDotsOnMS('r');
If (Length(RDots) < 1) Then
Begin
If Debug Then
Writeln('FindFloorItems - No red dots found on MM.');
Exit;
End;
SortTPAFrom(RDots, Point(MMCX, MMCY));
H := High(RDots);
For i := 0 To H Do
Begin
ItemPoint := MMtoMS(RDots[i]); //Pass all points of RDots to MMtoMS and assign to TPoints
If (ItemPoint.x = -1) And (ItemPoint.y = -1) Then
Continue;
With ItemPoint Do
ItemBox := IntToBox(Max(X - 20, MSX1), Max(Y - 20, MSY1), Min(X + 30, MSX2), Min(Y + 14, MSY2)); //Create TBox around item
End;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.23, 0.70);
FindColorsTolerance(LogColours, 2967378, ItemBox.X1, ItemBox.Y1, ItemBox.X2, ItemBox.Y2, 30);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
ATPA := SplitTPAEx(LogColours, 10, 5);
SortATPASize(ATPA, True);
If (Length(LogColours) < 1) Then
Begin
If Debug Then
Writeln('Logs on floor colours not found.');
Exit;
End;
SetLength(RDots,0);
HH := High(ATPA);
for ii := 0 to HH do
begin
MSItem := MiddleTPA(ATPA[ii]);
MMouse(MSItem.X, MSItem.Y, 0, 0);
If WaitUpTextMulti(['Take', 'ke Lo','Logs'], 200) then
Begin
ClickMouse2(False);
If OptionsExist(['se Fi','ine F','Fire'], False) Then
Begin
If Debug Then
Writeln('Found Use Fire Examine Fire option');
If ChooseOptionMulti(['Use F','se Fir']) Then
If Debug Then
Writeln('Found ChooseOption light logs');
Result:= True;
Break;
End
Else
If ChooseOptionMulti(['ight L','t Log','Light']) Then
If Debug Then
Writeln('Found ChooseOption light logs');
Result:= True;
Break;
End;
End;
SetLength(ATPA,0);
SetLength(LogColours,0);
End;