Script Newbie - General Help and Assistance on using CHDK stable releases - CHDK Forum

Script Newbie

  • 21 Replies
  • 6184 Views
Script Newbie
« on: 21 / November / 2017, 16:31:13 »
Advertisements
Hi, could somebody help point me to help for beginners running a script?  I'm trying to run surveillance_lantern.lua. I have the latest v1.4 of CHDK installed as autostart but how do I know if this script or any (older) script is compatible or are all scripts compatible? This script starts with a message in red referring to CHDK release V1.3. I also see: AUTOSTART uBasic 1 unK stat ****TERMINATED*** How do I know if a script is actually running or if it has bombed out with an error, is this what I'm getting? Although I'm familiar with CHDK features, this is the first time I've tried to run a script. If I  can get some confidence I will try writing my own simple scripts.

*

Offline reyalp

  • ******
  • 14109
Re: Script Newbie
« Reply #1 on: 21 / November / 2017, 16:49:40 »
I also see: AUTOSTART uBasic 1 unK stat ****TERMINATED*** How do I know if a script is actually running or if it has bombed out with an error, is this what I'm getting?
This error means that script name didn't end in .lua, so CHDK tried to run it as uBasic. Make sure the extension is just .lua, not .lua.txt or something like this.

You also need to make sure the script is saved as plain ANSI / ASCII text, not unicode.
Don't forget what the H stands for.

Re: Script Newbie
« Reply #2 on: 22 / November / 2017, 14:50:22 »
I think the error message is saying there's an unknown (wrong) statement. The .lua file was copied to the CHDK folder straight from the posted winzip file in the surveillance lantern thread without editing. I've PM'd the author because something basic is wrong (forgive the pun!). I can run the default .lua scripts in the 1.4 CHDK download o.k

*

Offline reyalp

  • ******
  • 14109
Re: Script Newbie
« Reply #3 on: 22 / November / 2017, 15:46:32 »
I think the error message is saying there's an unknown (wrong) statement
Yes, but this specific message is only generated for ubasic scripts, not a Lua scripts.

This means CHDK has tried to run a lua script as ubasic, and the only way this happens is if the actual extension is not .lua.
Don't forget what the H stands for.


Re: Script Newbie
« Reply #4 on: 22 / November / 2017, 19:57:18 »
OK, I'm really poor at programming but the scripts I'm trying to run seem to have bugs in it or I haven't understood it was posted up here just to give members ideas and wouldn't run? There's no closing syntax for the rem comments which I think creates the ubasic error and the IO file statement to the user definitions text file is not consistently named, even though it's in the card root. I can now get to line 36 but can't get the user definitions file read yet. Well I think it may have got further because after creating the same filenames in the lua script and ud file I no longer get the sfile (not found) errors,  the camera buttons are all dead and I've got a black screen!  Perhaps I need the lua script emulator to do some debugging?

I've got 'something' working but the script needs more debugging to be useful. I'll re-post the zip file and ask if somebody with CHDK script experience can check if it works and I'm just a dumbo, or help me understand where I and the script are going wrong? All credit to the original author,  because a  lot of thought and work has gone into it, but I'm struggling.

*

Offline srsa_4c

  • ******
  • 4451
Re: Script Newbie
« Reply #5 on: 22 / November / 2017, 21:01:17 »
OK, I'm really poor at programming but the scripts I'm trying to run seem to have bugs in it or I haven't understood it was posted up here just to give members ideas and wouldn't run?
That script is/was part of a product.
It will only run correctly on a few camera models (Elph 115 was mentioned). It needs changes in order to work correctly on other models. For example, it sets up the camera using key presses, expecting a certain Canon menu layout.
If you start it without adapting it, it will likely do something unexpected and likely mess up camera settings.

Your other problem might be related to filename/path length. Try renaming the script to "spy.lua".

Re: Script Newbie
« Reply #6 on: 23 / November / 2017, 05:13:15 »
Thanks that explains a lot. But I think my starting problem was the filename of the text file called in the script was not the same as the text filename bundled with the zip file and the script halted at line 36 not able to do anything. Now you have explained it is camera model specific, I will just use it for education because some of the routines to overwrite old files when card storage is low interest me. As does dealing with the 9999 limit on filenames and the way Canon auto creates new folders of 2000 file names each folder. The author said his script can run the spy camera for 2.5 years. What I don't know is if the Elph doesn't have this limitation on lots of file names like my older A560s. Thanks again.

