(A discussion about uBasic and writing scripts for CHDK.) |
Waterwingz (talk | contribs) No edit summary Tag: rte-source |
||
(24 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
+ | {|align="right" |
||
− | 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. |
||
+ | |__TOC__ |
||
+ | |} |
||
+ | [[wikipedia:Help:Talk_page|Help: talk pages]], [[wikipedia:Wikipedia:Talk_page_guidelines|talk page guidelines]] |
||
+ | this program gives an error on line 20; also, it doesn't follow line by line while walking through the if then else portion. can someone help me? my e-mail is leavemsg1(at)gmail.com; I'm not sure if I will be able to find my way back to this forum. thanks in advance with any/all help. |
||
− | Here are some concerns that come to mind: |
||
+ | 10 CLS |
||
− | 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? |
||
+ | 12 INPUT N |
||
+ | 14 IF SQRT(N) = INT(SQRT(N)) THEN |
||
+ | 16 PRINT SQRT(N) |
||
+ | 18 ELSE |
||
+ | 20 D = .576129365#: E = 2 * INT(LOG(N)/LOG(10)) |
||
+ | 22 M1 = N ^ D |
||
+ | 24 M2 = M1 ^ EXP(1) |
||
+ | 26 FOR I = 1 TO E |
||
+ | 28 M3 = INT(D * I * M2) |
||
+ | 30 FOR J = -E TO E |
||
+ | 32 Z1 = N: Z2 = M3 + J: Z3 = 1 |
||
+ | 34 IF Z1 > Z2 THEN TMP = Z1: Z1 = Z2: Z2 = TMP |
||
+ | 36 WHILE (Z3 <> 0) |
||
+ | 38 Z3 = Z1 MOD Z2: Z1 = Z2: Z2 = Z3 |
||
+ | 40 WEND |
||
+ | 42 IF Z1 > 1 AND Z1 < N THEN |
||
+ | 44 PRINT Z1: I = E: J = E |
||
+ | 46 END IF |
||
+ | 48 NEXT J |
||
+ | 50 NEXT I |
||
+ | 52 END IF |
||
+ | 54 GOTO 12 |
||
+ | Bill [[Special:Contributions/108.242.169.13|108.242.169.13]] 00:46, February 5, 2015 (UTC) |
||
− | 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? |
||
+ | |||
+ | See http://chdk.setepontos.com/index.php?topic=12226.msg120418#msg120418 |
||
+ | |||
+ | [[User:Waterwingz|Waterwingz]] ([[User talk:Waterwingz|talk]]) 01:46, February 5, 2015 (UTC) |
Revision as of 01:47, 5 February 2015
Help: talk pages, talk page guidelines
this program gives an error on line 20; also, it doesn't follow line by line while walking through the if then else portion. can someone help me? my e-mail is leavemsg1(at)gmail.com; I'm not sure if I will be able to find my way back to this forum. thanks in advance with any/all help.
10 CLS 12 INPUT N 14 IF SQRT(N) = INT(SQRT(N)) THEN 16 PRINT SQRT(N) 18 ELSE 20 D = .576129365#: E = 2 * INT(LOG(N)/LOG(10)) 22 M1 = N ^ D 24 M2 = M1 ^ EXP(1) 26 FOR I = 1 TO E 28 M3 = INT(D * I * M2) 30 FOR J = -E TO E 32 Z1 = N: Z2 = M3 + J: Z3 = 1 34 IF Z1 > Z2 THEN TMP = Z1: Z1 = Z2: Z2 = TMP 36 WHILE (Z3 <> 0) 38 Z3 = Z1 MOD Z2: Z1 = Z2: Z2 = Z3 40 WEND 42 IF Z1 > 1 AND Z1 < N THEN 44 PRINT Z1: I = E: J = E 46 END IF 48 NEXT J 50 NEXT I 52 END IF 54 GOTO 12
Bill 108.242.169.13 00:46, February 5, 2015 (UTC)
======================================
See http://chdk.setepontos.com/index.php?topic=12226.msg120418#msg120418
Waterwingz (talk) 01:46, February 5, 2015 (UTC)