View Full Version : function IsTextAtTPA
Raskolnikov
02-22-2008, 04:59 PM
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
02-22-2008, 05:06 PM
I like FindText functions, i uderstand them lol. Nice function with TPAs, im trying to learn them. :D
Raskolnikov
02-22-2008, 05:14 PM
lol thanks btw!
Cut em2 it
mastaraymond
02-22-2008, 05:26 PM
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
02-22-2008, 05:28 PM
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
02-22-2008, 05:31 PM
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
02-22-2008, 05:36 PM
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
02-22-2008, 05:38 PM
I agree Raymond. Look at FindTalk, super speed :D
Cut em2 it
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.