SRL Archive - Research & Development Lounge

function IsTextAtTPA


Raskolnikov

2008-02-22 11:59:29

Hi, I wanted to make my own version of is text at, but, using TPAs. I don't like the FindText functions, they confuse me :confused:

Anyways, here it is.

function IsTextAtTPA(Text: string; x1, x2, x3, x4: integer; color, tolerance: integer): boolean;
var TextTPA, TextColorTPA, Matches: TPointArray;
begin
TextTPA := CreateTPAFromText(Text, Length(Text));
FindColorsTolerance(TextColorTPA, color, x1, x2, x3, x4, tolerance);
Result := FindTPAinTPA(TextColorTPA, TextTPA, Matches);
end;

Edit: I have a new function:

function IsInChatTPA(Text: string): boolean;
var TextTPA, ColorTextTPA, Matches: TPointArray;
begin
TextTPA := CreateTPAFromText(Text, Length(Text));
FindColorsSpiralTolerance(MCCX, MCCY, ColorTextTPA, 16711680, MCX1, MCY1, MCX2, MCY2, 5);
Result := FindTPAinTPA(ColorTextTPA, TextTPA, Matches);
end;

Thanks,
Cut em2 it

Cazax

2008-02-22 12:06:09

I like FindText functions, i uderstand them lol. Nice function with TPAs, im trying to learn them. :D

Raskolnikov

2008-02-22 12:14:12

lol thanks btw!

Cut em2 it

mastaraymond

2008-02-22 12:26:48

There is one in SRL, its different.. Called something like FindTextTPA or something like that..

It uses a different version of FindTPAInTPA, since that doesn't work with stuff like . , etc..

EDIT:

{*******************************************************************************
Function FindTextTpa(Color,Tol,xs,ys,xe,ye : integer; Txt : string; Chars : Integer; Action : (ClickLeft,ClickRight,Move,Nothing)) : Boolean;
By: Raymond
Description: Uses TPA's to find text.. In action you can put what you want to do after its found..
Nothing - Just return wether its found
Move - Just move the mouse to it
Clickleft - Movemouse & Clickmouse left
Clickright - MoveMouse & Clickmouse right
*******************************************************************************}

Negaal

2008-02-22 12:28:41

Actually I got question whats wrong with SRL's findtext, but yours is nice aswell:)

But, you could remove few lines:)

function IsTextAtTPA(Text: string; x1, x2, x3, x4: integer; color, tolerance: integer): boolean;
var
ThatLength: integer;
TextTPA, TextColorTPA, Matches: TPointArray;
begin
ThatLength := Length(Text);
TextTPA := CreateTPAFromText(Text, ThatLength);
FindColorsTolerance(TextColorTPA, color, x1, x2, x3, x4, tolerance);
Result := FindTPAinTPA(TextColorTPA, TextTPA, Matches)
end;

Nice anyways…

Raskolnikov

2008-02-22 12:31:59

Thanks, for everyone's input. Mastaraymond, I wasn't aware of that function, thanks :D

Cut em2 it

@ Negaal - It uses like different spacing booleans and strict and chars, it doesn't make much sense to me at all…

mastaraymond

2008-02-22 12:36:40

From: Negaal
Actually I got question whats wrong with SRL's findtext, but yours is nice aswell:)

But, you could remove few lines:)

function IsTextAtTPA(Text: string; x1, x2, x3, x4: integer; color, tolerance: integer): boolean;
var
ThatLength: integer;
TextTPA, TextColorTPA, Matches: TPointArray;
begin
ThatLength := Length(Text);
TextTPA := CreateTPAFromText(Text, ThatLength);
FindColorsTolerance(TextColorTPA, color, x1, x2, x3, x4, tolerance);
Result := FindTPAinTPA(TextColorTPA, TextTPA, Matches)
end;

Nice anyways…


TPA Text finding is way faster :rolleyes:

Raskolnikov

2008-02-22 12:38:44

I agree Raymond. Look at FindTalk, super speed :D

Cut em2 it