Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Groo Gadgets on June 07, 2012, 08:07:39 PM

Title: [SOLVED] Mouse Double Click - how to?
Post by: Groo Gadgets on June 07, 2012, 08:07:39 PM
Hey guys,

I have scoured the playMaker forums before posting this question but haven't found a suitable answer.

Is there an easy way to detect a double click with a mouse and send an event based on a double click? I have no problem doing a similar thing on my iPhone via the "get touch info" action using the "store Tap Count" function.

An action that could record a click count would be great, in fact it would also be great to have a "get Key Tap" action for keyboard input as well.

Failing that has anyone got any tips or tricks to achieve a double click event without the need for a custom action?

Any help with this problem would be great   ;D

Thanks!
Title: Re: Mouse Double Click - how to?
Post by: jeanfabre on June 08, 2012, 06:26:58 AM
Hi,

 It's quite simple actually.

 have a fsm, that count the number of clicks in a int variables, and store the time of the click, then compare the time and if it's low enough, consider it a double and Fire a global event "DOUBLE CLICK" or something.

so, here is the steps.

when the user click, you check the current count
if 0. you record the time in a variable "first click time"
if 1, you record the time in a variable "second click time", and you compare both time, if it is below a certain amount, consider it a double click, and reset the counter to 0

does that make sense? I can do a small working example for this if you want.

 bye,

 Jean
Title: Re: Mouse Double Click - how to?
Post by: Groo Gadgets on June 08, 2012, 07:26:58 AM
Haha, uncanny! I just solved this problem myself then i return to the forum to see your solution!

Thanks anyway for your help Jean, very much appreciated.

While on the subject of mouse input, is there a way (or possible custom action that lets me store the Delta X of the mouse? The "Get Touch Info" device action has it and it would be most handy to have the fuction for the mouse as well  :-)

Thanks.

Simon
Title: Re: [SOLVED]Mouse Double Click - how to?
Post by: jeanfabre on June 08, 2012, 08:34:48 AM
Hi,

 I don't think there is no, Do you want to have a go at creating this action, else I can build it if you want.

 Bye,

 Jean
Title: Re: Mouse Double Click - how to?
Post by: spacedog on November 14, 2013, 12:56:18 AM
Haha, uncanny! I just solved this problem myself then i return to the forum to see your solution!

Thanks anyway for your help Jean, very much appreciated.

While on the subject of mouse input, is there a way (or possible custom action that lets me store the Delta X of the mouse? The "Get Touch Info" device action has it and it would be most handy to have the fuction for the mouse as well  :-)

Thanks.

Simon

Hi Simon

I'm an artist just beginning to learn PlayMaker and having the same question.
I understand all the steps that you describe in your post, but I can't get it right.

could you give me a simple screenshot so I can understand it more visually?

thank you.
Title: Re: [SOLVED] Mouse Double Click - how to?
Post by: Tack on December 09, 2014, 12:11:57 PM
I know I'm sort of necroposting here but I would also like a visual representation as spacedog requested. I'm more of a visual learner as well and would appreciate the help.
Title: Re: Mouse Double Click - how to?
Post by: nowISnow on August 04, 2017, 08:18:21 AM
when the user click, you check the current count
if 0. you record the time in a variable "first click time"
if 1, you record the time in a variable "second click time", and you compare both time, if it is below a certain amount, consider it a double click, and reset the counter to 0

I am about to do something similar. I want to see if a user clicks on a button x times within y seconds.

How do I compare time and set the "if below a certain amount"?

Title: Re: [SOLVED] Mouse Double Click - how to?
Post by: djaydino on August 04, 2017, 12:06:00 PM
Hi,
A way you could do this is by using a 2nd fsm for the time :

fsm 1, when button is 1st time pressed, send an event to fsm 2.
also send a event to fsm 2 when the button is pressed X times.

in fsm 2 have state with a global event (call it "Start Timer" for example)
Inside the state you will need the action "Get Time Info" and set to 'time in current state'
Store the value in a float.

Then use a "Float Compare" action and check your stored value to (for example) 10.
Set both actions 'Every Frame' Enabled, and on "float compare" set an event to 'Equal' and 'Greater Than' (call it 'Time Up' for example) and in the next state you can do what you want to do (for example, send a event to state 1 to reset the button and button count)
Also set a Global Transition for when the button is pressed X in time.

Here is a useful tutorial for Global events and transitions :

Title: Re: [SOLVED] Mouse Double Click - how to?
Post by: nowISnow on August 05, 2017, 08:28:35 AM
I used a different method which was easier for me to implement but I just found this one because of your text. Thanks for that!
Title: Re: [SOLVED] Mouse Double Click - how to?
Post by: djaydino on August 05, 2017, 11:04:10 AM
Hi.
No problem :)

That why i commonly say "A way you could do this" :D