This is, i guess, my first, finished function.
Special thanks to StarBlaster100 for helping me with tarrays
It will find the first color, but if it doesn't find that, it will find the next color.
Im not really sure what it is usefull for, but watever lol. I dont think it has already been created...
Tell me if you like it! I might make some more functions to help my fellow scripters, in the future!
here it is:
SCAR Code:
////////////////////\\\\\\\\\\\\\\\\\\\\\
///////////Find Color Priority\\\\\\\\\\\\\
//////////All Credit to Macrosoft\\\\\\\\\\\\
//Please do NOT copy without giving me credit\\
//Special Thanks to StarBlaster100 for his help\\
{***********************************************************************************************
Function FindColorPriority(var x, y: Integer; Colors: TIntegerArray; Tolerance: Integer; xs, ys, xe, ye: LongInt): Integer;
Example of use: FindColorPriority(x, y, [22023, 0000], 5, 12, 34, 67, 34)
By: Macrosoft
Description: Will find a color, if the color is not found it will move
to the next color. If it returns 0, it found none of the colors,
otherwise it will return the color number (1,2,3,4,5,6, etc.; not 29849283749, 230920432984, etc.)
It Will also return the x and y coords of the color
I may make more priority Functions such as DoFunctionPriority,
FindObjectPriority, etc.
Tell me if you like it! Also, notify me for me improvements and errors.
Make sure you include SRL
********************************************************************************************************}
{.include SRL/SRL.scar}
Function FindColorPriority(var x, y: Integer; Colors: TIntegerArray; Tolerance: Integer; xs, ys, xe, ye: LongInt): Integer;
var
Counter: Integer;
begin
GetArrayLength(Colors);
Counter:=0
repeat
begin
if(FindColorTolerance(x, y, Colors[Counter], xs, ys, xe, ye, Tolerance)=True) then
begin
Result:= Counter + 1;
Exit;
end else
Counter:=Counter +1;
end;
until(GetArrayLength(Colors)=Counter);
begin
if(GetArrayLength(Colors)=Counter) then
Result:=0
end;
end;