Autoit - loop TAB key?

12/20/2009 15:07 csk2k9#1
Hi everyone :confused:
I have try all night to make a tab key work...
here the code;
**********************************************

$title = "Element Client"
$game=WinActivate($title, "")
WinSetOnTop($title, "", 0)
Sleep(1000)
$red = "0xFF0000"
search_mob()

func search_mob() ; fonction "search_mob"
Send("{TAB}")
Sleep(1000)
EndFunc

While 1 ; begin of while unlimit
$Coord=PixelSearch ( 0, 0, 271, 62, $red, 5, 0 ) ;0xFF000 is red
$mob = @error
If $mob=0 Then ;if color isnt red do this
Sleep (1000) ;wait 1 sec
search_mob() ; go get the fonction "search_mob"

Else ;if color is red, do this
Sleep (1000) ;wait 1sec
Send ("{ALTDOWN}") ; press ALT DOWN
Send ("{1}") ; press 1
Send ("{ALTUP}") ; release ALT UP
Sleep (500) ; wait half seconde
EndIf ;end of if fonction
WEnd ; end of while fonction

************************************************** *******
Can you tell me what i miss???
all i want is to change the mob by using Tab key when this mob is dead.
it's work once. if i want to get it to work again, i have to press tab key and the rest do the job.

and do i have to use Injection to get tab key work?? everything working fine.

thx

edit: i just change from french to english, maybe someone could help me out...i stil testing this little script... btw this is not a REAL boting...it's just a bot to lvl up a pet in ROOM 4. i have other script that work with timer, and i would like to use with mob health, that all.
12/21/2009 22:58 dem0nz#2
make it hold tab down.
12/22/2009 05:54 csk2k9#3
Quote:
Originally Posted by dem0nz View Post
make it hold tab down.
well, the pb isnt the hold tab down. the pb is, it's doesnt came back to the initial...
1. pixelsearch ; search for red mob with full HP
2. if it find the red mob, use the alt+1 for pet attack.
3. else, go back to pixelsearch

the pb i get is, it doesnt go back to #1 after my pet kill the mob. it stuck at #2, the alt+1 get stuck, no tab fonction...why i know? because when i click on other mob, my pet start attacking and come back to me. when i click on another mob my pet start again. i think i have pb with ''while 1'' or should i put Do command...? btw, HOLD TAB doesnt work
01/11/2010 06:30 zxfzxf#4
Try this:
while true
ControlSend("Element Client" ,"", "", "{TAB}")
Sleep( 200 )
ControlSend("Element Client" ,"", "", "{TAB UP}")
wend

This is supposed to change mob every 200 - 300 millisecs

Also, use do (attacking stuff)... until (mob is dead) loop to stop tabbing when mob is selected.

If you have any other question you can pm me if you want.
Good luck!
01/11/2010 06:31 zxfzxf#5
Also, use ControlSend(gameWindow's Title, "", "", !{1}) instead of altdown+1+altUp;