CHDK/uBASIC/Scripts: Zoom Shoot

Zoom Shoot!

 * Written for/on: Powershot S3 IS, CHDK Build 119 (Changeset 163), or later, required.


 * Also works on: Should work on all of them.

(*NOTE* See note at bottom of script, this script is now obsolete just 2 minutes later due to a new CHDK build that fixes many things. :-) )

This script is more of a novelty than anything, in testing out the new set_zoom and get_zoom commands in CHDK Build 119. It starts out at widest zoom and then steps-in incrementally for the number of shots you want by the number of zoom-steps that you want. I included a flag to set what camera, A-series or S-series, that you are running it on so that it can be optimized for speed on the S-series cameras. Users of A-series cameras, please test the timing of your full-zoom range speed so the strings "if c=0 then sleep 500" can be optimized for your camera too. Adding that number to the Tutorial info will come in handy for future script writers. For the S-series this script was optimized by dividing 1000 milliseconds (high-speed zoom speed for full zoom-range) divided by the available number of steps. That number (8) is then multiplied by number of steps to get the right delay needed for the set_zoom_rel command to work without error. (See note at bottom of this script! :-) )

For a more functional/useful "Zoom Bracketing" script it would probably be best to allow the user to set the beginning and ending zoom position and number of shots between the two. I might work on that. :-) (If someone really really wants that script and can't write it themselves, leave a note in the User Scripts - Page 02 Discussion section. It might give me incentive to write one.)

Documentation/Help (save as a small "zoomshot.txt" file to your /CHDK/SCRIPTS/ folder)

Keep in mind the number of zoom-steps you have available for your particular camera model, doing some mental-arithmetic to choose number of shots + zoom steps accordingly. Example: 16 shots with 8 zoom-steps each will cover the full range of 128 zoom-steps available for an S-series camera. If using this script on an S-series camera: before running the script you should set your zoom-speed manually to high-speed zoom by momentarily zooming with the zoom-rocker at either extreme position, zoom-in or zoom-out. Then release the zoom-rocker and run the script. Failure to do so may cause your camera to shut down due to not enough sleep-cycle time needed if a slow-zoom speed was last used before running this script.

Script Code (save as "zoomshot.bas" to your /CHDK/SCRIPTS/ folder) rem Author ~Keoeeit~ rem Written for S-series rem Should work okay on others

@title Zoom and Shoot @param a Shoot count @default a 8 @param b Steps 1 to (A)8,14 (S)128 @default b 1 @param c Camera Series A=0 S=1 @default c 1

if a<2 then a=8 if b<1 then b=1 if c<0 then c=0 if c>1 then c=1 get_zoom r

if c=1 then print "Manually use hi-speed" if c=1 then print "zoom before script use." if c=1 then sleep 2000 print "Zooming-out..." set_zoom 0 sleep 1000

print "Shoot 1 of", a shoot sleep 400 for s=2 to a print "Zooming-in ", b; "steps..." set_zoom_rel b if c=0 then sleep 500 if c=1 then sleep 8*b print "Shoot", s, "of", a shoot next s

if c=0 then sleep 500 if c=1 then sleep 8*b print "Resetting Zoom..." set_zoom r sleep 1000 click "shoot_half"

end

Well F*&@!!! LOL!!! I just posted this script and worked out all the timings needed for the new set_zoom commands, even put them on the Tutorial page and what does GrAnd do? He releases Build 122 just 2 minutes later where these special sleep delays aren't even needed!!! LOL!!! Thanks GrAnd!! I'll have to update things now. :-) (seriously, THANKS!!! those new changes are going to be MUCH appreciated!!)

Take 2 -- see note above. :-)

In this one you can set the zoom-speed (S-series only), the zoom-speed setting should have no effect on A-series cameras. Speed 1=slow to 10=fast

rem Author ~Keoeeit~ rem For S-series cameras ONLY!

rem CHDK Build 122 or later required @title Zoom and Shoot @param a Shoot count @default a 8 @param b Steps 1 to (A)8,14 (S)128 @default b 1 @param c Zoom-speed 1-10 (S-only) @default c 5

if a<2 then a=8 if b<1 then b=1 if c<1 then c=1 if c>10 then c=10 c=c*10 get_zoom r set_zoom_speed c

print "Zooming-out..." set_zoom 0 print "Shoot 1 of", a shoot for s=2 to a print "Zooming-in ", b; "steps..." set_zoom_rel b print "Shoot", s, "of", a shoot next s

print "Resetting Zoom..." set_zoom r click "shoot_half"

end