Keyed Momentary On Switch
Benefits:
1. The switch can display the name of the function of the switch (for example, like "roar" in wild bill's raptor scene).
2. The switch displays the key that is used to do the function.
3. The switch displays the state of the switch.
4. The switch separates the states from the control logic. You can put code in the states without regard or caring about the logic.
5. The switch initiates state1 once, preventing multiple restarts of state1 even though the key is held down.
6. The switch sets the state to zero once upon release. This prevents constant resetting of the zero state and allows the state of the item being controlled to be set by the last key pressed.
Rev A: _state0() is initiated only once upon key release.
RevB: Uses code from JakubKubo's
Key input detector.