KongBR Posted August 17, 2006 Share Posted August 17, 2006 I'm a total n00b concerning AutoIt...This seemed simple enough when I first thought about it, but I don't really have any idea what I'm doing, so I need some help.What I want to happen:When I push a key, I want 3 PixelSearches going constantly, and when they've found that pixel, do a task and start searching again... So far only the "_Done()" function works... The code:HotKeySet("{ESC}", "_Done") HotKeySet("{F8}", "_Start") While 1 Sleep(100) ; WEnd Func _Start() While 1 $c_HPBar = PixelSearch(158, 88, 165, 93, 0x181008, 0) ;Search HP bar for background color. If Not @error And IsArray($c_HPBar) Then Send("{F1 1}") ;Drink potion. EndIf $c_HungerBubble = PixelSearch(130, 70, 140, 80, 0xFFFFFF) ;Search for hunger bubble. If Not @error And IsArray($c_HungerBubble) Then Send("{F2 1}") ;Eat food. EndIf $c_MonsterHunt = PixelSearch(0, 0, 1024, 768, 0x32AEF7) ;Search for monster... attack... wait... If Not @error And IsArray($c_MonsterHunt) Then MouseClick("left", $c_MonsterHunt[0], $c_MonsterHunt[1], 1, 0) ;Engage certain monster; Sleep(20000) EndIf WEnd EndFunc Func _Done() Exit EndFuncBy reading the comments, you can see what I'm trying to do... This is for a game.Thanks in advance for any help. Link to comment Share on other sites More sharing options...
Paulie Posted August 17, 2006 Share Posted August 17, 2006 I'm a total n00b concerning AutoIt... This seemed simple enough when I first thought about it, but I don't really have any idea what I'm doing, so I need some help. What I want to happen: When I push a key, I want 3 PixelSearches going constantly, and when they've found that pixel, do a task and start searching again... So far only the "_Done()" function works... The code:HotKeySet("{ESC}", "_Done") HotKeySet("{F8}", "_Start") While 1 Sleep(100) ; WEnd Func _Start() While 1 $c_HPBar = PixelSearch(158, 88, 165, 93, 0x181008, 0) ;Search HP bar for background color. If Not @error And IsArray($c_HPBar) Then Send("{F1 1}") ;Drink potion. EndIf $c_HungerBubble = PixelSearch(130, 70, 140, 80, 0xFFFFFF) ;Search for hunger bubble. If Not @error And IsArray($c_HungerBubble) Then Send("{F2 1}") ;Eat food. EndIf $c_MonsterHunt = PixelSearch(0, 0, 1024, 768, 0x32AEF7) ;Search for monster... attack... wait... If Not @error And IsArray($c_MonsterHunt) Then MouseClick("left", $c_MonsterHunt[0], $c_MonsterHunt[1], 1, 0) ;Engage certain monster; Sleep(20000) EndIf WEnd EndFunc Func _Done() Exit EndFunc By reading the comments, you can see what I'm trying to do... This is for a game. Thanks in advance for any help. Well From what i see, your code should work, all i can think of is this: Perhaps the game has a cheat blocker that stops key inputs from external programs I believe an example of such tool is 'Game Guard' Also Just for a more optimizing way for the heath bar thing, you can do a 'PixelGetColor' on just one pixel, and if its the background color then send {F1} same can most likely be done for hunger meter What game is it anyway? Link to comment Share on other sites More sharing options...
Valuater Posted August 17, 2006 Share Posted August 17, 2006 search help for "opt" the two options you will need are mouse coordinates mode and pixel get color coordinates mode 8) Link to comment Share on other sites More sharing options...
KongBR Posted August 17, 2006 Author Share Posted August 17, 2006 Well From what i see, your code should work, all i can think of is this:Perhaps the game has a cheat blocker that stops key inputs from external programsI believe an example of such tool is 'Game Guard'AlsoJust for a more optimizing way for the heath bar thing, you can do a 'PixelGetColor' on just one pixel, and if its the background color then send {F1}same can most likely be done for hunger meterWhat game is it anyway?The game's called GoonZu. It doesn't use GG, and I did a little MouseMove and MouseClick test and it worked (in game)... So it must be a problem with my code... Link to comment Share on other sites More sharing options...
KongBR Posted August 17, 2006 Author Share Posted August 17, 2006 Well... I took away the "If Not @error" part and the hunger PixelSearch thing worked... Except it ate like 30 units which like... killed my guy, so I'll need to delete that character and start over... I set it to only press F2 once though, why did it press it 30 times? Link to comment Share on other sites More sharing options...
Paulie Posted August 17, 2006 Share Posted August 17, 2006 (edited) Well... I took away the "If Not @error" part and the hunger PixelSearch thing worked... Except it ate like 30 units which like... killed my guy, so I'll need to delete that character and start over... I set it to only press F2 once though, why did it press it 30 times?because it took a second for the 'food to work probably, and autoit is FAST, so it pushed the button 30 times, before it detected that the it had worked best bet for a fix, put a 3-4 second sleep on the food after the first button Send("{F2}") Sleep(3000) Edited August 17, 2006 by Paulie 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