Page 1 of 1

String array to preset string.

Posted: Sun Mar 31, 2019 8:45 pm
by lalalandsynth
I am trying to save a string array into a preset but on load it always returns the string array with these "/////"
Any thoughts on this ?

preset array.jpg
preset array.jpg (187.71 KiB) Viewed 11798 times

Re: String array to preset string.

Posted: Sun Mar 31, 2019 8:47 pm
by wlangfor@uoguelph.ca
hmm, odd I've never had that happen before.
Sorry I don't have My PC available to Me ATM but if I did I'd sort it out for You, GL.

Re: String array to preset string.

Posted: Sun Mar 31, 2019 9:21 pm
by lalalandsynth
This is what it looks like opened in Sublime text.

So It obviously saves it like that ?
preset string.jpg
preset string.jpg (95.76 KiB) Viewed 11796 times

Re: String array to preset string.

Posted: Sun Mar 31, 2019 10:54 pm
by trogluddite
Multi-line preset strings have always been a problem, but this seems to be a rather new spin on it (I think you're using a later version of FS to me, judging by the extra inputs on your VST String primitive.)

The extra data in the file represents line endings, which in Windows are always a sequence of two characters; CTRL-R (carriage return) followed by CTRL-N (new-line). Backslash is often used as an escape character to indicate that what follows is a control character (as it is in Ruby - "Line1\r\nLine2" would be a two-line String.)

In older versions of FS, you couldn't have line breaks in a preset String at all, because each parameter was allowed only one line of the file, and any new line characters got interpreted literally as starting a new row of the table, messing up the data. It looks as if newer versions of FS have tried to get around this limitation by using escaped control characters to mark line endings - but the doubled backslashes are messing this up. The intent seems pretty clear, so I'd say that this is certainly a bug in FS.

For both the old and this new problem with multi-line VST Strings, you can work around them by joining the array elements into a single String with the "String Array to String" primitive, using a separator character of your choice (e.g. a comma), and then use the "Split String" primitive to convert back to a string array. However, note that a VST String can only contain 255 (IIRC) characters, so you need to be careful that your array isn't too large!

Re: String array to preset string.

Posted: Sun Mar 31, 2019 11:32 pm
by lalalandsynth
Excellent ! , Thanks for this Trog .
Only need to save 24 characters but 24 sets of them so 288 if i joined it into one string array .
Will report this as a bug .

Re: String array to preset string.

Posted: Thu Apr 11, 2019 10:23 pm
by lalalandsynth
Reported as a bug in the ALPHA , bug found , fixed.