Color

The color type holds all the functions and types that can be used for easy color finding, comparing or manupilation.

The source for this file can be found here.

type TColorSettings

A record that provides easy access to the Simba CTS settings.

colorSetting

function colorSetting(_CTS:Integer): TColorSettings;

Creates and returns a colorSetting record with the given CTS method.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

if(findColorTolerance(x, y, $FF0000, MSX1, MSY1, MSX2, MSY2, 10, colorSetting(0))) then

colorSetting

function colorSetting(_CTS:Integer): TColorSettings;

Creates and returns a colorSetting record with the given CTS method and the CTS 2 modifiers.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

if(findColorTolerance(x, y, $DACE11, MSX1, MSY1, MSX2, MSY2, 10, colorSetting(2, 0.20, 0.80))) then

colorSetting

function colorSetting(_CTS:Integer): TColorSettings;

Creates and returns a colorSetting record with the given CTS method and the CTS 3 modifier.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

if(findColorTolerance(x, y, $DACE11, MSX1, MSY1, MSX2, MSY2, 10, colorSetting(2, 10))) then

TColorSettings.create

procedure TColorSettings.create(_CTS: Integer; _hueModifier, _saturationModifier: Extended);

Creates and colorSetting record with the given CTS method and the CTS 2 modifiers.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

goblinCS.create(2, 0.45. 0.90);
if(findColorTolerance(x, y, $DACE11, MSX1, MSY1, MSX2, MSY2, 10, goblinCS)) then

TColorSettings.create

procedure TColorSettings.create(_CTS: Integer; _sensitivityModifier: Extended);

Creates and ColorSetting record with the given CTS method and the CTS 3 modifier.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

chickenCS.create(3, 20);
if(findColorTolerance(x, y, $FFFFFF, MSX1, MSY1, MSX2, MSY2, 15, chickenCS)) then

TColorSettings.retrieve

procedure TColorSettings.retrieve();

Gets the current CTS settings used by simba, and stores them into the record.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

restoreCS.retrieve();
SetColorToleranceSpeed(5);
a := findColorTolerance(x, y, 5811341, MSX1, MSY1, MSX2, MSY2, 10);
restoreCS.apply();

TColorSettings.retrieve

procedure TColorSettings.apply();

Applies the CTS settings from the record to the simba client.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

goblinCS.apply();
if (findColorTolerance(x, y, 5811341, MSX1, MSY1, MSX2, MSY2, 10)) then

findColorTolerance; overload;

function findColorTolerance(var x, y: Integer; color: integer; searchBox: TBox; tol: Integer; settings: TColorSettings): Boolean; overload;

Calls the simba find function with an additional color settings parameter. Sets and restores the CTS settings.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

goblinCS.apply();
if (findColorTolerance(x, y, 5811341, MSX1, MSY1, MSX2, MSY2, 10)) then

findColorsTolerance; overload;

function findColorsTolerance(var points: TPointArray; color: integer; searchBox: TBox; tol: Integer; settings: TColorSettings): Boolean; overload;

Calls the simba find function with an additional color settings parameter. Sets and restores the CTS settings.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

goblinCS.apply();
if (findColorsTolerance(tpa, 5811341, MSX1, MSY1, MSX2, MSY2, 10)) then

findColorSpiralTolerance; overload;

function findColorSpiralTolerance(var x, y: Integer; color: integer; searchBox: TBox; tol: Integer; settings: TColorSettings): Boolean; overload;

Calls the simba find function with an additional color settings parameter. Sets and restores the CTS settings.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

goblinCS.apply();
if (findColorSpiralTolerance(x, y, 5811341, MSX1, MSY1, MSX2, MSY2, 10)) then

findColorsSpiralTolerance; overload;

function findColorsSpiralTolerance(x, y: Integer; var points: TPointArray; color: integer; searchBox: TBox; tol: Integer; settings: TColorSettings): Boolean; overload;

Calls the simba find function with an additional color settings parameter. Sets and restores the CTS settings.

Note

  • by Janilabo
  • Last Updated: 20 April 2013 by Janilabo

Example:

goblinCS.apply();
if (findColorsSpiralTolerance(x, y, tpa, 5811341, MSX1, MSY1, MSX2, MSY2, 10)) then

countColorTolerance; overload;

function countColorTolerance(color: integer; searchBox: TBox; tol: Integer; settings: TColorSettings): integer; overload;

Calls Simba’s countColorTolerance with an additional color settings parameter.

Note

  • by Janilabo
  • Last Updated: 30 May 2013 by Coh3n

Example:

if (countColorTolerance(color, mainscreen.getBounds(), tol, demonCS) > 20) then

findBitmapTolerance; overload;

function findBitmapTolerance(const bmp: integer; var x, y: integer; const tolerance: integer; settings: TColorSettings): boolean; overload;

Calls findBitmapTolerance with an additional color settings parameter.

Note

  • by Olly
  • Last Updated: 19 May 2014 by Olly

