Scripting Tutorials? - Script Writing - CHDK Forum

Scripting Tutorials?

  • 13 Replies
  • 3055 Views
*

Offline Opal Lin

  • *
  • 7
  • I'm the QUEEN of da WORLD!!! :D... SO OBEY ME o_O
Scripting Tutorials?
« on: 19 / June / 2012, 20:10:56 »
Advertisements
I've used CHDK on my sd1200is for a while... and want a change. I like it, but its time to GET MORE OUT OF IT!!! :D

There's a lot about scripting here, but not any tutorials. Anyone willing to share what they know? Send me a link to what you've got.

Thx!!!
REMEMBER THESE THINGS :D

1. I'm AWESOME!
2. I'm ASIAN!
3. I'm STUNNINGLY GORGEOUS!
4. I RULE DA WORLD!
5. I'm ONLY 17... BE NICE!
6. Ok... THAT'S ALL!!! ^_^   [And I like CHDK :) ]

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Opal Lin

  • *
  • 7
  • I'm the QUEEN of da WORLD!!! :D... SO OBEY ME o_O
Re: Scripting Tutorials?
« Reply #2 on: 20 / June / 2012, 13:34:20 »
Thanks for that :D

But is there a tutorial that goes through the steps of writing a simple script???
:o
REMEMBER THESE THINGS :D

1. I'm AWESOME!
2. I'm ASIAN!
3. I'm STUNNINGLY GORGEOUS!
4. I RULE DA WORLD!
5. I'm ONLY 17... BE NICE!
6. Ok... THAT'S ALL!!! ^_^   [And I like CHDK :) ]

Re: Scripting Tutorials?
« Reply #3 on: 20 / June / 2012, 13:36:55 »
But is there a tutorial that goes through the steps of writing a simple script???
Its pretty much assumed you know something about programming before you try scripting.  If not,  there are a lot of places other than a CHDK wiki page to start the learning process.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline Opal Lin

  • *
  • 7
  • I'm the QUEEN of da WORLD!!! :D... SO OBEY ME o_O
Re: Scripting Tutorials?
« Reply #4 on: 22 / June / 2012, 21:01:20 »
Like...
REMEMBER THESE THINGS :D

1. I'm AWESOME!
2. I'm ASIAN!
3. I'm STUNNINGLY GORGEOUS!
4. I RULE DA WORLD!
5. I'm ONLY 17... BE NICE!
6. Ok... THAT'S ALL!!! ^_^   [And I like CHDK :) ]

Re: Scripting Tutorials?
« Reply #5 on: 22 / June / 2012, 21:56:38 »
Like...


of if you prefer not to read a "dead tree" version, here's the original version :

http://www.bitsavers.org/pdf/dartmouth/BASIC_Oct64.pdf
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline fe50

  • ******
  • 3117
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: Scripting Tutorials?
« Reply #6 on: 23 / June / 2012, 09:06:38 »
 :D

Re: Scripting Tutorials?
« Reply #7 on: 23 / June / 2012, 09:08:20 »
This is also a useful book which I used to learn lua for CHDK: http://www.amazon.co.uk/The-Canon-Camera-Hackers-Manual/dp/193395258X/ref=sr_1_1?ie=UTF8&qid=1340456781&sr=8-1.

However, as waterwingz said if you haven't done any programming before you may want to start elsewhere.


*

Offline Opal Lin

  • *
  • 7
  • I'm the QUEEN of da WORLD!!! :D... SO OBEY ME o_O
Re: Scripting Tutorials?
« Reply #8 on: 24 / June / 2012, 19:44:36 »
Guess its time to start reading :D
REMEMBER THESE THINGS :D

1. I'm AWESOME!
2. I'm ASIAN!
3. I'm STUNNINGLY GORGEOUS!
4. I RULE DA WORLD!
5. I'm ONLY 17... BE NICE!
6. Ok... THAT'S ALL!!! ^_^   [And I like CHDK :) ]

Re: Scripting Tutorials?
« Reply #9 on: 25 / June / 2012, 19:01:40 »
There is a uBASIC tutorial here: http://chdk.wikia.com/wiki/UBASIC/TutorialScratchpad

... but it's already outdated by changes to CHDK and its interpreter.  That doesn't mean it's hopeless, though.  The popular scripts on the CHDK wiki are generally short.  Print out a few and try to follow one along, line-by-line, with the tutorial beside you, and it will start to make sense.  There's also a PDF version of the tutorial; you'll find a link to it in the introduction on the web page.  Read the whole thing through, then read those scripts you printed.  Chances are, you'll not only understand what you read, you'll get ideas for changes you want to make to improve or customize them.

Here are a few important ways the documentation is outdated:

It says the parameters can only have the names a though j.  Now you can use the whole lowercase alphabet.  In addition, you can use the uppercase alphabet for variables within a script, though you can't bring them out to the menus to be changed before the script is run.  They're strictly internal.

The docs say that the get_xxxx commands are used like this:  get_focus f    where f is a variable I made up to hold the value of the focus distance in mm.  set_focus and the other set_xxxx commands work that way, but the get_xxxx commands are turned around:   f = get_focus  will store the focus distance in f.  You can also use the get_xxxx functions as variables in an equation:  f = get_focus + 10

Some of the commands are obsolete.  My first script crashed over get_tv, which is supposed to get me the current time-value (shutter speed) in the camera.  It's been replaced with get_tv96, which does the same, except that it divides each doubling or halving of the shutter speed into 96 tiny steps.  (I read an article last week about HDR, and the author groused that Nikons can't do shutter speeds in 1/3-steps like Canons, and Canons can't do half-steps like Nikons.  I couldn't help grinning, thinking of 1/96-steps available to CHDK users.)

Just this month, parameters got a new parameter of their own: @range. It allows you to limit the number values that the user can input for any variable.

The docs are so far behind because CHDK is a labor of love by people who love to hack.  Every now and then, somebody stands back and tries to assemble all the information about CHDK or scripting into an organized,  useable reference, and by the time he or she is done, the hackers have jumped ahead again.  So it takes some reading and researching to catch up, but that doesn't make it any less satisfying when your script makes your camera do stuff that no other camera in the world does.  Enjoy.
S3 IS with LensMate filter/hood adapter

 

Related Topics