JuKKa
2007-09-11 10:05:04
LOL this is my second function i updated, This time i made it a little less code and also my opinnion better here let me explain:
With mine you can use it at the mining guild, Stronghold and any other black areas without returning TRUE!
The old "InBlack" checked with "GetColor" it could return true in most black areas.
But with mine you use "FindColorsTolerance" to search for the black color "0" and then it will return in percent how much black there is on the MM, And if it returns over the insterted number it will then result True.
Of course mine might be 0-15 msec slower but its alot more relieable (When using in places with a black minimap)
As u can see the old one has ALOT of code when mine is 1/3 of that.
heres mine:
Shortly how to use:
Function InBlackInPut(Percent: Integer): Boolean;
You insert a percent (integer) when it finds more black (in percent) it will return true!
20-30 is a good number.
And i would be honoured if this would be added in the SRL 4!
Who was it that loved to see when function get reduced by XX amount of lines?
With mine you can use it at the mining guild, Stronghold and any other black areas without returning TRUE!
The old "InBlack" checked with "GetColor" it could return true in most black areas.
But with mine you use "FindColorsTolerance" to search for the black color "0" and then it will return in percent how much black there is on the MM, And if it returns over the insterted number it will then result True.
Of course mine might be 0-15 msec slower but its alot more relieable (When using in places with a black minimap)
function InBlack: Boolean; // random detector. Checks for 4 black dots in MM.
begin
if (GetColor(650, 155) = 0) then
begin
if ((GetColor(650, 145) = 0) and
(GetColor(650, 135) = 0) and
(GetColor(650, 125) = 0)) then
begin
Result := True;
Exit;
end
else
Result := False;
end
if (GetColor(650, 15) = 0) then
begin
if ((GetColor(650, 25) = 0) and
(GetColor(650, 35) = 0) and
(GetColor(650, 45) = 0)) then
begin
Result := True;
Exit;
end
else
Result := False;
end
if (GetColor(580, 82) = 0) then
begin
if ((GetColor(590, 82) = 0) and
(GetColor(600, 82) = 0) and
(GetColor(610, 82) = 0)) then
begin
Result := True;
Exit;
end
else
Result := False;
end
if (GetColor(714, 82) = 0) then
begin
if ((GetColor(704, 82) = 0) and
(GetColor(694, 82) = 0) and
(GetColor(684, 82) = 0)) then
begin
Result := True;
Exit;
end
else
Result := False;
end
end;
As u can see the old one has ALOT of code when mine is 1/3 of that.
heres mine:
Function InBlackInPut(AtPercent: Integer): Boolean;
Var
Black: TPointArray;
Percent, AllColors, BlackColors: Integer;
Begin
FindColorsTolerance(Black, 0, MMX1, MMY1, MMX2, MMY2, 0);
BlackColors:= GetArrayLength(Black);
AllColors := BlackColors + 26565;
Percent:= (BlackColors * 100) / AllColors;
If(Percent >= AtPercent)Then
Result:= True;
End;
Shortly how to use:
Function InBlackInPut(Percent: Integer): Boolean;
You insert a percent (integer) when it finds more black (in percent) it will return true!
20-30 is a good number.
And i would be honoured if this would be added in the SRL 4!
Who was it that loved to see when function get reduced by XX amount of lines?