generalized back and forth script

bytes and moving platforms now use same script