Concise AF-Lock Intervalometer Script - Completed and Working Scripts - CHDK Forum

Concise AF-Lock Intervalometer Script

  • 0 Replies
  • 4123 Views
Concise AF-Lock Intervalometer Script
« on: 31 / December / 2011, 13:03:10 »
Advertisements
Hello everybody, I have been working with waterwingz on a very simple, concise intervalometer script that allows for AF lock before shooting initiates. The script is very small and concise (and thus runs quickly, and takes up little space) and I figured it might be helpful to someone out there. All 3 scripts are .lua scripts.

Obviously, if the camera physically is not capable of focusing on your subject, it will still fail to focus on it with this script. So be sure that your subject is within the focus range of your camera before initiating the script.

To get the script onto your camera, just copy the code and paste it into notepad (or similar software) and save with a file extension of ".lua" without the quotations. Save it in the "/CHDK/SCRIPTS" directory. Be sure that you name the script the same name that follows the "@title" line in the script. For example, the first script must be titled "Interval Shoot.lua" For ease, I also uploaded the "AF Lock Shoot" and "Basic Shoot" scripts as attachments here.

If someone wishes to, they could port these scripts to uBasic scripting, I attempted to and got a "Parse err" on line 9 and I couldn't figure out what was going wrong. So maybe someone who has some more knowledge with uBasic could port this over.

Hope this helps someone out there! Special thanks to waterwingz!

Waterwingz wrote the basic framework for the script, which is now considered obsolete because of the refinements. I still included it for archival purposes here:
Code: [Select]
--[[
@title Interval  Shoot
@param a = interval (sec)
@default a 10
--]]

press("shoot_half")
repeat sleep(100) until get_shooting() == true
release("shoot_half")
repeat sleep(100) until get_shooting() == false

set_aflock(1)

repeat
    click("shoot_full")
    repeat sleep(100) until get_shooting() == true
    sleep(a*1000)
until false

I refined waterwingz's script slightly and added the capability to set the interval duration using both minutes and seconds, and changed the name, as well as added some print commands to let the user know what is occurring during the script. Here is the refined script:
Code: [Select]
--[[
@title AF Lock Shoot
@param a Interval (Minutes)
@default a 0
@param b Interval (Seconds)
@default b 10
--]]

press("shoot_half")
repeat sleep(100) until get_shooting() == true
release("shoot_half")
repeat sleep(100) until get_shooting() == false

print "Setting Focus"
set_aflock(1)

print "Shooting"
repeat
    click("shoot_full")
    repeat sleep(100) until get_shooting() == true
    sleep(a*60000+b*1000)
until false

I also figured I might as well make a script on waterwingz's basic framework that does not lock the focus, so here is the code without focus lock:
Code: [Select]
--[[
@title Basic Shoot
@param a Interval (Minutes)
@default a 0
@param b Interval (Seconds)
@default b 10
--]]

print "Shooting"
repeat
    click("shoot_full")
    repeat sleep(100) until get_shooting() == true
    sleep(a*60000+b*1000)
until false

 

Related Topics


SimplePortal © 2008-2014, SimplePortal