P1ng
2012-08-29 03:07:36
Well I'd like to remove a TPA from a TBox or remove a TBox from a TBox and have this result as a new TBox.
I'm checking rocks immediately next to me for their ore vein colour but occassionally it will include my player in this box, I want to be able to remove the TBox of my player from this area to search.
I thought splitting the TPA into 25x25 sections would stop it selecting the player, not sure why this isn't working
Related function:
I'm checking rocks immediately next to me for their ore vein colour but occassionally it will include my player in this box, I want to be able to remove the TBox of my player from this area to search.
I thought splitting the TPA into 25x25 sections would stop it selecting the player, not sure why this isn't working
Related function:
function IsOre: Boolean;
var
x, y, CTS: Integer;
RockTPA, Player: TPointArray;
Rock: T2DPointArray;
OreBox: TBox;
begin
Player := TPAFromBox(IntToBox(MSCx - 15, MSCy - 20, MSCx + 15, MSCy + 20));
// box around the player ^
CTS := GetColorToleranceSpeed; //< sets up for finding lighter rock colour
ColorToleranceSpeed(2); //<
SetColorSpeed2Modifiers(0.03, 0.72);//<
if FindColorsSpiralTolerance(x, y, RockTPA, 3759724, MSX1, MSY1, MSX2, MSY2, 14) then
begin //finds lighter rock colour ^
ClearTPAFromTPA(RockTPA, Player); //removes player from tpa
SortTPAFrom(RockTPA, IntToPoint(MSCx, MSCy)); //sorts points from closes to you
Rock := TPAToATPAEx(RockTPA, 25, 25); //splits into aTPA 25 by 25
OreBox := GetTPABounds(Rock[0]); //area to search for ore vein
SMART_DrawBoxEx(True, False, OreBox, ClGreen); //pretty box
SetColorSpeed2Modifiers(2.50, 0.28);//sets for ore searh
Result := FindColorTolerance(x, y, 2369061, OreBox.x1, OreBox.y1, OreBox.x2, OreBox.y2, 10);
end; //results true if ^ colour is found
SetColorSpeed2Modifiers(0.2, 0.2); //resets colour modifiers
end;