Insolence Posted December 29, 2004 Share Posted December 29, 2004 (edited) I'm trying to make an OCR for IN game stuff in Diablo II, I think it'll work because the characters aren't right up against eachother and you can get a base for each letter through 1 pixel.But JUST to get the 'code' I'll use for the S in Short Staff it takes 1 second!Image: (around 75kb, and I'm looking at it inside paint, top left most of the S)http://www.insolence9.com/iPFU/diablo.bmpI use the commented out mouse moves + AutoIT Spy's magnify feature, shows me exactly where it's looking expandcollapse popupOpt("PixelCoordMode", 0) Opt("MouseCoordMode", 0) HotKeySet("{SPACE}", "end") WinActivate("diablo ii in game.bmp") Sleep(1000) $color = 12895428 ;$msg = ReadText ( 61, 45, 339, 58, $color ) Y $begin = TimerStart() $msg = ReadText ( 150, 51, $color ) $dif = TimerStop($begin) MsgBox("", "", $msg & " scanned in: " & $dif) Func ReadText($startx, $starty, $color) $String = "" $i = 0 ; Reference: ; D = Down 1 pixel ; R = Right 1 pixel ; S = Down + Right 1 pixel For $i = 1 to 10 ;Move 1 pixel down $TopLeft_1D = PixelGetColor ( $startx, $starty + 1 ) ;MouseMove( $startx, $starty + 1, 10) ;Sleep(1000) ;MouseMove( 400, 400, 3) If $TopLeft_1D <> $color Then ;Move 1 pixel right $TopLeft_1R = PixelGetColor ( $startx + 1, $starty ) ;MouseMove( $startx + 1, $starty, 10) ;Sleep(1000) ;MouseMove( 400, 400, 3) If $TopLeft_1R <> $color Then ;Move 1 pixel down/right $TopLeft_1R1D = PixelGetColor ( $startx + 1, $starty + 1 ) ;MouseMove( $startx + 1, $starty + 1, 10) ;Sleep(1000) ;MouseMove( 400, 400, 3) If $TopLeft_1R1D = $color Then ;If successfully found a pixel right, add S to string $startx = $startx + 1 $starty = $starty + 1 $String = $String & "S" EndIf Else $startx = $startx + 1 ;If successfully found a pixel right, add R to string $String = $String & "R" EndIf Else $starty = $starty + 1 ;If successfully found a pixel down, add D to the string $String = $String & "D" EndIf Next Return $String EndFunc Func End() Exit EndFunc Edited December 29, 2004 by Insolence "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted December 29, 2004 Author Share Posted December 29, 2004 eh, all the way at the bottom here "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted December 30, 2004 Author Share Posted December 30, 2004 How often should I bump these? "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
killaz219 Posted December 30, 2004 Share Posted December 30, 2004 Why would you want a short staff? Sorceresses start out with that. Link to comment Share on other sites More sharing options...
Insolence Posted December 30, 2004 Author Share Posted December 30, 2004 It's just to test you big silly I thought of a way to make it atleast a LITTLE faster, lemme see if it works. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. 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