HrClausen
If I have the camera in record mode and use switch_mode_usb(1) it crashes. If it is in preview mode and I use switch_mode_usb(1), it works.
Thanks for the clarification. Was your original problem with set_zoom crashing also caused by this, or is it still unresolved?
FWIW, you should not use switch_mode_usb(1) if the camera is already in record mode, or if you do not have the camera connected to USB. If your script calls switch_mode_usb(1) it should use get_mode() first to check if a switch is needed.
Actually, in all normal cases you should use set_record instead of switch_mode_usb, since it detects whether USB is connected and works like switch_mode_usb() if needed.