LordJashin
2012-02-28 18:58:45
Basically changed FindText to allow searching for multiple fonts. Very useful for things outside of runescape. As for RS I have absolutely no idea. As for TIME WISE this is very good. For 3 fonts it only took like 1 second. Well here it is, pretty obvious stuff. If any improvements can be made let me know, even if this is denied because I'm definitely keeping this.
What This DOES: Searches for 'Text', with font 1 if it finds it then we are done, if not keeps going. Tries to find text with font 2, etc, ,etc
You need to download the attachment that has the fontset in order to test this. OR change MyFontSet in fonts TStringArray to something else, for instance: SmallCharacters or NPCChars or sumthin
Code used to test this:
What This DOES: Searches for 'Text', with font 1 if it finds it then we are done, if not keeps going. Tries to find text with font 2, etc, ,etc
You need to download the attachment that has the fontset in order to test this. OR change MyFontSet in fonts TStringArray to something else, for instance: SmallCharacters or NPCChars or sumthin
function FindTextAll(var cx, cy: Integer; txt: String; fonts: TStringArray; xs, ys, xe, ye:
Integer): Boolean;
var
S, i: Integer;
begin
for i := 0 to High(fonts) do
begin
S := CreateBitmapMaskFromText(txt, ToStr(fonts[i]));
if (xs < 0) then xs := 0;
if (ys < 0) then ys := 0;
Result := FindBitmapMaskTolerance(S, cx, cy, xs, ys, xe, ye, 30, 30);
FreeBitmap(S);
end;
end; Code used to test this:
var
w, h: Integer;
fonts: TStringArray;
begin
fonts := [FriendChars, LoginChars, MyFontSet]; // MyFontSet is a font set I made that has the bitmaps for the Simba taskbar title
SetDesktopAsClient;
GetClientDimensions(w, h);
if FindTextAll(x, y, 'Simba', fonts, 0, 0, w - 1, h - 1) then
WriteLn('HakunaMatata!');
WriteLn('TimeRunning In MS: ' + (ToStr(GetTimeRunning)));
end.