Jump to content
Sign in to follow this  

simple TimerDiff

Recommended Posts

hi i cant seem to get this working. im sure its something simple

Case _IsPressed(31)
                $iClickCount += 1
                $iTimer = TimerInit()
                If TimerDiff($iTimer) = 1000 Then
                        Case $iClickCount = 1
                            MsgBox(0, "Clicked", "You clicked 1 times")
                        Case $iClickCount = 2
                            MsgBox(0, "Clicked", "You clicked 2 times")
                $iClickCount = 0
                $iTimer = 0

Share this post

Link to post
Share on other sites

I believe what is happening is:

it runs the function when the "1" key is pressed

sets the click count to +1 (so if it was 0 it's now 1)

initiates the timer

checks to see if timer is 1 second (at this point it is not)

ends the func

I would say use a do...until

something like:


If _ispressed(01) Then

$iClickCount += 1


Until TimerDiff($iTimer) = 1000

then add your msgbox to show how many clicks

Edited by kaotkbliss



My Android cat and mouse game

We're gonna need another Timmy!

Share this post

Link to post
Share on other sites

also how would i get it to work with this?

Case Else
            For $x = 0 To 9
                If $msg = $B[$x] Then
                    $iTimer = TimerInit()
                    $Info = GUICtrlRead($Edit1)
                    $Split = StringSplit($Key[$x], ",")
                    $cnt = 1
                    If $aHold = $Key[$x] And $cHold >= 1 Then $cnt = $cHold + 1
                    If $cnt >= 2 Then $Info = StringTrimRight($Info, 1)
                    If $cnt > $Split[0] Then $cnt = 1
                    $aHold = $Key[$x]
                    $cHold = $cnt
                    If TimerDiff($iTimer)>=1000 Then
                    GUICtrlSetData($Edit1, $Info & $Split[$cnt])
                    GUICtrlSetData($Edit1, $Info & " ")

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...