What's new

Help with script snapshots

Claud9

Active Member
Hello,
I have a problem with my own scripted instrument.
I have created some snapshots but when I load them the value of some knobs I have created does not reflect their real value. For example, I have a snapshot where in my own GUI the volume knob indicates 0 DB but in reality, its value is -5.
When I have scripted the knobs for all of them I have added the "make_persistent" and "read_persistent_var" commands so what showed in my GUI should reflect the real value.
I read on KSP manual about the command "set_snapshot_type()", is this command related to my problem?

Thanks a lot in advance for any help!
 
Update: the snapshots are giving me problems are the ones I have created prior to some scripting changes in my instrument. If now (with all changes done) I create a snapshot everything works when I re-load it.
So basically I don't know why in those snapshots that I have created prior to the instruments mods in some cases the value of the knob in my GUI does not reflect the real value of it. Any idea why? The point is that I have already saved a lot of snapshots and I should fix them by hand one by one...
 
When using snapshots, forget about read_persistent_var. Use snapshot type 1, and do any things you would do after read_persistent_var in "on persistence_changed" callback instead.
 
Hi ED thanks for your help. So I have set up in the "on init" the "set_snapshot_type(1)" and erased all read_persistent_var when i have declared all knobs, sliders and buttons, but is not clear what I have to do in the "on persistence_changed" callback? Do I have to copy all the "on ui_control" in order to have the real value of a knob reflected in my GUI? Also, how is possible that the latest snapshots I saved yesterday (without this latest mods) are working fine and are perfectly loaded? Thnks in advance for any help!
 
In persistence_changed you do stuff you would usually do after read_persistent_var(), so stuff like setting knob/automation labels, or any other stuff that relates to persistent variable values.
 
Top Bottom