Example:

waitColorCountRange

function waitColorCountRange(color, tol: integer; area: TBox; waitTime, minCount: integer; maxCount: integer = maxInt): boolean;

Counts the color until waitTime is reached, if the color count is within range of minCount and maxCount will exit and result true, by default maxCount is set to maxInt, but can be changed.

Note

  • by Ollybest
  • Last Updated: 31 May 2013 by Ollybest

Example:

// would wait until the color count is between 50..150 or until 2000ms has passed.
waitColorRange(clBlack, 5, mainScreen.getBounds(), 2000, 50, 150);

// would wait until the color count is over 50, or until 5000ms has passed.
waitColorRange(clBlack, 5, mainScreen.getBounds(), 5000, 50);

waitColorCountRange: overload;

function waitColorCountRange(color, tol: integer; area: TBox; waitTime, minCount: integer; maxCount: integer = maxInt): boolean;

Same as waitColorCountRange but with an additional color settings parameter.

Note

  • by Ollybest
  • Last Updated: 31 May 2013 by Ollybest

Example:

waitColorRange(clBlack, 5, myCSSettings, mainScreen.getBounds(), 2000, 50, 150);

type TColorData

A record that stores the colors, tolerances, and modifiers of a color

var col: TColorData;

begin

col.color := 1501044; col.tolerance := 50; col.settings.cts := 2; col.settings.modifier.hue := 1.11; col.settings.modifier.sat := 0.05;

writeln(col);

end;

type T2DColorData

A record that stores the colors, tolerances, and modifiers of an array of color

var cols: T2DColorData;

begin

setLength(cols, 2);

cols[0].color := 255; cols[0].settings.modifier.hue := 0.00; cols[0].settings.modifier.sat := 1.12;

cols[1].color := 144455; cols[1].tolerance := 50; cols[1].settings.cts := 1;

writeln(cols);

end.

T2DColorData.gatherIn

function T2DColorData.gatherIn(var tpa: TPointArray; xs, ys, xe, ye: integer): boolean;

Gathers the colors in the T2DColorData in the area xs, ys, xe, ye and merges all into the TPointArray ‘tpa’.

Note

  • by Olly
  • Last Updated: 22 January 2014 by Olly

Example:

if (cols.gatherIn(tpa, 100, 100, 200, 200)) then
  writeln('woo');

T2DColorData.gatherIn; overload

function T2DColorData.gatherIn(var tpa: TPointArray; searchArea: TBox): boolean; overload;

Overloaded function, accepts a TBox parameter rather than xs, ys, xe, ye paramters.

Note

  • by Olly
  • Last Updated: 22 January 2014 by Olly

Example:

if (cols.gatherIn(tpa, mainScreen.getBounds())) then
  writeln('woo');

TColorData.gatherIn

function TColorData.gatherIn(var tpa: TPointArray; xs, ys, xe, ye: integer): boolean;

Gathers the TColorData in the area xs, ys, xe, ye.

Note

  • by Olly
  • Last Updated: 22 January 2014 by Olly

Example:

if (cols.gatherIn(tpa, 100, 100, 200, 200)) then
  writeln('woo');

TColorData.gatherIn; overload

function TColorData.gatherIn(var tpa: TPointArray; area: TBox): boolean; overload;

Overloaded function accepts a TBox parameter rather than xs, ys, xe, ye parameters.

Note

  • by Olly
  • Last Updated: 22 January 2014 by Olly

Example:

if (cols.gatherIn(tpa, 100, 100, 200, 200)) then
  writeln('woo');

TColorData.waitCount

function TColorData.waitCount(area: TBox; waitTime, minCount: integer): boolean;

Counts the color until waitTime is reached, if the color count is higher then minCount will exit and result true.

Note

  • by Thomas
  • Last Updated: 9 October by Thomas

Example:

// would wait until the color count is over 50 or until 2000ms has passed.
TColorData.waitCount(mainScreen.getBounds(), 2000, 50);

T2DColorData.waitCount

function T2DColorData.waitCount(area: TBox; waitTime, minCount: integer): boolean;

Counts the color until waitTime is reached, if the color count is higher then minCount will exit and result true.

Note

  • by Thomas
  • Last Updated: 9 October by Thomas

Example:

// would wait until the color count is over 50 or until 2000ms has passed.
T2DColorData.waitCount(mainScreen.getBounds(), 2000, 50);

getCTS2Color

function getCTS2Color(cols: TIntegerArray): TColorData;

Returns a CTS2 color as a TColorData type, from a TIntegerArray input of individual colors.

Note

  • by The Mayor, based on ACA code
  • Last Updated: 12 August 2015 by The Mayor

Example:

var
  objCol: TColorData;
  TPA: TPointArray;
begin
  objCol := getCTS2Color([14067346, 15838606, 16170148, 16368555]);

  if objCol.gatherIn(TPA, mainScreen.getBounds()) then
  begin
    // etc
  end;
end;