function switch_touched(value) { if (value) { switch_state++; switch_state %= 3; switch_position = new SFInt32(switch_state); } }