makeshift Posted September 12, 2007 Share Posted September 12, 2007 Hey guys,I'm a tad new to autoit3, i've been learning and done a few quick login scripts with colors and timers. But now i'd like to make a bot for a game ( for educational purposes of course ).To do this, i need to make it read a screenshot ( This one, and a few others, it is saved on my system as invalid.bmp.Unfortunatly, i also need to make it so it looks for that in a certain location...and that would be approx. here on a 1024x768 screen.And i can't find a tutorial ( Properly) to make it do this.Also, i need to make it so if it doesn't find that screenshot on the screen, it goes to the next command...which should be something like turning around and moving the mouse a bit (Simple stuff).I have no idea how to do either of those commands, so if you could, please tell me what they are! Thanks in advance guys,Makeshift Link to comment Share on other sites More sharing options...
stampy Posted September 12, 2007 Share Posted September 12, 2007 I'm assuming your wanting to read the screen and not the bmp file. Look into PixelChecksum ,PixelGetColor, PixelSearch. That should get you started. Link to comment Share on other sites More sharing options...
makeshift Posted September 15, 2007 Author Share Posted September 15, 2007 Thanks, i'll look up on them. Link to comment Share on other sites More sharing options...
James Posted September 15, 2007 Share Posted September 15, 2007 I think this would require a OCR. Search for OCR and then try using bits and bobs. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Fossil Rock Posted September 15, 2007 Share Posted September 15, 2007 You figure out the exact font (type face, size, bold or not ....) and I'll show you an easy way to OCR it. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
BAM5 Posted September 15, 2007 Share Posted September 15, 2007 (edited) i have seen ocr's for autoit and found a pretty good one and made a udf for it EDIT: also to get the screen shot to ocr look up autolib and in there they have a bit of screencap functions. expandcollapse popup#include-once #include <Array.au3> ;=============================================================================== ; ; Function Name: OCRImage($imagefile) ; Description: Gets text out of an image. ; Parameter(s): $imagefile - The file to ocr ; Requirement(s): Office 2003 or above ; Return Value(s): Returns a string of the words. ; Author(s): ptrex, bam5 ; ; http://msdn2.microsoft.com/en-us/library/a...office.11).aspx ; ;=============================================================================== Func OCRImage($imagefile) Dim $miDoc, $Doc Dim $str Dim $oWord Dim $sArray[500] Const $miLANG_CZECH = 5 Const $miLANG_DANISH = 6 Const $miLANG_DUTCH = 19 Const $miLANG_ENGLISH = 9 Const $miLANG_FINNISH = 11 Const $miLANG_FRENCH = 12 Const $miLANG_GERMAN = 7 Const $miLANG_GREEK = 8 Const $miLANG_HUNGARIAN = 14 Const $miLANG_ITALIAN = 16 Const $miLANG_JAPANESE = 17 Const $miLANG_KOREAN = 18 Const $miLANG_NORWEGIAN = 20 Const $miLANG_POLISH = 21 Const $miLANG_PORTUGUESE = 22 Const $miLANG_RUSSIAN = 25 Const $miLANG_SPANISH = 10 Const $miLANG_SWEDISH = 29 Const $miLANG_TURKISH = 31 Const $miLANG_SYSDEFAULT = 2048 Const $miLANG_CHINESE_SIMPLIFIED = 2052 Const $miLANG_CHINESE_TRADITIONAL = 1028 $miDoc = ObjCreate("MODI.Document") $miDocView = ObjCreate("MiDocViewer.MiDocView") $miDoc.Create($imagefile) $miDoc.Ocr($miLANG_ENGLISH, True, False) $i = 0 For $oWord in $miDoc.Images(0).Layout.Words $str = $str & $oWord.text & ' ' $sArray [$i] = $oWord.text $i = $i + 1 Next Return $str EndFunc you need office 03 or above. Edited September 15, 2007 by bam5 [center]JSON Encoding UDF[/center] Link to comment Share on other sites More sharing options...
Fossil Rock Posted September 15, 2007 Share Posted September 15, 2007 you need office o3 or above.You think this will help with a game? Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
BAM5 Posted September 15, 2007 Share Posted September 15, 2007 (edited) You think this will help with a game?You need office 03 for the dll it installs for the ocr functionautolib is here http://www.autoitscript.com/forum/index.php?showtopic=33677 Edited September 15, 2007 by bam5 [center]JSON Encoding UDF[/center] Link to comment Share on other sites More sharing options...
stampy Posted September 15, 2007 Share Posted September 15, 2007 To fully read the text an OCR would be required in some fashion. However if you just need to see if the that message appears in a certain area of the screen you can simply scan that area for a change in pixel color and or pattern using the pixel functions. Link to comment Share on other sites More sharing options...
makeshift Posted September 18, 2007 Author Share Posted September 18, 2007 (edited) For this i'll use a simpler picture, this one: If you're wondering, it's from Runescape.The nearest font i can give it to is 'Fixedsys'. Though i'm not quite sure, it seems as though it's a 'not as bold' version of Fixesys.Heres 'FixedSys' Size...mmmm....About 8.And how do i make it look at that certain location on the screen? I've been looking everywhere! If one of you could please give me the command i'd be greatfull .And yes, all i need it to do is see if that picture is there on XX part of the screen, if it is, go onto specified command, if not, go onto specified command. I seriously need that command in general to surpass random events, i don't want it to pause every time i tell it to search for random events to wait for each of them.Thanks for your help so far guys! Edited September 18, 2007 by makeshift Link to comment Share on other sites More sharing options...
makeshift Posted September 21, 2007 Author Share Posted September 21, 2007 (edited) I'm being annoying again.Can anybody please help me with this? I've scoured google, yahoo, msn search for a tutorial on something like this, but i can't find...squat. I'm working on various bots for various games, this is the absolute only thing i need to complete most of my scripts. I'm also working on an autoit tutorial website ( Still under construction. If you want to check it out and maybe submit a tutorial message me), and an answer would be very helpful so i could also put it on there.Thanks again.EDIT: Just found a tutorial...it's LIKE what i need, the function PixelCheckSum ( Which was mentioned...) looks for a change in that area, the only problem for me is that there will be lots...and lots...of changes in that area, i need to look for a certain one. ( Tutorial: http://www.autoitscript.com/autoit3/docs/f...xelChecksum.htm ) Edited September 21, 2007 by makeshift Link to comment Share on other sites More sharing options...
isakbarnet Posted November 20, 2007 Share Posted November 20, 2007 the PixelChecksum() function returns a value based on the pixels within the area you specify. So you can search the area to the bottom of the screen when it says: You swing your pick at the rock, keep that value (an example: 1942411134). Then you can check the area again, and if the checksum equals the previous value (in my example 1942411134), it should say: You swing your pick at the rock. I'm not sure if this works, I will test it when I come home, but if I understand the function correctly, it should work. Link to comment Share on other sites More sharing options...
slaughter Posted November 20, 2007 Share Posted November 20, 2007 here is done with diablo 2http://www.autoitscript.com/forum/index.ph...2&hl=diablohelpfull explme for you In progress: Windows Server bruteforce GUARD Admin Tools (Remote client control) Bypasing firewall Old stuff: [font="Verdana;"]MD5 Auto Update Calendar XP SS multi usser server & client Autoit Remote Control (ARC)[/font] Link to comment Share on other sites More sharing options...
jvanegmond Posted November 20, 2007 Share Posted November 20, 2007 If this is for Runescape, I am doing an OCR in the works for that game. github.com/jvanegmond 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