Toggle script
-
This is my attempt at a script that toggles between 1 and 0 when a is pressed.'toggle' is the output value, and can be either 0.0 or 1.0. 'allow_repeat' is intended to stop the script from excecuting again until a is released. The frame detector is just to stop 'toggle' being re-declared as 0.0 every time the script restarts. In sketchyphysics, it just acts like a is the controller.
if(frame<5);toggle=0.0;elsif(a==0.0);allow_repeat=1.0;elsif(allow_repeat==0.0);toggle;elsif(a==0.0);toggle;elsif(toggle==0.0);allow_repeat=0.0;toggle=1.0;else;allow_repeat=0.0;toggle=0.0;end
Can anyone help?? Is there a proper way of doing this (mine seems overly complicated)??
-
Does that work?
I don't think it would. The problem is the toggle and allow_repeat are not saved from one frame to the next.
-
Ohhhh... I was assuming they would be. Maybe something for a future release?
Advertisement