Jump to content

Recommended Posts

Posted

What could be the possible reasons behind AutoIt not sending a keystroke? I need the script to send it once, perform some actions, then send the same one again. Well, it send the keystroke, performs the actions, and doesn't send the keystroke the second time. I have sleep commands before and the keystroke, in case its missing it because its too soon after the actions, so thats not the problem. Any suggestions?

Posted (edited)

Func PotDrink()
    While $InGameCheck = PixelChecksum (680, 320, 700, 350)
    WinCheck()
  Sleep(100)
    WEnd
    Sleep(500)
    Send("I")
    Sleep(250)
$FCheck = 0
Do
    $FCheck = $FCheck + 1
    $FJuve = PixelSearch(430, 340, 710, 455, 14708848)
  If not @error then
    WinCheck()
    MouseClick("right",$FJuve[0],$FJuve[1], 1, 1)
  Else
  
  EndIf
Until $FCheck = 6;PixelSearch(430, 340, 710, 455, 14708848) = 0
$JCheck = 0
Do  
    $JCheck = $JCheck +1
    $Juve = PixelSearch(430, 340, 710, 455, 10756348)
  If not @error then
    WinCheck()
    MouseClick("right",$Juve[0],$Juve[1], 1, 1)
  Else
  
  EndIf
Until $JCheck = 6;PixelSearch(430, 340, 710, 455, 10756348) =0
$SCheck = 0
Do
    $SCheck = $SCheck + 1
    $SHeal = PixelSearch(430, 340, 710, 455, 12866644)
  If not @error then
    WinCheck()
    MouseClick("right",$SHeal[0],$SHeal[1], 1, 1)
  Else
  
  EndIf
Until $SCheck = 6;PixelSearch(430, 340, 710, 455, 12866644) = 0
$GCheck = 0
Do
    $GCheck = $GCheck + 1
    $GHeal = PixelSearch(430, 340, 710, 455, 15773836)
  If not @error then
    WinCheck()
    MouseClick("right",$GHeal[0],$GHeal[1], 1, 1)
  Else
  
  EndIf
Until $GCheck = 6;PixelSearch(430, 340, 710, 455, 15773836) = 0
$MCheck = 0
Do
    $MCheck = $MCheck + 1
    $SMana = PixelSearch(430, 340, 710, 455, 2384088)
  If not @error then
    WinCheck()
    MouseClick("right",$SMana[0],$SMana[1], 1, 1)
  Else
  
  EndIf
Until $MCheck = 6;PixelSearch(430, 340, 710, 455, 2384088) = 0
$GMCheck = 0
Do
    $GMCheck = $GMCheck + 1
    $GMana = PixelSearch(430, 340, 710, 455, 3158164)
  If not @error then
    WinCheck()
    MouseClick("right",$GMana[0],$GMana[1], 1, 1)
  Else
  
  EndIf
Until $GMCheck = 6;PixelSearch(430, 340, 710, 455, 3158164) = 0
    Sleep($KeyD)
    Send("I")
    Sleep($KeyD)
    WinCheck()  
EndFunc

It doesn't send the second "I".

Edited by SweatyOgre
Posted

I just need it to send plain "I" key, but in the program it is sending the key, the shift won't affect it, so maybe it will cause the script to send the key.

Posted

The question is: Wasn't the "I" sent? Or didn't the script reach the line where the second send("I") is placed. I would test it with a simple Output. Just put a MsgBox(0, "Output", "Line has been reached") instead of the second send ("I") and look it comes up or not. Or just write something to a textfile.

arctor

Posted

It's not doing the pixel searches either. I added a MsgBox after the second Send("i") and it is getting to that line...ugh, whats wrong?

I have no more idea. I do not know in what game you are in. I can't test your script on my machine. What I noticed is that a function named WinCheck() is called. But I don't see the function itself.

arctor

Posted

I just separated the whole function into another script, and ran it, and it worked. AGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHH! Does anyone have any possible idea why autoit wouldn't send a keystroke, or wouldn't perform a pixelsearch?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...