scripting help - Script Writing - CHDK Forum

scripting help

  • 5 Replies
  • 1664 Views
scripting help
« on: 17 / February / 2011, 08:31:40 »
Advertisements
im trying to write a Script for the Powershot SX130, but have no clue what i am doing programming wise

what the script is going to do is record a movie for a set time of 9:59 stop, save the file and start again

how do i do this?

this is what i have so far but i have a feeling im going about it the wrong way

:loop
shoot_movie_for 9:59
goto loop


*

Offline zeno

  • *****
  • 884
Re: scripting help
« Reply #1 on: 17 / February / 2011, 12:53:50 »
Almost right -
 the middle line should be
   shoot_movie_for 599
(time is in seconds)
a the last line should be
    goto "loop"
(label should be in quotes)

The shoot_movie_for command is an SDM command - won't work under CHDK of course.

You might find my uBasic debugger (works under Windows or OSX) useful to check your scripts. Download it here:
http://www.zenoshrdlu.com/kapstuff/zsdmubdb.html

There's a CHDK version too.
« Last Edit: 17 / February / 2011, 12:57:24 by zeno »
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

Re: scripting help
« Reply #2 on: 17 / February / 2011, 12:59:31 »
shoot_movie_for 9:59

You cannot do that, time has to be in seconds.

You have to write:

shoot_movie_for 599

The movie will not be precisely 9:59 long.

Re: scripting help
« Reply #3 on: 17 / February / 2011, 13:06:02 »
so if shoot_movie_for is an sdm command what command do i need to use instead

also will this save each file when its done or just a endless loop im doing this to try to avoid the 10:00 limitation but if it doesnt save after 9:59 it will eventually hit the 4gb limitiation


*

Online reyalp

  • ******
  • 11846
Re: scripting help
« Reply #4 on: 17 / February / 2011, 16:32:42 »
so if shoot_movie_for is an sdm command what command do i need to use instead

also will this save each file when its done or just a endless loop im doing this to try to avoid the 10:00 limitation but if it doesnt save after 9:59 it will eventually hit the 4gb limitiation
Just do what you would do with the buttons:
1) click shoot,
2) sleep for however long you want to record,
3) click shoot again to stop.

Repeat for as many times as you want.
My very simple video intervalometer might serve  as a starting poing.
Code: [Select]
--[[
@description video interval
@param a rec minutes
@default a 0
@param b rec seconds
@default b 10
@param c sleep seconds
@default c 2
@param d count
@default d 2
--]]

rec_time= a*60*1000 + b*1000
sleep_time = c*1000

-- need to wait a bit before start
sleep(1000)
while d > 0 do
press("shoot_half")
sleep(500) -- give AF a chance
press("shoot_full")
release("shoot_full")
release("shoot_half")
sleep(rec_time)
click("shoot_full")
sleep(sleep_time)
d = d - 1
end
Note the above is lua, not ubasic, so it won't work on SDM, and the file must have a .lua extension.
Don't forget what the H stands for.

Re: scripting help
« Reply #5 on: 17 / February / 2011, 16:46:48 »
outslider posted a better version of what i was trying to do in CHDK SX130 im just going use try and use his version thank you for the help

 

Related Topics