Sign in to follow this  
Followers 0
hot202

simple TimerDiff

3 posts in this topic

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
                    Select
                        Case $iClickCount = 1
                            MsgBox(0, "Clicked", "You clicked 1 times")
                        Case $iClickCount = 2
                            MsgBox(0, "Clicked", "You clicked 2 times")
                    EndSelect
                $iClickCount = 0
                $iTimer = 0
                EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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:

Do

If _ispressed(01) Then

$iClickCount += 1

EndIf

Until TimerDiff($iTimer) = 1000

then add your msgbox to show how many clicks

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

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])
                    Else
                    GUICtrlSetData($Edit1, $Info & " ")
                    EndIf
                EndIf
            Next

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