Quote:
Originally Posted by Anatole
Hey,
I have a Boolean control set so that when a joystick button is pressed and released, it switches a case statement.
Since the joystick button is momentary I have it set up so:
True + False = True, then the next True+False sets it back to False. In essence, pressing & releasing the joystick button toggles the case structure.
Now, my question is, I have a sequence inside each case structure. I want to be able to toggle the case structure programmatically when the sequence is finished. (Basically, the program can run back and forth between true and false, but the user can hit the joystick button to manually override the back and forth.)
Any ideas on how I can do this?
Thanks!
|
We do not like to use sequence structures inside of our code because if a processing error occurs in the sequence it holds up the rest of the code. Therefore, we use a case machine to do all of our sequence processing (via feedback nodes or through globals. Feedback nodes wherever possible though). What happens is if a user control is pressed and the state of the case machine is in the default, or do nothing stage, we then switch the case to the beginning of the sequence's case. Then, once a certain condition is met after continuous iterations of the specific case, we then add 1, or set the state control to the next state that needs to be done. Each stage exists in a specific case. We keep doing this until the operation is complete. Then, set the state to the default state where it does nothing. At that point, the user control can activate the sequence all over again. If the user control is pressed during the operation, it doesn't do anything because it is programmed to only start the sequence if it is residing in the default state.