zornaq Posted December 16, 2003 Share Posted December 16, 2003 I need to be able to "detect/read" words (characters) from a game screen, I know this can't be simple but if anyone have ideas on what would be the best way to do this, would be great to read those ideas. Also if you know for fact that it can't be done with just AutoItV3 tell me that also. Link to comment Share on other sites More sharing options...
cmallett Posted December 16, 2003 Share Posted December 16, 2003 If you just need to detect the differences between phrases or words, try using AutoIt3's or AutoHotkey's PixelGetColor or PixelSearch.If you need to convert the graphics to text, there are some OCR programs that might do the trick. One I use is called Kleptomania, but it probably only works if the font is an installed font on the system.AutoHotkey (great for game automation) Link to comment Share on other sites More sharing options...
zornaq Posted December 17, 2003 Author Share Posted December 17, 2003 (edited) I'll check these out, thanks. Btw. Kleptomania seems to be able to do what I wanted but I'm not sure if this is the "fastest" way to do this? I need to implement this to my code and do quick checks in given areas, any other programs I might want to check? Edited December 17, 2003 by zornaq Link to comment Share on other sites More sharing options...
cmallett Posted December 17, 2003 Share Posted December 17, 2003 I'm assuming you've already tried AutoIt3's WinGetText on the game and didn't get any useful text back? If so, that probably means (as expected) that the text is printed graphically on the screen or that it is real text but is stored in a type of control that AutoIt3 can't access. Once again, if you only need to detect the *differences* between certain words or phrases, rather than converting them to text, you should be able to accomplish that with PixelSearch or PixelGetColor. Other than that, there are probably other OCR programs you could try, but researching and applying such things is likely to be a lot of work. Link to comment Share on other sites More sharing options...
zornaq Posted December 17, 2003 Author Share Posted December 17, 2003 Thanks for the reply again, WinGetText does not help me in my problem. PixelSearch and PixelGetColor is the way I though it could be done, BUT I have a real problem with how to do this. I will need an idea for this (after that I can make it) but my coding knowledge is not so developed to get this answer from puff. I think being able to "detect the *differences* between certain words or phrases" is just want I need. If you can give me example how to do that I'm sure I can get on from there. Like words: Cat Dog Link to comment Share on other sites More sharing options...
cmallett Posted December 17, 2003 Share Posted December 17, 2003 (edited) Here's an example with AutoHotkey that I've used myself. It may be helpful to you if the game is full-screen and thus AutoIt3 Window Spy can't easily be used with it.This can be translated to AutoIt3 if you wish.clipboard = ; Empty the clipboard #z:: ; Win-Z hotkey MouseGetPos, X, Y ; Move the cursor out of the way so that it doesn't block the pixel we want. ; Move the mouse slowly so that the game can keep up with it. ; This is necessary on some games but perhaps not yours: MouseMove, 0, 0, 3 PixelGetColor, color, %X%, %Y% MouseMove, %X%, %Y%, 1; moving faster seems ok in this case clipboard = %clipboard%`nX%X% Y%Y% Color = %color% returnNow start the script and enter the game. Move the mouse over each pixel of interest and then press Win-Z to store the info about it. Exit the game and paste the info into a text editor so that you can try to make sense of it and automate the game using the following commands (or their AutoIt3 equivalents):Examples:PixelGetColor, OutputVar, %XCoord%, %YCoord% If ErrorLevel <> 0 MsgBox, PixelGetColor failed. PixelSearch, OutputVarX, OutputVarY, %LeftCoord%, %TopCoord%, %RightCoord%, %BottomCoord%, %ColorToSearchFor% If ErrorLevel <> 0 MsgBox, That color was not found within the specified region.If you want AutoHotkey it's here.Good luck. Edited December 17, 2003 by cmallett Link to comment Share on other sites More sharing options...
zornaq Posted December 18, 2003 Author Share Posted December 18, 2003 Thank you Cmallett you have been very helpfull! This is enough for now, I will start learning what kind of information I get from those letters and phrases. Btw. This AutoHotKey program, can it do more complex stuff than AutoIt3 or is it more like AutoIt2? Link to comment Share on other sites More sharing options...
cmallett Posted December 18, 2003 Share Posted December 18, 2003 (edited) It is backward compatible with AutoIt2 (able to run most .aut files without modification) and supports many AutoIt3 commands. Of course, it also specializes in hotkeys.The syntax is not nearly as powerful as AutoIt3, which is close to being a "real" programming language in terms of math, complex expressions, user defined functions, etc.See here for details. Edited December 18, 2003 by cmallett Link to comment Share on other sites More sharing options...
cmallett Posted December 18, 2003 Share Posted December 18, 2003 I forgot to mention that while testing the sample code I gave above, I discovered a bug in AutoHotkey. So if you want to use it, be sure to get the latest version (0.215).Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now