Does f change at all when you use set_focus, or does nothing happen? Could you post an example of what the script does by putting:
print_screen 1
just before "shoot" at the beginning.
Then if you run the script and try to set the focus, then end it and post the contents of the file "LOG_0001.TXT" in the CHDK->LOGS folder, it may be easier to figure out what's going on, as this file will contain everything the script writes to the screen.
(I was initially going to ask if the camera is in Manual Focus mode as cameras with a built-in MF mode need to be for this to work, but your camera does not so I'm not sure yet what's happening).