I’ve written a simple script that lets users set a few values in a dialog before the script runs. It would be nice if the script could remember the values that the user set and reinitialize the dialog with those values the next time it runs. Is there a way to do this?
Currently you can use global Lua variables for this. For example, create:
if not MyScript_params then MyScript_params = {} MyScript_params.test = 123 end
with name of your script instead of MyScript and store all values into this table. This table will store your variables across all calls to all scripts until next start of Aseprite. But this behaviour may change in future versions I suppose.
Also you can save values to files using io.open
and then f:write/f:close
and load them back using io.open
and f:read/f:close
, but it 's more complicated and will require user confirmations.
1 Like
Hi there Other way to save parameters is creating a plugin (script extension) and saving the information in the
plugin.preferences
object.
2 Likes