Log in

View Full Version : Finding Non-Runescape Font Text



Lance
02-28-2011, 04:11 AM
I'd like to write a bot which is able to read text from an application I'm using, I would only need the numbers 0 - 9 and the period. Are there any tutorials on how to create your own scar font, load it, and search for it?

I've been googling around but I can't find anything useful. I haven't touched scar for a long time, so it would be nice if it was a very simple and easy to understand tutorial.

KingKong
02-28-2011, 04:17 AM
This should help: http://villavu.com/forum/showthread.php?t=60451

Lance
02-28-2011, 04:39 AM
I don't know how to use simba, I only know and want to use scar :P

Feroc1ty
02-28-2011, 04:51 AM
Simba is the exact same thing... You're not writing for the specific application, you're writing in "Pascal Script."

Lance
02-28-2011, 05:21 AM
Well read through that tutorial, I already figured out how to make the font images. I just need to know how to load that font and search for text in that font. I have:


Font := LoadChars2('C:\Program Files\SCAR 3.22\Fonts\PokerChars');
FindText(x, y, '5', Font, 0, 0, 800, 800);


It's not finding the 5. (5 is the only .bmp file I've created so far)

Zyt3x
02-28-2011, 07:26 AM
Did you name it 53.bmp or 5.bmp?

Lance
02-28-2011, 05:13 PM
Did you name it 53.bmp or 5.bmp?

It's 53.bmp. If my code is right then maybe I haven't made the .bmp file right..

Zyt3x
02-28-2011, 05:37 PM
Post a picture of the '5' please? Both the one from the application and the one you made :)

Lance
02-28-2011, 07:47 PM
Post a picture of the '5' please? Both the one from the application and the one you made :)

I deleted the 5 by mistake, but I made a zero:

http://img36.imageshack.us/i/81720407.jpg/

http://img835.imageshack.us/i/47551479.png/

48.bmp into "C:\Program Files\SCAR 3.22\Fonts\PokerChars\"

And this is my program


program New;
{.include YPP/YPP.scar}

function FindText(var cx, cy: Integer; txt: string; font, xs, ys, xe, ye: Integer): Boolean; //by Stupid3ooo
var
S: Integer;
begin
S := CreateBitmapMaskFromText(txt, font);
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;

var
x, y, Font : Integer;
begin
ActivateClient();
SetupYPP();
Font := LoadChars2('C:\Program Files\SCAR 3.22\Fonts\PokerChars\');
FindText(x, y, '0', Font, 0, 0, 500, 500);
Writeln(IntToStr(x) + ', ' + IntToStr(y));
end.

Zyt3x
02-28-2011, 07:53 PM
Please host it on tinypic or imageshack or something :)

Lance
02-28-2011, 08:44 PM
Please host it on tinypic or imageshack or something :)

Yeah I realized my mistake and edited it, but here it is again:


http://img36.imageshack.us/i/81720407.jpg/

http://img835.imageshack.us/i/47551479.png/


Edit: I tried creating "l" and "5" in notepad font, and I found that it worked if I turned the tolerance up somewhere in the hundreds for the function FindBitmapMaskTolerance();

The "0" image on the other hand is still not found. I created it by going into paint and selecting the paintbrush tool, filling in the one solid color in the 0% image. Then everything that didn't fill in white I turned black, so is the problem maybe that my .bmp file is missing the outline of half off pixels that the original image had? I would think this wouldn't be a problem at all.

Lance
03-01-2011, 04:07 AM
bump..

Zyt3x
03-01-2011, 01:29 PM
I'm not sure what the problem is...

Lance
03-02-2011, 03:46 AM
Could it be the case that with big letters like this it doesn't work? Maybe I need to create a DTM of every number 0-9 and use that instead..