The S5 IS has the same lens as the S3, you might want to try this script instead:
http://chdk.wikia.com/wiki/UBASIC/Scripts:_yet_another_DOF_stackerScroll to the bottom for the S3 version.
It automatically divides up the depth of your subject into the required amount of frames needed, depending on the DOF for whatever aperture you select. No need to take shots at 10mm intervals. Mostly because once you put a close-up lens on the camera then those 10mm increments no longer relate to the real subject depth. With a +10 diopter closeup lens on my camera I'd be lucky to get even 20mm (rough guess) of actual subject depth within the whole focusing range of 0mm to infinity. If I set focus bracketing internally or with a script to do 10mm steps that would be 6,553 frames out of the available 0 to 65535 1mm focusing steps.