• SONAR
  • CAL Script: Is there arrays?
2018/08/08 21:51:32
rogeriodec
Is there any kind of array of variables in CAL Script?
2018/08/08 22:46:14
msmcleod
no arrays.
 
CAL is very basic as a scripting language. 
 
This is about the most comprehensive guide out there:
http://members.ziggo.nl/t.valkenburgh/Cakewalk%20Application%20Language%20Programming%20Guide.pdf
 
2018/08/08 22:57:07
msmcleod
Thinking about it, if you really needed arrays you could temporarily create a MIDI track and use MIDI data to store your values. It's a very nasty hack though, but might work, and it'll probably be dead slow.
 
To index a particular value you'd need to traverse the array from the beginning each time - i.e.  use a combination of forEachEvent and a counter variable.
 
2018/08/08 23:26:49
rogeriodec
Thanks again Mark! Don't you think that after decades, it's time to (now CbB) have a decent script language? 
2018/08/09 11:34:04
KPerry
Or use a string with delimiters and parse out the value between delimters x and x+1 (not sure if doable either, but...)?
2018/08/09 12:42:23
msmcleod
KPerry
Or use a string with delimiters and parse out the value between delimters x and x+1 (not sure if doable either, but...)?


Unfortunately there's next to no string handling routines in CAL either.
 
I've got a rough design for a LUA replacement for CAL, using the Control Surface API as this gives access to most of the menu based routines that CAL does. It would also involve programatically writing CAL scripts on the fly, running them, then picking up the results via files (not sure if these could be memory based or not). It would also rely on the fact that a control surface DLL is kept in memory, so state can then be passed between subsequent calls to the CAL DLL function.
 
However, not only is it a fairly big job, I seriously doubt I'll have the spare time to work on this any time soon.
 
If I do get anything working though, I'll make it available.
© 2025 APG vNext Commercial Version 5.1

Use My Existing Forum Account

Use My Social Media Account