trippinbillies41 Posted December 3, 2008 Share Posted December 3, 2008 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 +1When 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 = 0I 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 More sharing options...
MetFan1 Posted December 3, 2008 Share Posted December 3, 2008 Looks like its right, are you sure the programming is one the same button and not accidently on button one press, only becuase i have done that while being very tired. Link to comment Share on other sites More sharing options...
neil12011 Posted December 3, 2008 Share Posted December 3, 2008 go into the variable section and manually set it to 2 or 3 or something like that. then press your button and see if it resets it back to 0 Link to comment Share on other sites More sharing options...
lvs Posted December 3, 2008 Share Posted December 3, 2008 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 More sharing options...
MetFan1 Posted December 3, 2008 Share Posted December 3, 2008 The dely is fine,.. i might even try putting it up to two seconds just to see if the dely works differently on swtches Link to comment Share on other sites More sharing options...
AS2 Posted December 3, 2008 Share Posted December 3, 2008 how about this...When button 3 is pressed: Variables->Doubletap Counter = Variables->Doubletap Counter +1When 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 = 0you 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 More sharing options...
mjtoopes Posted December 3, 2008 Share Posted December 3, 2008 I actually prefer to do this:When button 3 is pressed Variables-> doubletap counter = doubletap counter + 1Then 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 = 0don't mess with the button release. Link to comment Share on other sites More sharing options...
trippinbillies41 Posted December 4, 2008 Author Share Posted December 4, 2008 hey matt, yours worked well! Thanks! I'd still like to know why mine didn't... Link to comment Share on other sites More sharing options...
MetFan1 Posted December 4, 2008 Share Posted December 4, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.