CHDK Wiki
(Are there more script commands?)
Line 50: Line 50:
 
Primarily:
 
Primarily:
   
CALL
+
*CALL
MOD
+
*MOD
GET_TV
+
*GET_TV
SET_TV
+
*SET_TV
SET_TV_REL
+
*SET_TV_REL
GET_AV
+
*GET_AV
SET_AV
+
*SET_AV
SET_AV_REL
+
*SET_AV_REL
 
   
 
I don't understand how to even compile code, so I'm not sure if these are usable strings/commands for writing scripts, or if these are just used internally by uBASIC. Seeing them listed in these files with the other uBASIC camera commands raised my curiosity to know if these can be used in writing our own scripts.
 
I don't understand how to even compile code, so I'm not sure if these are usable strings/commands for writing scripts, or if these are just used internally by uBASIC. Seeing them listed in these files with the other uBASIC camera commands raised my curiosity to know if these can be used in writing our own scripts.

Revision as of 16:35, 12 May 2007

Since this might be new territory for the average camera owner, writing their own little programs to automate their cameras, it would be a good idea to discuss any concerns, hints, tips, and further information you might have on the subject.

Here are some concerns that come to mind:

I wasn't too sure about uBasic syntax and how variables are defined (integer, floating-point, etc.). I found a uBasic package online that included a lengthy doc file in it, but we are working with a very small subset of all available commands for uBasic. Which commands will work? Which will not?

There is also the discrepancy between camera makes and models that CHDK will work on. I have found that some menu items are not identical between the A-series and Sx SI series of cameras. Scripts will have to be modified at times when using special features of each camera. And some type of standard notation in shared-scripts to alert others to which camera(s) the script was written for.

It would be nice if there was an easy place for all of us to share our tweaked or brand-new scripts. I recently wrote one that allows for a greatly extended use of Focus-Bracketing for a Powershot S3 IS camera, but it requires special instructions for use that are too lengthy to include in the script itself. I am also unsure if this script would work on other makes and models of cameras. How would one go about sharing that script and required documentation?


We could include new scripts in this wiki as new pages. Perhaps we could make a link here like "more scripts" or "user scripts" or something like that. And on that new page, we could place our scripts as subpages.

Harvester

Added in a "User Written Scripts" section. PLEASE advise if I'm doing this all wrong! Or if it should be done some other way. I'm new to this Wikia thingy.

~Keo~


Full Command Syntax Manual?

When hunting online for more uBASIC info I ran across a file inside of a ubasic.zip archive. (Don't ask me where I found that now, it took about an hour's search before I found something more extensive than what was already posted here.)

The included Word DOC was titled "UBASIC86 Version 7.23 - for IBM-PC - User's Manual"

I saved it in a text file for further reference. This is a much more extensive list of commands than what is available in CHDK's uBASIC. Would it be a good idea to post that text file as a new sub-page for this scripting section, in the hopes that someone would go through and glean out the unimplemented commands? Just the info on how variables are defined alone was helpful. As well as now knowing that using goto and gosub are equally valid to call up a label routine.

It was recently reported, for example, that the "print" command in CHDK is limited to a line length of 24 characters. Little things like that would be important to know for the know-nothing script writer, like myself.

Post it, don't post it? What say you?


UBASIC has (almost) nothing to do with uBasic were are talking about, so no need to post it. (UBASIC is a math oriented basic with e.g. very high accuracy) Also the first link on the main uBasic page should be changed.

CHDK uBASIC DOS/Windows Emulator?

Is there any way that a uBASIC emulator can be available for DOS or Windows where we could write our scripts on the computer, and test them BEFORE putting them on the SD card for the camera?

I found I was taking up more time copying the scripts to my SD card, rebooting the camera, going to the menu, testing it, noting the error, going back to the computer ... rinse & repeat infinauseum.

Surely there must be an easier way than this.

Are there more script commands?

GrAnde? I was peeking at some of the source-code for this, and noticed in the uBASIC files that there were quite a few more strings in the tokenizer sections that haven't been mentioned yet.

Primarily:

  • CALL
  • MOD
  • GET_TV
  • SET_TV
  • SET_TV_REL
  • GET_AV
  • SET_AV
  • SET_AV_REL

I don't understand how to even compile code, so I'm not sure if these are usable strings/commands for writing scripts, or if these are just used internally by uBASIC. Seeing them listed in these files with the other uBASIC camera commands raised my curiosity to know if these can be used in writing our own scripts.

I understand what the get/set_TV/AV commands would refer to and how to use them, but I'm not sure on the _REL ones and how those would be used (if at all possible in scripts).

Could you explain a bit about them IF they are usable in scripts? I could then add this into the tutorial section with the other camera commands.

One other thing, have you given any more thought on a better way to implement the ZOOM_IN/OUT commands, such as with a ZOOM_TO? With the zoom_in/out uBASIC command working so painfully slow, and seeing how fast the camera can zoom with the rocker-switch, I wonder why it can't be made better for scripting.

Again, I thank you for all the wonderful work you are doing on this. The words "thank-you" just don't seem to be enough to express how grateful I am for how much you have improved my camera and digital-photography experience.