audiothing
Active Member
I'm working on a script for one of my new instruments. I have few questions about presets, arrays and resource container.
For the preset system I used arrays and the functions save_array/load_array. First I used one array per preset, then I switched to one array per parameter to clean the script a bit. Works as I wanted without problems.
Then I saw this on the KSP manual:
declare %presets[10*8] := (...
{1} 8,8,8,0, 0,0,0,0,...
{2} 8,8,8,8, 0,0,0,0,...
{3} 8,8,8,8, 8,8,8,8,...
{4} 0,0,5,3, 2,0,0,0,...
{5} 0,0,4,4, 3,2,0,0,...
{6} 0,0,8,7, 4,0,0,0,...
{7} 0,0,4,5, 4,4,2,2,...
{8} 0,0,5,4, 0,3,0,0,...
{9} 0,0,4,6, 7,5,3,0,...
{10} 0,0,5,6, 4,4,3,2)
2D Arrays, right? I can't figure out how to add and recall dynamically the data from these arrays. It would help a lot having one 2D array for storing all presets. Tips/help on this?
Anyway, not a big problem working with several arrays. Now I just want to store the data into the resource container (previously created) but, when I call the save_array function, it creates a directory /Data/. Is there a way to save arrays directly into the resource container? If not, how can I have a preset system without saving external files?
Thanks in advance!
For the preset system I used arrays and the functions save_array/load_array. First I used one array per preset, then I switched to one array per parameter to clean the script a bit. Works as I wanted without problems.
Then I saw this on the KSP manual:
declare %presets[10*8] := (...
{1} 8,8,8,0, 0,0,0,0,...
{2} 8,8,8,8, 0,0,0,0,...
{3} 8,8,8,8, 8,8,8,8,...
{4} 0,0,5,3, 2,0,0,0,...
{5} 0,0,4,4, 3,2,0,0,...
{6} 0,0,8,7, 4,0,0,0,...
{7} 0,0,4,5, 4,4,2,2,...
{8} 0,0,5,4, 0,3,0,0,...
{9} 0,0,4,6, 7,5,3,0,...
{10} 0,0,5,6, 4,4,3,2)
2D Arrays, right? I can't figure out how to add and recall dynamically the data from these arrays. It would help a lot having one 2D array for storing all presets. Tips/help on this?
Anyway, not a big problem working with several arrays. Now I just want to store the data into the resource container (previously created) but, when I call the save_array function, it creates a directory /Data/. Is there a way to save arrays directly into the resource container? If not, how can I have a preset system without saving external files?
Thanks in advance!