Jump to content

Any ideas for how to make this?


zornaq
 Share

Recommended Posts

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.

:whistle:

Link to comment
Share on other sites

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

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 by zornaq
Link to comment
Share on other sites

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

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

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%
return

Now 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 by cmallett
Link to comment
Share on other sites

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

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 by cmallett
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...