I will try everything you recommend above but i must note that i find your flippant tone to be extremely obnoxious.
You have no idea how much time i put into isolating that problem.
Well, I don't want to pick a fight, but I guess you don't know how little time I've had lately on my hands for CHDK. If my mind serves me right, that particular message of yours (with the crashing script) was open on my browser for 3 days or so waiting for my attention as I found it to be worrying. So, before going away for a few more days, I cooked up a quick checklist as I thought it was better than not to post anything. I do have an idea of how much time it takes to do these things, and your work is greatly appreciated. I'm prompt by nature, sorry if that makes me appear rude.
2. Adding the sleep commands seems to fix the problem. I'm using sleep(100), can i use a smaller value? I don't understand why this fixes it. None of my other code requires sleep commands for stability.
3. No crashing with the uBasic version either.
What are these usual checks that you mention? While they don't seem necessary I'm still curious about them.
As others have said, ubasic spends 10 ms minimum on each command (the camera's keyboard poll interval) unless patched with more or less experimental code. A sleep(1) command in Lua between commands that potentially require some delay should be enough if similar ubasic code works reliably. MDFB used to crash on some cameras when old versions lifted the shutter using only release half. Adding release full (and thus wasting another 10 ms) fixed it. Even in ubasic scripts with those 10 ms delays the basic debugging method has always been to add sleep between commands when in doubt; stuff like keypresses just can't be done at a too rapid rate or something will be disregarded by the firmware (and to be exact these shutter commands are keypresses).
Flash seems to be the cause of many troubles (e.g. it often crashes the cam on motion detection on my a570, but that's just one thing that's been reported -- some have been fixed, some not) and thus it's best to disable it when pinpointing a problem such as this.
Ae lock on the other hand is not compatible with get_shooting() check loops (they check a propcase which never get the desired value and the script hangs).
reyalp: Maybe these press/release shoot_full/half commands should yield in Lua by default? Could an optional parameter be added to disable that in case it's not desireable in some cases?