Hi Folks,
I am working on a LUA script. Have been stumbling along OK, but recently hit a wall. I want to be able to pause in the scrip0t for certain lengths of time. So I have been trying to use the sleep global function.
When i do this I get a console message "variable 'sleep' is not declared. If ti matters, this is on a Canon 550d.
My script is supposed to start with an auto-focus, and take 99 more pictures, then auto focus and so on until complete. I have a delay to start so any motion caused by pressing the button to start the script can die down. There is also supposed to be a delay between shots so as not to fill up the buffer.
Code follows:
I am working on a LUA script. Have been stumbling along OK, but recently hit a wall. I want to be able to pause in the scrip0t for certain lengths of time. So I have been trying to use the sleep global function.
When i do this I get a console message "variable 'sleep' is not declared. If ti matters, this is on a Canon 550d.
My script is supposed to start with an auto-focus, and take 99 more pictures, then auto focus and so on until complete. I have a delay to start so any motion caused by pressing the button to start the script can die down. There is also supposed to be a delay between shots so as not to fill up the buffer.
Code follows:
Code Select
require("logger")
-- global logger
test_log = nil
LAF = nil
Number_of_Shots=nil
AF_every_Shot=nil
function main()
test_log = logger("ML/LOGS/LUATEST.LOG")
Number_of_Shots=100
AF_every_Shot=10
menu.close()
console.show()
print "Lunatic!"
sleep(2)
for i=Number_of_Shots,1,-1
do
if ((Number_of_Shots % AF_every_Shot) == 0) then
lunatic_AF()
else
camera.shoot(false)
end
sleep(1.6)
end
print "Press any key to exit."
key.wait()
console.hide()
end
function lunatic_AF()
if lens.name == "" then
printf("No Lens Detected.\n")
return false
end
if not lens.af then
printf("Please enable autofocus.\n")
return false
end
if not lv.running then
lv.start()
assert(lv.running)
end
if lens.af then
LAF=camera.shoot(true)
lv.stop()
return LAF
end
lv.stop()
return false
end -- lunatic_AF
function printf(s,...)
test_log:writef(s,...)
if not console.visible then
display.notify_box(s:format(...), 5000)
end
end
keymenu = menu.new
{
name = "Lunatic - Moon Stack Automation",
help = "Automates Lunar Stack Capture",
select = function(this) task.create(main) end,
}