Add a new internal command: rotate_selected_obj(<degrees_to_rotate>).
With this command, the following code will keep rotating an object
named "toy" forever (until <ESC> is entered):
exec=disable_undo();
begin_animate();
select_obj_by_name(toy);
while(1,do_it);
unselect_all_obj();
end_animate();
enable_undo();
do_it=rotate_selected_obj(10);