Scripting Tutorials? - page 2 - Script Writing - CHDK Forum supplierdeeply

Scripting Tutorials?

  • 13 Replies
  • 5768 Views
Re: Scripting Tutorials?
« Reply #10 on: 25 / June / 2012, 19:14:16 »
Advertisements
@kidtree :  nice note !  You covered a lot of ground so I've attached some comments below :

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.
I think I fixed that on the wiki page a month or so ago ?

Quote
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
Several of us started cleaning this up - if you see some of the many spots we missed, please fix them too ?

Quote
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. 
Same comment as above.  If you are not sure - just flag them with a note that says obsolete. Several people monitor all changes to the wiki so it will be noticed.  Some of the people doing the monitoring even know what they are doing.

Quote
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.
Amazingly, some docs have already been added for this - http://chdk.wikia.com/wiki/CHDK_scripting#uBasic

Quote
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. 
Darn those pesky hackers anyway.   Seriously though,  part of the issue is too much documentation on too many wiki pages - many of which are obsolete.  I tried for a crack at that here : http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page which at least list the latest usable links.

Quote
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.
Ahem to that !
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Scripting Tutorials?
« Reply #11 on: 26 / June / 2012, 18:11:07 »
All good points - I hadn't kept up with the latest changes, because if I did, I'd get lost and start experimenting with all the new stuff!  I came across that parameters a through j note on a wiki page yesterday.  I know - too many pages with redundant or obsolete info.  Next time I find it, I'll flag it, if you haven't beat me to it.
Thanks especially for that cross-reference page.  It's my main bookmark for reference.  Yesterday I started expanding & correcting a few of the commands it links to.  I hope I did OK.  One addition I would make to the cross-reference page is a note encouraging people to use their browser's Find function (Control-F in most browsers).  It makes my life so much easier, searching long web pages of any kind!
Can/should the cross-reference be expanded to include the program flow commands - all the conditionals, gosubs, and stuff like that, or is it intended only as a camera-controls reference?
« Last Edit: 26 / June / 2012, 18:17:10 by kidtree »
S3 IS with LensMate filter/hood adapter

Re: Scripting Tutorials?
« Reply #12 on: 26 / June / 2012, 18:49:23 »
Yesterday I started expanding & correcting a few of the commands it links to.  I hope I did OK. 
Thanks for that - all the changes I checked were correct and long overdue.

Quote
One addition I would make to the cross-reference page is a note encouraging people to use their browser's Find function (Control-F in most browsers).  It makes my life so much easier, searching long web pages of any kind!
That's kind of a generic "how to use the internet" thing - not sure it belongs there ?  Incidentally, did you know that if you are searching through a long forum thread,  you can use the "Print" button on the upper right of the page to get the whole thread on one page and then use CTRL-F to quickly search through it ?

Quote
Can/should the cross-reference be expanded to include the program flow commands - all the conditionals, gosubs, and stuff like that, or is it intended only as a camera-controls reference?
We talked about that on IRC and the forum quite a bit.  The consensus was not to include programming language instructions on the cross-reference. 
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 #13 on: 28 / June / 2012, 17:29:58 »
I'll try learning the way you said...: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 :) ]


 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal