I tried something like:
sys.sydout.write("=set_zoom(64)\n=press('shoot_half')")
so that whenever I would press a button to zoom in, I would press shoot half to focus in... But the camera isn't really focusing. Is there a better approach to something like this?
The reason this doesn't work is that CHDK script key press functions only stay in effect when the script that called them is running. The chdkptp '=' command runs one script each time you use it, so in your example, the key is pressed and released immediately.
If you want to wait for the camera to focus, you could do something like
=press'shoot_half' repeat sleep(10) until get_shooting()
It's possible get_shooting() could never become true in some case, e.g. if autofocus fails, so it's safer to include a timeout like
=press'shoot_half' t0=get_tick_count() repeat sleep(10) until get_shooting() or get_tick_count() - t0 > 1000
Once the script ends and half shoot is released, the camera will still try to focus again the next time you try to record video or shoot, but focus should be pretty close if the scene doesn't change much.
If you want half shoot to stay held down until you start recording video, you have to take a different approach. The simplest way is probably to use canon "logical events"
http://chdk.wikia.com/wiki/Lua/Lua_Reference/Levent, like
=post_levent_to_ui'PressSwOne'
This will remain in effect until you call
=post_levent_to_ui'UnpressSwOne'
To press full shoot, you'd use 'PressSwTwo'
Note on cameras with a video button, you probably can't use click'video' to start recording while half press is held down. If your camera has dedicated video mode where you can start recording with the shutter button, you could use that.