View unanswered posts | View active topics It is currently Sat Apr 27, 2024 7:23 am



Reply to topic  [ 3 posts ] 
 Double Tapping a button 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Double Tapping a button
Is there some command like UInputMan:KeyPressedTwice() or something like it to make something activate when I press a button twice, or do I have to mess around with more timers and extra ifs?


Sun Dec 18, 2011 6:16 am
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Double Tapping a button
Unfortunately no, there isn't.

But making a double tap check isn't hard either.

The way I'd do it is with two timers, A primer for when the button is pressed, and one for the second press.

Code:
   self.TimerA = Timer()
   self.Primer = Timer()
   
   if cont:IsState(Controller.BODY_CROUCH) then
      self.Primer:Reset()
   end
   
   if not(self.Primer:IsPastSimMS(100)) then
      if not(cont:IsState(Controller.BODY_CROUCH)) then
         self.TimerA:Reset()
      end
   end
   
   if not(self.TimerA:IsPastSimMS(100)) then   
      if not(cont:IsState(Controller.BODY_CROUCH)) then
         self.DoubleTap = true
      end
   end


Sun Dec 18, 2011 10:26 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Double Tapping a button
Did you have to code it for me? :)

Thanks!


Sun Dec 18, 2011 8:36 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.077s | 15 Queries | GZIP : Off ]