Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function RockCount(Debug, Clear:Boolean):Integer;
- var
- A,I,L,R,X,Y:Integer;
- OrePts,RockPts,TPA:TPointArray;
- RockPtsBox: T2DPointArray;
- SearchBox: TBox;
- Begin
- If Not(LoggedIn) Then Exit;
- If OreInLast Then Exit;
- {Rock Points}
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.04, 1.27);
- FindColorsSpiralTolerance(MSCX, MSCY, RockPts, 1461093, MSX1, MSY1, MSX2, MSY2, 10);
- SetColorSpeed2Modifiers(0.2,0.2);
- ColorToleranceSpeed(1);
- {Rock Points}
- {ATPA Rocks}
- RockPtsBox := TPAtoATPAEx(RockPts,36,36);
- {ATPA Rocks}
- L := High(RockPtsBox);
- For I := 0 To L Do
- Begin
- If (GetArrayLength(RockPtsBox[I]) > 30) Then
- Begin
- SearchBox := GetTPABounds(RockPtsBox[I]);
- with SearchBox do
- begin
- {Ore Color Within RockBox}
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(1.39,0.11);
- FindColorsSpiralTolerance(MSCX,MSCY,OrePts,2434854,SearchBox.x1,SearchBox.y1,SearchBox.x2,SearchBox.y2,10);
- SetColorSpeed2Modifiers(0.2,0.2);
- ColorToleranceSpeed(1);
- {Ore Color Within RockBox}
- If Length(OrePts) > 1 Then
- Begin
- Inc(R);
- SetArrayLength(TPA, (Length(TPA)+1));
- MiddleTPAEx(OrePts, X, Y);
- TPA[A] := Point(X, Y);
- Inc(A);
- If Clear Then
- SMART_ClearCanvasArea( PointToBox( Point(MSX1-1, MSY1), Point(MSX2, MSY2+2) ) );
- End;
- end;
- end;
- end;
- Result := R;
- If Debug Then
- Begin
- //'TPA' now contains the middle of each rock containing ore, so let's split these into an ATPA for debugging :)
- SMART_DrawDotsMulti(False, (TPAtoATPAEx(TPA, 36,36)));
- SMART_DrawText(MSX1+175, MSY1, CharsNPC, 'There are ~' + IntToStr(Result) + ' rocks with ore!', clWhite);
- //Or 'There are '+Length(TPA)+' rocks with ore!'
- End;
- end;
Add Comment
Please, Sign In to add comment