Sign in to follow this  
Followers 0
MirnesC2

trouble with timing keys and if statement

2 posts in this topic

#1 ·  Posted (edited)

Alright, it's a bit hard to understand. Bare with me.

Send("1")

Check()

Send("2")

Check()

Send("3")

First the program sends the key "1"

Okay so the point is for the user to enter a number which will be a time (in milliseconds) we call this [t]. So the background has a timer running that starts at 0, and if [t] is greater than or equal to [t] it should send the key. If it's not then it should continue on and the program should check again when it is ready. If it's not ready it should send the next ready key.

I tried doing it with the code below, but it's not working. It just spams 1,2,3 and doesn't check if $time1 >= [t].

#cs ----------------------------------------------------------------------------
    AutoIt Version: 3.3.0.0
    Author: Mirnes
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

$botname = InputBox("Hello","Windows name?")
$GUI = GUICreate($botname, 335, 370)
$winname = GUICtrlCreateInput("", 20, 30, 120)
$winsend = GUICtrlCreateButton("Send", 82, 55, 60)
$input1 = GUICtrlCreateInput("", 215, 25, 95)
$input2 = GUICtrlCreateInput("", 215, 52, 95)
$input3 = GUICtrlCreateInput("", 215, 79, 95)
$input4 = GUICtrlCreateInput("", 215, 106, 95)
$input5 = GUICtrlCreateInput("", 215, 133, 95)
$input6 = GUICtrlCreateInput("", 215, 160, 95)
$input7 = GUICtrlCreateInput("", 215, 187, 95)
$input8 = GUICtrlCreateInput("", 215, 214, 95)
$custom1 = GUICtrlCreateInput("", 15, 127, 40)
$custom2 = GUICtrlCreateInput("", 15, 154, 40)
$custom3 = GUICtrlCreateInput("", 15, 181, 40)
$custom4 = GUICtrlCreateInput("", 15, 208, 40)
$time1 = GUICtrlCreateInput("", 55, 127, 90)
$time2 = GUICtrlCreateInput("", 55, 154, 90)
$time3 = GUICtrlCreateInput("", 55, 181, 90)
$time4 = GUICtrlCreateInput("", 55, 208, 90)
$startbutton = GUICtrlCreateButton("Start", 190, 325, 60)
$stopbutton = GUICtrlCreateButton("Stop", 266, 325, 60)
GUICtrlCreateLabel("Created by Mirnes, for the users of www.snoxd.net", 32, 280)
GUICtrlCreateLabel("1", 190, 29)
GUICtrlCreateLabel("2", 190, 58)
GUICtrlCreateLabel("3", 190, 86)
GUICtrlCreateLabel("4", 190, 112)
GUICtrlCreateLabel("5", 190, 138)
GUICtrlCreateLabel("6", 190, 166)
GUICtrlCreateLabel("7", 190, 194)
GUICtrlCreateLabel("8", 190, 220)
GUICtrlCreateGroup("Active Window", 8, 8, 148, 80)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Time Settings", 175, 8, 148, 240)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Custom Keys", 8, 100, 148, 147)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Credits", 8, 260, 318, 50)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

$Pause = 0


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $startbutton
            While 1 
            Select
                Case $msg = $startbutton    
                    Call("Attack")
                Case $msg = $stopbutton
                    ExitLoop
            EndSelect
            WEnd  
        Case $msg = $stopbutton
            ExitLoop
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
    EndSelect
WEnd

#cs ----------------------------------------------------------------------------
    Attack function
#ce ----------------------------------------------------------------------------

Func Attack()
                
            Send("1")
            Check()
            Send("2")
            Check()
            Send("3")
            Check()
EndFunc

#cs ----------------------------------------------------------------------------
    Hot key functions
#ce ----------------------------------------------------------------------------

HotKeySet("{NUMPADADD}", "End")
HotKeySet("{NUMPADSUB}", "Pause")



Func Check()
    
    $key1 = GUICtrlRead($input1)
    $key2 = GUICtrlRead($input2)
    $key3 = GUICtrlRead($input3)
    $key4 = GUICtrlRead($input4)
    $key5 = GUICtrlRead($input5)
    $key6 = GUICtrlRead($input6)
    $key7 = GUICtrlRead($input7)
    $key8 = GUICtrlRead($input8)
                
    $cus1 = GUICtrlRead($custom1)
    $cus2 = GUICtrlRead($custom2)
    $cus3 = GUICtrlRead($custom3)
    $cus4 = GUICtrlRead($custom4)
                
    $cust1 = GUICtrlRead($time1)
    $cust2 = GUICtrlRead($time2)
    $cust3 = GUICtrlRead($time3)
    $cust4 = GUICtrlRead($time4)
    
    Local  $timer = TimerInit()
    Local $timer1 = TimerDiff($timer)
    
    If $timer1 >= $key1 Then
        Send("1")
    EndIf   
    If $timer1 >= $key2 Then
        Send("2")
    EndIf
EndFunc

Func End()
      Exit
EndFunc

Func Pause()
    If $Pause = 0 Then
        $Pause = 1
    Else
        $Pause = 0
    EndIf
    While $Pause = 1
        Sleep(1)
    WEnd
EndFunc

#cs ----------------------------------------------------------------------------
    End of code
#ce ----------------------------------------------------------------------------
Edited by MirnesC2

Share this post


Link to post
Share on other sites



Never mind, I figured that part out. Could use help fixing stop button though.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0