Jump to content
Sign in to follow this  
G3ko

Ending "send" command

Recommended Posts

G3ko

Ok, so... I've been learning AutoIt for 3-4 days and I wanted to test what I've learned

I wanted to create a program that:

- Click 24 times the "z" button every 12 minutes (if the function has been enabled)
- Keep pushing the "up" button for 17 seconds, then release the "up button" and keep pushing the "down button" for another 17 seconds and so on, until the user stops it.

I don't have tried the first function yet (and I'm sure it won't work xD) but I can't find the error in the second one

The programs keep pushing the "up" button infinitely, until I stop it; it won't press the "down" button

Can someone explain why doesn't it work? How can I set the start/stop hotkeys for every function? 

Thank you in advice and sorry if there are some english mistakes (I'm italian)

Here's the code:

 

#include <GUIConstants.au3>
$Form = GUICreate( "Egg Bot by G3ko" , 300 , 200 )
$CheckEgg = GUICtrlCreateButton ( "Check Eggs", 15 , 10 , 100 , 45 )
$StopChecking = GUICtrlCreateButton( "Stop Checking Eggs" , 10 , 75 , 130 , 45 )
$HatchEgg = GUICtrlCreateButton( "Hatch Egg", 170 , 10 , 100 , 45 )
$StopHatching = GUICtrlCreateButton( "Stop Hatching" , 163 , 75 , 120 , 45 )
$UntilEggs = 0
$NoHatch = 0
GUISetState(@SW_SHOW)

While 1
   $Msg = GUIGetMsg()
   Switch $Msg
Case $GUI_EVENT_CLOSE
   Exit
Case $CheckEgg
   $inittimer = TimerInit()
   $timer = TimerDiff($inittimer)
   Do
      If ($timer =720000) Then 
      send ( "{z 24}" )
   $inittimer = 0
EndIf
Until $UntilEggs = 1

Case $StopChecking
   $UntilEggs = 1
   Sleep (300)

Case $HatchEgg
      $timer2 = TimerInit()   
      Sleep (200)
      $timer3 = TimerDiff ( $timer2 )
      Do
         While $timer3 <= 17000
            send ( "{UP}" )
            WEnd
         While $timer3 >= 17000
            send ( "{DOWN}" )
            WEnd
            
         Until $NoHatch = 1
            If $timer3 >34000 Then
         $timer3 = 0
      EndIf
   EndSwitch
WEnd
If $UntilEggs = 1 Then
   Sleep ( 200 )
   $UntilEggs = 0
EndIf
   If $NoHatch = 1 Then
   Sleep ( 200 )
   $NoHatch = 0
EndIf

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×