Jump to content
C4 Forums | Control4

Double-tap help!


Recommended Posts

I am trying to program button 3 of a 3 button to do a couple different things. If it is tapped once within 1 second, it turns off a table lamp in the room. If it is tapped more than once in 1 second, it turns off all the lights in the room.

I created a number variable called doubletap counter. i set it to 0.

Now my programming:

When button 3 is pressed:

Variables->Doubletap Counter = Variables->Doubletap Counter +1

When Button 3 is released:

Delay 1 second

If Variables->Doubletap Counter = 1

Turn off table lamp

Variables->Doubletap Counter = 0

If Variables->Doubletap Counter > 1

Execute scene "room off"

variables->doubletap counter = 0

I noticed that if I go to to agents and variables, the doubletap counter variable does not change, even if I delete all of the stuff under "when button is released" aka anything that would reset it back to 0. So, it's just not adding 1 every time I press the button. If I program so "when ps3 plays" add 1, and I keep pressing play, it changes the variable....

Any ideas?

Link to comment
Share on other sites


I believe the problem might be that you are using the delay 1 second for the button release. Doesn't that keep the button pressed script from running for that 1 second? You probably need to use a timer agent.

Link to comment
Share on other sites

how about this...

When button 3 is pressed:

Variables->Doubletap Counter = Variables->Doubletap Counter +1

When Button 3 is released:

Delay 1 second

? If Variables->Doubletap Counter = 1

Turn off table lamp

? If Variables->Doubletap Counter = 2

Execute scene "room off"

Variables->doubletap counter = 0

you will not see the variable number change when you look at it in Agents/Variables. You have to click off of it (onto another one) and then click back on to see them go. Yours probably got away from you - sometime they go beyond and when you check them they are at 25, 26, etc.

Link to comment
Share on other sites

I actually prefer to do this:

When button 3 is pressed

Variables-> doubletap counter = doubletap counter + 1

Then do the rest of the program under the variable...

When doubletap counter changes:

Delay 1 second

? If Variables->Doubletap Counter = 1

Turn off table lamp

? If Variables->Doubletap Counter = 2

Execute scene "room off"

Variables->doubletap counter = 0

don't mess with the button release.

Link to comment
Share on other sites

Thats wierd, I always program it the same way as mentioned above and was going to mention something about the reset line being in both statements. But it shouldnt matter. Director should only read what its equal to then execute. So those reset lines should work. Im confused.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.