Parse error - Script Writing - CHDK Forum

Parse error

  • 5 Replies
  • 7338 Views
*

Offline Kalli

  • **
  • 51
  • A620, SX10 IS
Parse error
« on: 07 / December / 2007, 02:09:53 »
Advertisements
Hi
I have a "Parse error" in folloing script but can't find the mistake:

@title Test speed

rem select manual mode
set_prop 0 0

rem set flash off
set_prop 16 2

rem set f8.0
set_prop 39 576

rem set 1/1000
set_prop 40 960

a = get_tick_count
for i=1 to 100
click "shoot_full"
next i
b = get_tick_count
print b-a
end

The script starts well, makes 5 shots, the message "parse error" blinks up followed by a 6th shot, than the script breaks without making it to the "end" command, parse error shows up in top left corner. The camera doesn't hang. Pressing the "print" and all runs normal.
I'm using microfunguy's ver. 1.30 on a A620.

Hope somebody can explain this behavior  :-[

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Parse error
« Reply #1 on: 07 / December / 2007, 07:26:18 »
...
a = get_tick_count
...
b = get_tick_count
...

Is that allowed syntax? Wiki says that  the correct syntax is
Code: [Select]
get_tick_count  a
In the addition, the 'click "shoot_full"' command does not wait for the previous shot is ended. So, the cycle could run though all 100 values and only 5 shots were taken.
CHDK Developer.

Re: Parse error
« Reply #2 on: 07 / December / 2007, 11:31:19 »
If it's a parse error, it should tell youe the line number, that may help track what is offending.

Re: Parse error
« Reply #3 on: 07 / December / 2007, 12:36:16 »
I think he means it should currently, not that it should in future :)

Notepad has a 'go to line' feature, just turn off word wrap (on the toolbar: Format -> Word Wrap) and then click 'Edit -> Go To' or use the shortcut key CTRL-G.

*

Offline Kalli

  • **
  • 51
  • A620, SX10 IS
Re: Parse error
« Reply #4 on: 07 / December / 2007, 13:23:29 »
Code: [Select]
get_tick_count  a
...returns an uBASIC: 15 Unk stmt so the syntax must have been correct before...

However I found the problem myself...

I have to apologize it was my mistake to just show an abbreviated script. The complete script is:
Code: [Select]
@title Test speed

rem select manual mode
set_prop 0 0

rem set flash off
set_prop 16 2

rem set f8.0
set_prop 39 576

rem set 1/1000
set_prop 40 960

a = get_tick_count
for i=1 to 100
click "shoot_full"
next i
b = get_tick_count
print b-a
b = get_tick_count
for i=1 to 100 click "shoot_full" next i
c = get_tick_count
print c-b

end

The error:
uBASIC:22 Parse err

This means to me that within the first for-next-loop just 6 shots are taken without any error.
The parse error occures than inside of the 2nd for-next-loop due to a multi command line.
What really ails me is that the first for-next-loop just takes 6 (sometimes 7) shots instead of 100 and returns no error on that!
That's why I didn't realize that the parse error occured in the 2nd loop...


Re: Parse error
« Reply #5 on: 07 / December / 2007, 14:05:54 »
This means to me that within the first for-next-loop just 6 shots are taken without any error.
The parse error occures than inside of the 2nd for-next-loop due to a multi command line.
What really ails me is that the first for-next-loop just takes 6 (sometimes 7) shots instead of 100 and returns no error on that!
That's why I didn't realize that the parse error occured in the 2nd loop...

yes, "shoot_full" doesn't wait for anything, it just keeps firing (whereas "shoot" waits for focus, writing etc.), so if the camera is busy, the "shoot_full" doesn't do anything, but the script continues in the background.  It unfortunately doesn't work like high speed burst mode, perhaps someone will eventually crack this so we can burst mode without having to set the camera explicitly.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal