Working on first script (intervalometer) and need help - Script Writing - CHDK Forum

Working on first script (intervalometer) and need help

  • 2 Replies
  • 1622 Views
Working on first script (intervalometer) and need help
« on: 04 / December / 2011, 08:50:27 »
Advertisements
Hi guys! Recently I decided to get a G12. I already have a 60D, but wanted something smaller than I can carry wherever I go. Since I've been using Magic Lantern for quite some time now, the first thing that I'm doing when the camera arrives is install CHDK! :)

I really love what you're doing here, and the amount of people participating in it is great! So I thought I'd have a look at scripting, and found it quite easy (by following the guides and info on the wiki).

I've created my first simple intervalometer, mainly to get an idea of the syntax and functions. I don't know if it works since I haven't tested it yet, and as such I want those of you who are more familiar to check the script below for any errors, so that I can learn from them!

Code: [Select]
@title Intervalometer
@param a Number of shots
@default a 5
@param b Interval (seconds)
@default b 10
@param c Screen mode (1=on, 0=off)
@default c 1
@param d Turn off camera when done (1=on, 0=off)
@default d 0
if a<1 then let a=2
if b<2 then let b=2

if c=1 then click "display"
A = a

do
cls
print "Shots remaining:", a
if a=A then shoot else click "shoot_full"
a=a-1
sleep b*1000
until a=0

if c=1 then click "display"
print "Interval shooting ready"
playsound 4
if d=1 then shut_down

end

Re: Working on first script (intervalometer) and need help
« Reply #1 on: 04 / December / 2011, 09:28:52 »
I guess that by click"shoot_full" you think to end the script? That's not correct. The 'click' command sends the button to the Canon firmware, so it won't be used by CHDK (end the script) but by Canon firmware (and will cause a shoot;) ). I'm not familiar with Basic, but I guess you can add a label an the end of the script and when script has to end just goto there.

I guess that the rest is OK, but that's only at first look:)
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Working on first script (intervalometer) and need help
« Reply #2 on: 04 / December / 2011, 09:42:48 »
I guess that by click"shoot_full" you think to end the script? That's not correct. The 'click' command sends the button to the Canon firmware, so it won't be used by CHDK (end the script) but by Canon firmware (and will cause a shoot;) ). I'm not familiar with Basic, but I guess you can add a label an the end of the script and when script has to end just goto there.

I guess that the rest is OK, but that's only at first look:)

Thanks! I don't want to end the script with click "shoot_full". From what I understood, shoot and click "shoot_full" are different, as the first one can get the exposure and focus, while the second one just takes a picture without changing exposure or focus. Thus, this line makes sure that focus and exposure are only changed before taking the first image.

The script basically ends when a=0 and no more shots are left.

 

Related Topics