problem with script - Script Writing - CHDK Forum

problem with script

  • 3 Replies
  • 2361 Views
problem with script
« on: 28 / January / 2011, 13:07:33 »
Advertisements
Hi all,

I am having a problem with this script.  I shortened the variable names because I wasn't sure if there was some limit on them.  I had basic timing working, but I'd like the timing to adjust for the day/night.

I get a parse error on line 14 which is just: sT=get_tick_count.



@title Intervalometer

d=2000
n=30000
s=18000
e=72000

set_focus 4500
set_aflock 1

while 1=1
 sT=get_tick_count

 set_backlight 0
 shoot 
 set_backlight 0

 eT=get_tick_count

 ts=get_day_seconds
 
 if ts < s or ts > e then t=n else t=d
 
 c=t - eT + sT
 
 if c < 0 then c=0
 
 sleep c
 set_backlight 0
wend

Walter

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: problem with script
« Reply #1 on: 28 / January / 2011, 14:48:10 »
I am having a problem with this script.  I shortened the variable names because I wasn't sure if there was some limit on them.  I had basic timing working, but I'd like the timing to adjust for the day/night.

I get a parse error on line 14 which is just: sT=get_tick_count.

Code: [Select]
@title Intervalometer

d=2000
n=30000
s=18000
e=72000

set_focus 4500
set_aflock 1

while 1=1
 sT=get_tick_count

 set_backlight 0
 shoot  
 set_backlight 0

 eT=get_tick_count

 ts=get_day_seconds
 
 if ts < s or ts > e then t=n else t=d
 
 c=t - eT + sT
  
 if c < 0 then c=0
  
 sleep c
 set_backlight 0
wend
The problem is in your use of variables - see the CHDK UBasic web page, "Note: The latest builds of CHDK now allow you to have up to 26 user-definable variables from a to z, instead of the original 10, There are now a total number of 52 variables available for your use, a to z and A to Z, but the user-definable variables must be in lower-case if used for that purpose. Also be aware that lower and uppercase variables are unrelated. If you use a lower-case j for a variable, it is not the same as using J, and vice-versa."

The UBDB debugger indicates the first error is actually at the "sT=get_tick_count" statement...
UBDebug - An Interactive Development Environment for CHDK uBasic Scripts: http://zenoshrdlu.com/kapstuff/zubdb.html
« Last Edit: 28 / January / 2011, 15:00:48 by SkyWalker9 »

Re: problem with script
« Reply #2 on: 28 / January / 2011, 15:52:24 »
Thanks, I figured that out after a few more go-rounds.

Cool, I didn't realize there was a debugger.


Thanks,

Walter

*

Offline reyalp

  • ******
  • 14125
Re: problem with script
« Reply #3 on: 28 / January / 2011, 16:22:10 »
Thanks, I figured that out after a few more go-rounds.
If you use lua rather than ubasic, you can use longer names for variables and use as many as available memory permits.
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal