Simba 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;