CHDK Wiki
(get_shooting and shoot)
Line 37: Line 37:
 
''Example of usage (Lua):''
 
''Example of usage (Lua):''
 
​press("shoot_half")
 
​press("shoot_half")
  +
repeat
repeat sleep(50) until get_shooting() == true
 
  +
sleep(50)
 
until get_shooting() == true
 
click("shoot_full")
 
click("shoot_full")
 
release("shoot_half")
 
release("shoot_half")

Revision as of 15:45, 25 December 2011

Note: This page is designed to replace Script commands page in future. Currently it is just a stub.

To documentation writers

It is well known, that documentation should be clear to prevent confusions and avoid many questions from users. This new version of script commands documentation is designed to provide new, complete informations about commands, their usage and examples of code, where this can be used.

I'm sure, that these commands should be ordered by type, for example: shooting-related, hardware-related, console and drawing related. The next odrer should be alphabetical.

The form

Commands should have the form, that is presented below for print command.

print

languages: uBASIC, Lua.

This command provides you a method to display a text on scripting virtual console. Each string will be displayed in new line. Argument may be string or number.

Usage in Lua:

print("Hello World!")

Usage in uBASIC:

print "Hello World!"


Above lines will display following text on virtual console:

Hello World!

Shooting related commands

get_shooting

Commands is used to check, wheter camera is able to take shoot at the moment and all pre-shooting processses are already done. For example when you half press shoot button camera might check focus, exposure and other things. If this is the case when get_shooting comand is run it returns false. If camera is able to shoot the command returns true.

Usage in Lua:

​x = get_shooting()

Usage in uBASIC:

get_shooting x


If camera is able to take a shoot and whole pre-shooting process is done then x will contain true, otherwise - false.

Example of usage (Lua):

​press("shoot_half")
repeat
    sleep(50)
    until get_shooting() == true
click("shoot_full")
release("shoot_half")

Above code emulates half-pressing of shoot button, than waits until camera will be able to take a photo. Then just fully presses shoot button to make a shoot. Above code works essentially like shoot command.

shoot

Languages: uBASIC, Lua.

This command causes camera to perform whole shooting action: it involves all processess that camera do before shoot (just like half pressing shoot button) and then shoots. For example: if in AUTO, P, Tv, Av, or any SCN modes, using the "shoot" command causes the camera to check focus and exposure for each shot. When "shoot" is used in intervalometer scripts this far surpasses the camera's own built-in intervalometer in that the camera only sets exposure and focus once for the initial exposure, as if it was only using the "click 'shoot_full'" command. This "shoot" command in an intervalometer script allows it to compensate for all the things that can change over the course of many minutes and hours.

Usage in Lua:

​shoot()

Usage in uBASIC:

​shoot

Shoot function takes no arguments.