Request for Help Writing a Script - Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes) - CHDK Forum

Request for Help Writing a Script

  • 7 Replies
  • 3639 Views
*

Offline NV1

  • *
  • 5
Request for Help Writing a Script
« on: 31 / January / 2010, 18:43:48 »
Advertisements
Hello, I've used CHDK for months and now have begun to unsuccessfully write a script.  I've researched and problem-shooted (shot?) this script for over 20 hours.  Only now, in my desperation, have I come to bother you all with a request for help.  (Realized late that this might be best in the script section.)

I'm using a Canon TX-1 ver 1.01b with the "allbest #51" 5/08 CHDK version.  For an effect, I'd like to take a shot with the aperture wide open (2.82) and a short shutter speed (say .5 seconds), then a shot immediately after with a higher av (8.0, only because I understand that's the max in a script) and longer tv (2 seconds).  I'd then like to loop this process n times.  This is the simple script I wrote:

@title Test
@param a Shoot count
@default a 20
@param b Interval (seconds)
@default b 4
@param c Av Short Burst
@default c 9
@param d Tv Short Burst
@default d 3
@param e Av Long Burst
@default e 18
@param f Tv Long Burst
@default f -3

t=b*1000

for n=1 to a/2
set_av96 c
set_tv96 d
shoot
set_av96 e
set_tv96 f
shoot
sleep t
next n

end

The timing, number of shots and loop work fine except the script doesn't set the av or tv.  Either it sets it automatically or uses whatever I fix as the av, tv values in the "Extra Photo Operations" menu of CHDK.  I read that the set_av/tv function may not work when following the shoot command, but it didn't work in my script even when I changed it to a single shot and loop.  I tried creating a subroutine but am not skilled enough and kept receiving a parse value or UNK error.

I began with set_av c and set_tv d, etc. which didn't work and thought adding the 96 would resolve the problem.  It didn't.  I tried "set_user_av_id n," "set_user_tv_id m," "print n,m" to determine if the TX-1 has different values than the A650's value set which I've been using.  All it prints is "12, -12."  I'm not sure if that's very meaningful to anyone.  I did try a get_tv/av script on the TX-1 and received a value of 355 for f-stop 3.5 and a value of 160 for (I think) .5 seconds.  However, the script failed when I tried to use these values in the script.

I'm really at my wit's end.  I've lost my whole weekend trying to write this simple script and have a strong feeling I'm making some simple error the more experienced CHDK users might be able to point out quickly.  Regardless, I'd like to make a quick but great thanks to all the developers/users for their work and help on this great tool!
« Last Edit: 01 / February / 2010, 04:36:54 by NV1 »

*

Offline zeno

  • *****
  • 891
Re: Request for Help Writing a Script
« Reply #1 on: 01 / February / 2010, 04:31:26 »
The most likely cause of the problem is that 'shoot' takes some time and is still busy when the next lines of the script area executed. Try putting a 'sleep 1000' immediately after each shoot.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline NV1

  • *
  • 5
Re: Request for Help Writing a Script
« Reply #2 on: 01 / February / 2010, 05:00:58 »
Hi zeno, thanks for your help.  I did as you suggested and the camera does pause for a second after the first shot and an additional second after the second shot, but it's still not changing the av/tv.  I tested an even simpler script that set the av/tv and then shot, but the camera still didn't change the av/tv values.  I feel I'm missing something specifically in the line of code for set_av/tv.  Any idea what it might be?

*

Offline NV1

  • *
  • 5
Re: Request for Help Writing a Script
« Reply #3 on: 01 / February / 2010, 06:33:30 »
I tried set_av96_direct as well to no avail...

*

Offline NV1

  • *
  • 5
Re: Request for Help Writing a Script
« Reply #4 on: 01 / February / 2010, 14:30:25 »
Using press/release "half_shoot" with set_av96_direct x seems to be doing the trick for part of the script.

Re: Request for Help Writing a Script
« Reply #5 on: 01 / February / 2010, 16:09:10 »
I think you are using wrong values for exposure and aperture. For set_av96_direct and set_tv96_direct functions you must use APEX values with a 96 factor:

Av
==
3   f2.8
4   f4
5   f5.6
6   f8
7   f11
8   f16

Tv
==
-6  64s
-5  32s
...
-2  4s
-1  2s
0   1s
1   1/2
2   1/4
...
7   1/128
8   1/256
9   1/512
10  1/1024

For f2.8 and 1/125s the right values are:

set_av96_direct  3*96
set_tv96_direct  7*96

If that works, try to remove the sleep line to save time.

*

Offline NV1

  • *
  • 5
Re: Request for Help Writing a Script
« Reply #6 on: 01 / February / 2010, 22:39:55 »
Thanks so much, jasolo!  It seems I was missing out a few things.  I was indeed using the incorrect values and forgot to add the 96 multiplier in the script.  I also needed to add a press "shoot_half" command to allow the set_av/tv command to work but not a release "shoot_half" command (which was giving control over the av/tv values back to the camera).  The final working script follows for any other novices who may find some help following this more simple problem shooting:

@title Test
@param a Shoot count
@default a 20
@param b Interval (seconds)
@default b 4
@param c Av Short Burst
@default c 3
@param d Tv Short Burst
@default d 2
@param e Av Long Burst
@default e 8
@param f Tv Long Burst
@default f -2

t=b*1000

for n=1 to a/2
press "shoot_half"
set_av96_direct c*96
set_tv96_direct d*96
shoot
press "shoot_half"
set_av96_direct e*96
set_tv96_direct f*96
shoot
sleep t
next n

end
« Last Edit: 07 / March / 2010, 07:31:59 by NV1 »

Re: Request for Help Writing a Script
« Reply #7 on: 02 / February / 2010, 01:43:45 »
"shoot_half" can be removed when using manual focus (exposure is set by set_xx96_direct functions) and also the "sleep" but maybe this last one depends on the speed of the camera and the card.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal