Wrappers

The Wrappers include contains wrapper functions used throughout SRL. These functions should be put inside Simba itself, and will be removed from SRL when that is done.

The source for this file can be found here.

getColor: overload;

function getColor(var p: TPoint): integer; overload;

Takes a TPoint variable instead of x, y variables.

Note

  • by Ollybest

Example:

p := point(350, 200);
int := getColor(p);

getColors: overload;

function getColors(tpa: TPointArray; clearSame: boolean): TIntegerArray; overload;

Takes an extra parameter, clearSame if true will clear the same integers in the result.

Note

  • by Ollybest

Example:

intArr := getColors(myTPA, true);

findColor: overload;

function findColor(var x, y: integer; col: integer; searchBox: TBox): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Coh3n

Example:

FindColor(x, y, cl_White, mainScreen.getBounds());

findColorTolerance: overload;

findColorTolerance(var x, y: integer; color: integer; searchBox: TBox; tolerance: integer): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

findColorTolerance(x, y, 255, b, 10);

findColors: overload;

findColors(var points : TPointArray; const color : Integer; const searchBox: TBox): Boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Coh3n

Example:

FindColors(TPA, cl_White, MSBox);

findColorsTolerance: overload;

findColorsTolerance(var points : TPointArray; const color : Integer; const searchBox: TBox; const tolerance : Integer): Boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Zyt3x

Example:

FindColorsTolerance(TPA, clWhite, mainScreen.getBounds(), 10);

findColorSpiral: overload;

function findColorSpiral(var x, y: integer; color: integer; searchBox: TBox): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

findColorSpiral(x, y, clRed, box);

findColorSpiralTolerance: overload;

function findColorSpiralTolerance(var x, y: integer; color: integer; searchBox: TBox; tol: integer): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Coh3n

Example:

findColorSpiral(x, y, clRed, box);

findColorsSpiralTolerance: overload;

findColorsSpiralTolerance(var x, y: integer; var points: tpointarray; color: integer; searchBox: TBox; tolerance: integer): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

findColorsSpiralTolerance(x, y, TPA, clWhite, mainScreen.GetBounds, 10);

countColor: overload;

countColor(Color: integer; searchBox: TBox): integer; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Coh3n

Example:

CountColor(clWhite, mainscreen.getBounds);

CountColorTolerance: overload;

function countColorTolerance(Color: integer; searchBox: TBox; tol: integer): Boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Coh3n

Example:

CountColorTolerance(clWhite, 10, mainscreen.getBounds);

freeDTMs

procedure freeDTMs(DTMs: TIntegerArray);

Free’s an array of DTMs.

Note

  • by Olly

Example:

freeDTMs([dtm1, dtm2]);

freeBitmaps

procedure freeBitmaps(bitmaps: TIntegerArray);

Free’s an array of bitmaps.

Note

  • by Olly

Example:

freeBitmaps([bmp1, bmp2]);

getBitmapName

function getBitmapName(index: integer): string;

Returns the name of the bitmap stored in ‘index’.

Note

  • by Olly

Example:

n := getBitmapName(bmpOre);

getDTMName

function getDTMName(index: integer): string;

Returns the name of the dtm stored in ‘index’.

Note

  • by Olly

Example:

n := getDTMName(dtmOre);

bitmapFromClient: overload;

function bitmapFromClient(searchBox: TBox): integer; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

bmp := bitmapFromClient(box);

findBitmapIn: overload;

function findBitmapIn(bmp: integer; var x, y: integer; searchBox: TBox): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

result := findBitmap(bmp, x, y, mainScreen.bounds);

findBitmapTolerance

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

Searches the whole client for a bitmap with tolerance.

Note

  • by Ollybest

Example:

result := findBitmapTolerance(bmp, x, y, 50);

findBitmapToleranceIn: overload;

function findBitmapToleranceIn(bmp: integer; var x, y: integer; searchBox: TBox; tolerance: integer): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

result := findBitmapToleranceIn(bmp, x, y, mainScreen.bounds, 20);

findBitmapMaskTolerance: overload;

function findBitmapMaskTolerance(mask: integer; var p: TPoint; searchBox: TBox; tol, contourTol: integer): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Coh3n

Example:

result := findBitmapMaskTolerance(s, p, mainscreen.bounds, 30, 30);

findDeformedBitmapToleranceIn: overload;

function findDeformedBitmapToleranceIn(bmp: integer; var x, y: integer; searchBox: TBox; tolerance: integer; range: integer; allowPartialAccuracy: boolean; var accuracy: extended): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

if findDeformedBitmapToleranceIn(bmp, x, y, mainscreen.getBounds, 10, 0, true, acc) then
  writeln('we found the bitmap at accuracy: ' floatToStr(acc));

findDTMRotatedSE: overload;

findDTMRotatedSE(dtm: integer; var x, y: integer; searchBox: TBox; sangle, eangle, astep, afound: extended): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

if findDTMRotatedSE(aDTM, x, y, mainscreen.getBounds, -Pi/4, Pi/4, Pi/60, aFound) then
  writeln('found the dtm!');

FindDTMRotatedAlternating: overload;

function findDTMRotatedAlternating(dtm: integer; var x, y: integer; searchBox: TBox; sangle, eangle, astep, afound: extended): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

if findDTMRotatedAlternating(aDTM, x, y, mainscreen.getBounds, -Pi/4, Pi/4, Pi/60, aFound) then
  writeln('found the dtm!');

findDTMRotated

function findDTMRotated(dtm: integer; var x, y: integer; x1, y1, x2, y2: integer; sAngle, eAngle, aStep: extended; out aFound: extended): boolean;

Wrapper for findDTMRotatedAlternating (commonly used in SRL5).

Note

  • by Ollybest

Example:

if FindDTMRotated(aDTM, x, y, 100, 100, 400, 400, -Pi/4, Pi/4, Pi/60, aFound) then
  writeln('found the dtm!');

findDTMRotated: overload;

function findDTMRotated(DTM: Integer; var x, y: integer; searchBox: TBox; sAngle, eAngle, aStep: extended; out aFound: extended): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

if FindDTMRotated(aDTM, x, y, mainscreen.getBounds, -Pi/4, Pi/4, Pi/60, aFound) then
  writeln('found the dtm!');

findDTMs: overload;

function findDTMs(dtm: integer; var tpa: tpointarray; searchBox: TBox): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

findDTMs(theDTM, tpa, mainscreen.getBounds);
result := length(tpa) > 0;

findDTM: overload;

function findDTM(dtm: integer; var x, y: integer; searchBox: TBox): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

if findDTM(theDTM, x, y, mainscreen.getBounds) then
  writeln('we found the dtm!');

getTextAtEx: overload;

function getTextAtEx(const searchBox: TBox; minvspacing, maxvspacing, hspacing, color, tolerance: integer; const font: string): string; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

writeln(getTextAtEx(box, 0, 0, 3, clRed, 5, 'statChars'));

getTextAtEx: overload;

function getTextAtEx(const xs, ys, xe, ye: integer; const minVSpacing, maxVSpacing, hSpacing, col, tol: integer; const font: string; const extract: strExtr): string; overload;

Overloaded function, Takes an extra paramter “extract” which deterimes what to extract from the string, vaild extracts are “Numbers”, “Letters” and “Others”.

Note

  • by Olly

Example:

writeln(getTextAtEx(100, 100, 200, 200, 0, 0, 3, clRed, 5, 'statChars', Numbers));

getTextAtEx: overload;

function getTextAtEx(const searchBox: TBox; const minVSpacing, maxVSpacing, hSpacing, col, tol: integer; const font: string; const extract: strExtr): string; overload;

Overloaded function, Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

  • by Olly

Example:

writeln(getTextAtEx(box, 0, 0, 3, clRed, 5, 'statChars', Numbers));

getTextATPA: overload;

function getTextATPA(const atpa: T2DPointArray; const maxVSpacing: integer; const font: string; const extract: strExtr): string; overload;

Overloaded function, Takes an extra paramter “extract” which deterimes what to extract from the string, vaild extracts are “Numbers”, “Letters” and “Others”.

Note

  • by Olly

Example:

writeln(getTextATPA(atpa, 5, StatChars, Numbers));

tpaFromText: overload;

function tpaFromText(const text, font: string): TPointArray; overload;

Creates a tpa from text without the need for the W and H parameters.

Note

  • by Ollybest

Example:

tpa := tpaFromText('this is my text tpa', 'statChars');

replicate: overload;

function replicate(const str : String; const times : Integer): String; overload;

Used to replicate any string, as opposed to the former replicate() that replicates chars.

Note

  • by Zyt3x

Example:

writeLn(replicate('SRL', 10));

explode: overload;

function explode(const del : TStringArray; str : String): TStringArray; overload;

Explodes a string into a TStringArray, takes an array of delimiters instead of one.

Note

  • by Zyt3x

Example:

S := '1 2,3.4,5--6,7.8,9 0';
sArr := explode([' ', ',', '.', '--'], S);
// sArr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]

inRange: overload;

function inRange(const value, min, max: extended): boolean; overload;

Takes a extended variable instead of an integer variable.

Note

  • by Ollybest

Example:

if inRange(33.90, 30.0, 35.0) then
  writeln('it''s in range');

distance: overload;

function distance(pnt1, pnt2: TPoint): integer; overload;

Accepts two TPoints instead of x1, y1, x2 and y2 variables.

Note

  • by Ollybest

Example:

dist := distance(point(100, 100), point(200, 200));

getClientBounds

function getClientBounds(): TBox;

Returns the clients bounds.

Note

  • by Olly

Example:

b := getClientBounds();