Re: Script Newbie
« Reply #7 on: 23 / November / 2017, 05:43:27 »
Thanks that explains a lot. But I think my starting problem was the filename of the text file called in the script was not the same as the text filename bundled with the zip file and the script halted at line 36 not able to do anything. Now you have explained it is camera model specific, I will just use it for education because some of the routines to overwrite old files when card storage is low interest me. As does dealing with the 9999 limit on filenames and the way Canon auto creates new folders of 2000 file names each folder. The author said his script can run the spy camera for 2.5 years. What I don't know is if the Elph doesn't have this limitation on lots of file names like my older A560s. Thanks again.
As I posted in the other thread you started on this subject, the ultimate intervalometer will optionally automatically delete the oldest images if your SD card is full. And it runs on any CHDK enabled camera.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Script Newbie
« Reply #8 on: 23 / November / 2017, 10:20:09 »
Ultimate wasn't happy with my A560. Card is 4Gb single partition CHDK 1.4, lua script started, fired a couple of shots then blank screen, shutdown and nothing with log saying SD card full!

Quote
Day -- NOV 23 15:11:35:2017 === Ultimate v4.5 : 15:11 ===
Day -- NOV 23 15:11:36:2017 CHDK 1.4.1 a560 100a Oct 29 2017
Day 1 NOV 23 15:11:36:2017  int:60 zoom:nil inf:false minTV:9999 mode:true
Day 1 NOV 23 15:11:36:2017  startHr:9 startMin:0 dawn:false
Day 1 NOV 23 15:11:36:2017  endHr:17 endMin0 dusk:false dow:0
Day 1 NOV 23 15:11:36:2017  lat:449 lon:-931 utc:-6 toffset0
Day 1 NOV 23 15:11:36:2017  HDR:0 offset:192 shots:1 delay:0 max:0
Day 1 NOV 23 15:11:36:2017  reboot:3 rebootHr:2 LCD day:1 LCD nit:4 Batt:0
Day 1 NOV 23 15:11:36:2017  DLed:0 NLed:0 ptp:false theme:0 log:2
Day 1 NOV 23 15:11:36:2017  del:0 debug:false
Day 1 NOV 23 15:11:45:2017 unable to check exposure
Day 1 NOV 23 15:11:46:2017 start time : 09:00 stop time : 17:00
Day 1 NOV 23 15:12:00:2017 Oldest image set to : 100CANON/IMG_0146.JPG
Day 1 NOV 23 15:12:00:2017 V: 2.780 T: 26 IMG_0146.JPG tv: 1/30 f: 2.7 ISO: 5 bv: 0
Day 1 NOV 23 15:12:00:2017 SD card full - shutting down

Re: Script Newbie
« Reply #9 on: 23 / November / 2017, 11:25:20 »
Ultimate wasn't happy with my A560. Card is 4Gb single partition CHDK 1.4, lua script started, fired a couple of shots then blank screen, shutdown and nothing with log saying SD card full!
Actually, unlike the lantern script, ultimate appears to run quite well. It starts up, creates a log file, takes a shot, and then decides that the card is full so it shuts down gracefully.  Hard to complain too much about that.  The question is why does the script think the card is full?

I too have an A560.  I set it up to your exact configuration and it runs fine - merrily shooting pictures once a minute until I get bored watching it. It's not an issue with the A560 port of CHDK.

Therefore, it appears there is an issue with your SD card configuration. My guess is that it's one of the same issues you were having here : Help, New 16Gb card won't work with CHDK Canon A650 IS! You card is likely setup with a dual partition scheme but not configured to boot to the larger partition.           

One way to check that is to open the CHDK menu, go to Miscellanous Stuff, and select the File Browser.  At the bottom of the file browser window you will see what CHDK thinks is the remaining space on your card.  You can use the OSD Filespace icon to do the same thing.  Or, with CHDK loaded and ready to run the script, exit <ALT> mode and start shooting photos manually. How many can you take before the camera tells you the SD card is full?


Quote
Day 1 NOV 23 15:11:36:2017  del:0 debug:false
Incidentally, if you scroll down through the script parameters to the one that says Action if card full and set it to [ Delete ] , you should be able to watch it shoot one shot, delete it, shoot another shot, delete it, over & over with your SD card configuration.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal