zippoxer Posted October 30, 2011 Share Posted October 30, 2011 (edited) program New; var chars: Integer; text: AnsiString; begin chars := LoadChars2('C:\Zezenia Chars'); text := GetTextAtEx(1876, 475, 0, chars, False, False, 1, 1, 11192520, 3, False, tr_AllChars); writeln(text); end. Always prints 3 spaces. The charset: Zezenia Chars.zip Each character is 6x8 (should be 7x8 but it doesn't matter since I specified 1px spacing, so SCAR skips the missing pixel). The position I chose by looking at the first pixel of character 1 (49.bmp), then locating that pixel on the screen when my health is 123. The color I picked with Auto Color Aid v2.exe which I found in the OSI's Tools directory. I can't see the problem :\ Thanks. Edited October 30, 2011 by zippoxer Quote Link to comment Share on other sites More sharing options...
FHannes Posted October 30, 2011 Share Posted October 30, 2011 Make sure you're searching at the correct height, the pixel you start searching at must match eht top left pixel of the font Quote Link to comment Share on other sites More sharing options...
zippoxer Posted October 30, 2011 Author Share Posted October 30, 2011 (edited) I did. The top-left pixel of the number 158 in the picture is the top-left pixel of character 48 (= number 1) in the charset. That pixel's location on the screen is 1876/475 and it's color is 11192520. BTW: I got SCAR's OCR to work few years ago: http://villavu.com/forum/showthread.php?t=46646 There was a very good support for SCAR there, back then... Edited October 30, 2011 by zippoxer Quote Link to comment Share on other sites More sharing options...
Wanted Posted October 30, 2011 Share Posted October 30, 2011 SCAR's OCR works very well. I use it for all sorts of things in runescape 2. I am sure we can help you with whatever it is you need it for. Quote Link to comment Share on other sites More sharing options...
zippoxer Posted October 30, 2011 Author Share Posted October 30, 2011 I'm trying to recognize the player's health in a game. '230' in this picture: Untitled.bmp I already made a charset (attached to the thread), found out the text color (11192520). I also found the location of the text, which is 104/6 in this picture (and 1876/475 on my screen). I'm not sure whether it's the information above incorrect or the way I use GetTextAtEx. Quote Link to comment Share on other sites More sharing options...
Wanted Posted October 30, 2011 Share Posted October 30, 2011 Well there could be a lot of things wrong that you are doing preventing it from working correctly. Tolerance is 0, check make sure the color is static Try regular string instead of ansistring Use 0, 2 for min/max spacing Check your TextColor Your Text length is only 3, unless you only expect to get three chars back you might want to make this bigger, make it as big as possibly would ever be and then some. Lastly your char set may not be perfect, I'll check into this. If all this still doesn't work, then it's possible the game you are playing has taken preventive measures like Runescape did with UpText (even though we got around them) Try those things I mentioned while I try looking at your char set. Quote Link to comment Share on other sites More sharing options...
zippoxer Posted October 30, 2011 Author Share Posted October 30, 2011 I tried all and no success yet. If you look at the charset notice that every pixel that is white in the charset is 11192520 in the game. Quote Link to comment Share on other sites More sharing options...
FHannes Posted October 30, 2011 Share Posted October 30, 2011 The problem probably is that SCAR's current OCR system doesn't only check the color, it also checks whether the pixels outside of the character are different, if they aren't or they're too similar, it will fail. You should try to get everything that's inside fo the character's outline in your font and then use a slightly higher tolerance. Quote Link to comment Share on other sites More sharing options...
zippoxer Posted October 30, 2011 Author Share Posted October 30, 2011 (a zoomed part of the game) Most of the pixels in every character are 11192520 and I turned all of them to white while making the charset, the rest, which is what left to fill 6x8, I turned to black. If the tolerance is 0, shouldn't SCAR skip (not compare with a character skeleton) all pixels that are not 11192520? Quote Link to comment Share on other sites More sharing options...
Wanted Posted October 30, 2011 Share Posted October 30, 2011 I don't think those type of chars will be readable with SCAR at this time. You could however create your own OCR (slow) and use bitmap loops, or create a plugin, maybe SCAR will be able to do this one day. I could be wrong though, Freddy what do you think? Quote Link to comment Share on other sites More sharing options...
FHannes Posted October 30, 2011 Share Posted October 30, 2011 I've worked out a little example how to do this. The characters are really diffucult to recognize because they're blended in with the outline, but I've created a new fontset (ZezeniaTest.rar Just put the characters in a folder named "Zezenia" in your Fonts folder inside of your workspace. Zezenia.rar Quote Link to comment Share on other sites More sharing options...
zippoxer Posted October 30, 2011 Author Share Posted October 30, 2011 Awesome. Thank you very much, I'll finish the charset in the right way. (almost) Nothing is impossible Quote Link to comment Share on other sites More sharing options...
FHannes Posted October 30, 2011 Share Posted October 30, 2011 You could try other tolerance algorithms to lower the tolerance require to match the characters btw, I'm not sure what effect each mode would have though. Quote Link to comment Share on other sites More sharing options...
zippoxer Posted October 31, 2011 Author Share Posted October 31, 2011 (edited) Surprisingly, my charset works with tolerance 0 after I changed every character from 6x8 to 7x11 (except for few characters with more/less width) One problem is that the health starts from a variable X position, depending on the amount of it's characters since it's right to left. Anyway, I use the following to determine the start of right to left texts: function FindTextStartX(xe, ys, maxLength, maxCharWidth, maxCharHeight, color: Integer): Integer; var y: Integer; begin FindColor(Result, y, color, xe - maxLength * maxCharWidth, ys, xe, ys + maxCharHeight); end; This way works, but can I use GetTextAt in reverse (to read from right to left)? Edited October 31, 2011 by zippoxer Quote Link to comment Share on other sites More sharing options...
Wanted Posted October 31, 2011 Share Posted October 31, 2011 I'm pretty sure you can't, but what you're doing now works fine right? Quote Link to comment Share on other sites More sharing options...
FHannes Posted October 31, 2011 Share Posted October 31, 2011 No, you can't read from the right to the left. Quote Link to comment Share on other sites More sharing options...
zippoxer Posted October 31, 2011 Author Share Posted October 31, 2011 It's okay since I already implemented another way to handle right to lefts (FindTextStartX), thank you all for helping. Quote Link to comment Share on other sites More sharing options...