Save params triggered by script: possible? - General Discussion and Assistance - CHDK Forum
supplierdeeply

Save params triggered by script: possible?

  • 4 Replies
  • 3126 Views
Save params triggered by script: possible?
« on: 26 / November / 2012, 07:39:36 »
Advertisements
Hi all,

Ubasic, I have:

@param a
@default a 5

If I change the "a" value from the chdk menu then this value is stored for next session.

Is it possible to change the "a" value from inside the script and store the value so that it will be used on nest session? Something like:

@param a
@default a 5
a = 20
(some command to store the a value)

and next time I use the script the a value is set to 20...

is that possible?

thx all


*

Offline lapser

  • *****
  • 1093
Re: Save params triggered by script: possible?
« Reply #1 on: 26 / November / 2012, 11:33:43 »
It's not possible with the current CHDK. Hopefully, it will be added in the future. It would have to be implemented as a new function, since a lot of scripts use the parameters as variables. Here's an idea:

save_param(param_num,value)

It IS possible to change the configuration values in the CHDK menus. I haven't tested it, but I assume the new values are saved if you have that option checked.
http://chdk.wikia.com/wiki/Script_commands#set_config_value
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Save params triggered by script: possible?
« Reply #2 on: 26 / November / 2012, 13:42:54 »
on the conf.c file i saw:

CONF_INFO(  5, conf.script_vars,            CONF_INT_PTR,   i:0, NULL),

maybe  this means I could get/set script_vars using
get_config_value/set_config_value?

*

Offline lapser

  • *****
  • 1093
Re: Save params triggered by script: possible?
« Reply #3 on: 26 / November / 2012, 14:17:21 »
on the conf.c file i saw:
CONF_INFO(  5, conf.script_vars,            CONF_INT_PTR,   i:0, NULL),
maybe  this means I could get/set script_vars using
get_config_value/set_config_value?
That sets the option to save script parameters on exit, not the parameters themselves.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


Re: Save params triggered by script: possible?
« Reply #4 on: 26 / November / 2012, 15:08:49 »
Script parameters are stored in simple text files. In theory you can use lua commands to open such file, write changes and close it - then you'll have changed parameters. However I'm not sure whether menu reads the params each time is called. You'd need read the source or just experiment.

You can try to edit the script config files on-camera using build-in CHDK text editor and check menu shows changed values.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal