I've been working on a big project and I just ran into the "memory exhausted" issue, so (instead of stooping to 1=1) I'm condensing the ICB by making one big control param array, which I should have done from the beginning. In order for me to understand what refers to what, I need to put a comment at the end of every row so I know what the parameters are for, like so:
declare %CONTROL[$NUM_CONTROLS * $NUM_PARAMS + 1] := (...
-1, 515, 5, 74, 18, -1, ... { $button1 }
-1, 46, 5, -1, -1, -1, ... { $button2 }
-1, 2, 0, -1, -1, -1, ... { etc... }
0)
The problem is, I've been writing in raw KSP this whole time (intentionally), and KSP doesn't let you write comments in the middle of arrays. So I installed Sublime and everything, but I don't want to write in some extended version of KSP. I literally just want to keep writing raw KSP but have the compiler remove the comments. It would also be nice if the compiled code was actually written to a file that I could then link to the script editor, that way I could just save/compile the file, press the "!" button, and stay in performance view like I've been doing instead of having to constantly open it up after every change and paste code. Is this possible? Also, my raw KSP (that works in Kontakt) doesn't compile in Sublime, which seems really counterintuitive. This line gives me a syntax error:
$in := real_to_int(pow(int_to_real($in_knob) / 1000.0, 3.0) * .025)
A couple other things about the control parameter arrays:
Sometimes I don't want to set a control parameter. For example, maybe I don't want to set the height of an element because I just want it to use the default height (or if it's not vertically resizeable). I figured I would just set the array value to -1 for things I don't want to set, and then do this in the loop that applies the params:
$c := 0
while ($c < $NUM_CONTROLS)
$d := $c * $NUM_PARAMS
{ ... }
if (%CONTROL[$d + 4] # -1)
set_control_par(%ID[$c], $CONTROL_PAR_HEIGHT, %CONTROL[$d + 4])
end if
{ ... }
inc($c)
end while
Is this a reasonable way of handling that or should I do something different? And lastly, is there any point to making a control parameter array for string variables? The whole point of this is to condense the code for Kontakt, but string array values can't be set together in the declaration -- they have to be set with separate statements. So you need 1 line to set a value in the string array, and then another line in the array loop to set that control par, totalling 2 lines. If you just set the given control par string right after you declare the ui element, you only need 1 line.
Thanks a bunch.