help with autoit script

07/09/2011 00:52 ikjahaa#16
Quote:
Originally Posted by karraksc View Post
Try it like this:

func Died()
WinActivate("Hero","")
sleep(10000) ;10 sec delay
MouseClick("left" ,836,635,1,1) ; add a 10ms delay to move mouse
endfunc

While 1
if HP=0 then died() ; use any method to find out if you are dead and handle it
Wend
gives me an error with the HP thing.
if i delete the if statement and only call the Died() function then it still doesn't work. only moves the cursor to the position but doesn't click


btw i use Win7 64-bit
07/09/2011 02:29 karraksc#17
Quote:
Originally Posted by ikjahaa View Post
gives me an error with the HP thing.
if i delete the if statement and only call the Died() function then it still doesn't work. only moves the cursor to the position but doesn't click


btw i use Win7 64-bit
the line with the HP=0 is only an example where you'd replace it with whatever routine you plan on using to tell when you are dead. I originally used a getpixelcolor check to see when the red ran out of the HP bar. This is what I used to check the HP

func IsAlive()
while $test=0xB1251C ; Red on HP bar
sleep(1000) ; Wait one second then test if dead
$test=pixelgetcolor(129,33,$id) ;B1251C=Alive else =Dead
WEnd ; exit only if HP bar is empty (dead)
endfunc

func Died()
WinActivate("Hero","")
Sleep(10000) ;Wait for timer to run out
MouseClick("left",836,635,1,1)
endfunc

While 1
isAlive() ; Loops as long as char is alive, checks every 1 second
Died() ; only gets here if char died, so revive
wend ;loop back thru and monitor HP
07/10/2011 18:14 ikjahaa#18
Quote:
Originally Posted by karraksc View Post
the line with the HP=0 is only an example where you'd replace it with whatever routine you plan on using to tell when you are dead. I originally used a getpixelcolor check to see when the red ran out of the HP bar. This is what I used to check the HP

func IsAlive()
while $test=0xB1251C ; Red on HP bar
sleep(1000) ; Wait one second then test if dead
$test=pixelgetcolor(129,33,$id) ;B1251C=Alive else =Dead
WEnd ; exit only if HP bar is empty (dead)
endfunc

func Died()
WinActivate("Hero","")
Sleep(10000) ;Wait for timer to run out
MouseClick("left",836,635,1,1)
endfunc

While 1
isAlive() ; Loops as long as char is alive, checks every 1 second
Died() ; only gets here if char died, so revive
wend ;loop back thru and monitor HP
i understand but i think there is a problem with the mouseclick event.
it doesn't click within hero, in other ( actieve ) programs it does.

just make me a bot that simply clicks in hero. like moving your charecter.
i'll find the solution in that.
ps. test it please
07/10/2011 19:06 schlat#19
Little tip:
1. winhotkey is not correctly working with hero
2. Use WinActive for u while routine otherwise the bot hits your mouse/keys even if hero is not in the foreground
3. mouseclick with x/y/z position are constant! This means if your hero window is at a other position u will click at the wrong position
4. mouseclick and keypress events needs some hold down time (my experience between 30-50ms) ohterwise the event gets lost and hero doesnt recognize anything
5. if you use mouseclick make a dynamic routine which reads and proove the position to click

Good Luck!
07/10/2011 21:32 ikjahaa#20
Quote:
Originally Posted by schlat View Post
Little tip:
1. winhotkey is not correctly working with hero
2. Use WinActive for u while routine otherwise the bot hits your mouse/keys even if hero is not in the foreground
3. mouseclick with x/y/z position are constant! This means if your hero window is at a other position u will click at the wrong position
4. mouseclick and keypress events needs some hold down time (my experience between 30-50ms) ohterwise the event gets lost and hero doesnt recognize anything
5. if you use mouseclick make a dynamic routine which reads and proove the position to click

Good Luck!
ty , i'll try this
07/11/2011 17:29 Shishidump#21
Why you guys doesnt code the bot :D