This came to me in PM, but I prefer to answer questions on the public forum so others can contribute and benefit:
Hi reyalp,
I have a question dont know where to post it so directly asking from you.
I have written some small lua scripts which i can execute from ptp console using command loadfile('A/CHDK/SCRIPTS/myScript.lua')(). myScript contains following code:
set_tv96(384)
press("shoot_half")
repeat sleep(50) until get_shooting() == true
press("shoot_full")
sleep(100)
release("shoot_full")
repeat sleep(50) until get_shooting() == false
release("shoot_half")
How do I pass parameters to my function like require shutter speed and what if i want to send more then one value? is there anyway i can send parameters to my script so it takes picture according to my required values? can i some how send this script comma separated values? please kindly give me some help regarding this matter or give me some link where i can read about functions. thank you
You could just set a global variable before you run the script. So if your script starts like this
set_tv96(tv)
press("shoot_half")
repeat sleep(50) until get_shooting() == true
You could just do
lua tv=384 loadfile('A/CHDK/SCRIPTS/myScript.lua')()
You can do this with as many variables as you want.
Alternatively, you could define a function inside your file like
function myshoot(tv,sv,av)
set_tv96(tv)
...
end
Then run
lua loadfile('A/CHDK/SCRIPTS/myScript.lua')() myshoot(394,768,480)