It seems that this script can keep up with 3 seconds interval. I took about 60 shots and every of them stayed in 3 seconds delay. I used cell phone stopwatch (crude way ) to measure it.
get_shooting() is always true when shoot_half is pressed.
click("shoot_full") is equivalent to:
press("shoot_half")
press("shoot_full_only")
release("shoot_full_only")
release("shoot_half")
press("shoot_half") focuses and measures exposure. Then, get_shooting() becomes true when it's finished. It takes a second or two depending on lighting conditions and how hard it is to acquire focus.
press("shoot_half")
repeat sleep(10) until get_shooting()
repeat
click("shoot_full_only")
sleep(3000) -- or whatever interval you want
until false
You can see what's happening, without CHDK, by holding the shutter down half way, then repeatedly pressing it all the way down, then releasing it half way. You can only go so fast until is starts missing pictures.
To take pictures at night, i.e. with long exposures, the best way is just to hold shoot_full in continuous mode, as you discovered. You can set the exposure manually, or with the CHDK overrides in the menu, and just do:
press("shoot_full")
repeat until false
I always use sleep(10) in wait loops, since 10 msec is the minimum sleep time possible. A longer sleep time just delays the exit from the wait loop by a random amount.