![]() |
![]() ![]() ![]() ![]() ![]()
|
next newest topic | next oldest topic |
Author | Topic: setReset: expression problem |
Phi Curtis Member |
![]() ![]() ![]() Hi, I wanted to set up two different buttons that could be used to turn a toggle on and off, and found setReset:, which does exactly that. To make it a little more complicated, I wanted to have the toggle turn on on every third tap of the button that sets the toggle. The reset button works still on every tap. This is that expression: ((!Increment countTriggersMod: 3) eq: 2) setReset: !Decrement [the !Increment and !Decrement should be set as buttons in the VCS]. So far so good. The only problem with this solution is that I prefer that the !Increment button require three taps in a row, in a relatively short amount of time, meaning that if it is tapped twice and then 10 seconds passes, it should require three taps again to make the toggle go on, and also that if the !Decrement button is tapped after the !Increment button has been tapped once or twice, that the Increment button should then be reset to require 3 taps again. It seems like this would be somewhat related to my recent question about resetting a countTriggers expression, but the problem is also a little different here. For a little background as to why I want to do this, I want to have a button that serves as a tap tempo for a bpm: expression (where the !Increment is in the current expression - the new tempo is set on the third tap), and then another button that serves to jump to an alternative tempo whenever that button is pressed. Thanks for whatever help you can give - this is giving me a headache right now! best, IP: Logged |
SSC Administrator |
![]() ![]() ![]() code:((!Increment countTriggersMod: 3) eq: 2) setReset: !Decrement "The only problem with this solution is that I prefer that the !Increment button require three taps in a row, in a relatively short amount of time, meaning that if it is tapped twice and then 10 seconds passes, it should require three taps again to make the toggle go on, and also " Maybe the Reset value could be !Decrement OR <!Increment hasn't changed in 10 seconds> code:!Decrement + (1 - (!Increment hasChangedInLast: 10 s))) "and also that if the !Decrement button is tapped after the !Increment button has been tapped once or twice, that the Increment button should then be reset to require 3 taps again." Would the logic be something like this? OR (!Increment countTriggersMod: 3) LessThanOrEqualTo 2 AND !Decrement code:!Decrement + (((!Increment countTriggersMod: 3) le: 2) * !Decrement) IP: Logged |
Phi Curtis Member |
![]() ![]() ![]() quote: Hi SCC, Thanks - this doesn't quite work as I would like. The full expression I think you are suggesting I think is: code:((!Increment countTriggersMod: 3) eq: 2) setReset: (!Decrement + (((!Increment countTriggersMod: 3) le: 2) * !Decrement)) With this code, I get almost the behavior I want, but if I click !Decrement, I only have to click !Increment twice before the entire expression turns positive. I want clicking !Decrement to reset the count so that I need to click three times before the expression = 1. I'm sure the hasChangedInLast expression will work fine. I still wish that countTriggers and countTriggersMod: would have a reset: component, which, after a positive number is sent to reset, would cause the count to go to zero on the next trigger... That said, I'm sure there is a way to do this with the current count expressions, it just might be a bit complicated. best, IP: Logged |
Phi Curtis Member |
![]() ![]() ![]() I've got code now that does what I want (excluding the hasChangedInLast: part for now): code: The only glitch is that the first time after compiling, the !TriggerCount (what I was previously calling !Increment) needs to be triggered 4 times before the expression becomes 1. This is due to the countTriggersMod expression starting at -1 before any triggers have been received. What would be a good way to trigger the count (ie bring the count up to 0) upon launching? thanks, IP: Logged |
Phi Curtis Member |
![]() ![]() ![]() So this is what I arrived at to get the expression to work right, minus the timing feature: code: The expression equals 1 when !TriggerCount has been triggered 3 times, and goes to 0 when the !Reset is triggered. Here's the code adding the timing feature. After 4 seconds, if 3 taps on !TriggerCount has not been completed, the count resets itself and it will need 3 new taps to set the toggle: code: [This message has been edited by Phi Curtis (edited 12 July 2008).] IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() ![]() |
This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.