Author Topic: How do I add "Double Tap Hold" to this command?  (Read 2064 times)

mobbDTEO

  • Newbie
  • *
  • Posts: 2
How do I add "Double Tap Hold" to this command?
« on: January 11, 2020, 04:38:39 PM »
I have a command that I got from Malic_VR a while back when downloading his profile, but I need it to do one more thing for me. It does Tap or Press, Hold and Double-Tap, but I also need Double-Tap & Hold (hold the second tap).

Code: [Select]
Begin Boolean Compare : [{CMD}Running] Equals True
End Condition - Exit when condition met
Set Boolean [{CMD}Running] to True
Set date [~commandStart] to [~commandStart] plus [300] milliseconds
Start Loop While : (Joystick 2 Any Button Is Pressed AND [~commandStart] Is Greater Than Current Date/Time)
End Loop
Begin Date Compare : [~commandstart] Is Less Than Current Date/Time
    Press and hold command here
    Press A key and hold for 0.6 seconds and release
Else
    Start Loop While : [~commandStart] Is Greater Than Current Date/Time
        Begin Device State Check :  Joystick 2 Button 9 Is Pressed
            Double tap command here
            Press B key and hold for 0.6 seconds and release
            Set Boolean [{CMD}Running] to [Not Set]
        End Condition - Exit when condition met
    End Loop
    Press command here
    Press C key and hold for 0.6 seconds and release
End Condition
Set Boolean [{CMD}Running] to [Not Set]

Can someone please add Double-Tap Hold to this code? I am inexperienced with coding unfortunately. Any help greatly needed and appreciated  :D

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I add "Double Tap Hold" to this command?
« Reply #1 on: January 11, 2020, 04:58:29 PM »
That would be the command from this post.


This will do all four (press, hold, double tap, double tap and hold; from this post):
Code: [Select]
Begin Boolean Compare : [>>{CMDWHENISAY}waitingForDouble] Equals True
    Set date [~timeout] to [~timeout] plus [300] milliseconds
    Start Loop While :  Keyboard Key 'Ctrl' Is Pressed
        Begin Date Compare : [~timeout] Is Before Current Date/Time
            Write [Blue] 'Double tap Hold registered' to log
        End Condition - Exit when condition met
    End Loop
    Write [Blue] 'Double tap registered' to log
End Condition - Exit when condition met
Set date [~timeout] to [~timeout] plus [300] milliseconds
Start Loop While :  Keyboard Key 'Ctrl' Is Pressed
    Begin Date Compare : [~timeout] Is Before Current Date/Time
        Write [Blue] 'Hold registered' to log
    End Condition - Exit when condition met
End Loop
Set Boolean [>>{CMDWHENISAY}waitingForDouble] to True
Start Loop While :  Keyboard Key 'Ctrl' Is Not Pressed
    Begin Date Compare : [~timeout] Is Before Current Date/Time
        Write [Blue] 'Press registered' to log
        Set Boolean [>>{CMDWHENISAY}waitingForDouble] to False
    End Condition - Exit when condition met
End Loop
Set Boolean [>>{CMDWHENISAY}waitingForDouble] to False

mobbDTEO

  • Newbie
  • *
  • Posts: 2
Re: How do I add "Double Tap Hold" to this command?
« Reply #2 on: January 11, 2020, 06:48:55 PM »
Thank you, sorry I had no idea this was already answered. Thanks again  ;D