I'm in the process of writing a much more comprehensive manual for this, but here are a few of the
most important things to knnow about MSL.
Functions
To use a Mobius function in a script you just type its name.
Record
Unlike .mos scripts, if you want to call more than one function they do not have to be
on different lines. If you want to do Record followed by Overdub you can just write this:
Record Overdub
In the few cases where functions need arguments, you put the arguments after the function
names surrounded by parenthesis:
SelectLoop(2)
Parameters
To change a parameter value you need to know its name. Function names always begin with an upper
case letter and parameter names always begin with a lower case letter. Because parameter names in the
UI are usually several words seperated by spaces, to get the script name remove the spaces and leave
each word capitalized except the first word. For example, in the UI you will see a parameter named:
Empty Loop Action
In a script this would be referenced with this name:
emptyLoopAction
To change the value you use the assignment operator which is the equals character:
emptyLoopAction = "copyTime"
The value of a parameter is either a string or a number. Sting values must be surrounded by double quotes.
Parameters whose values are words are called enumerated parameters. The words you enter here are similar
to the parameter names in that what you see in the UI will often be multiple words with spaces, but the script
name has no spaces and the first letter is always in lower case. So Copy Time becomes copyTime.
This is the biggest difference between MSL and MOS. In MOS you could write this:
set emptyLoopAction copyTime
This does not work in MSL because every unquoted word is assumed to be a reference to something with that
name and there is no symbol named copyTime. An alternative to surrounding parameter values with double
quotes is the use of keyword symbols. Keyword symbols begin with a colon and evaluate to a string with
containing the name of the symbol.
emptyLoopAction = :copyTime
You will see this a lot in the examples I post.
Expressions
To test to see what the current value of a parameter is, you use a comparison operator. The most common
one of these is == which tests to see if a parameter has a certain value. You can also use the word equals
instead of ==.
if mode == "Record"
if mode equals :Record
Conditionals
The most common conditional statement is if which evaluates an expression and takes one branch if it is true
and another if it is false.
if mode == :Record
Record
else
Overdub
Unlike .mos scripts, you do not need the ENDIF keyword after the else.
Another major difference between MSL and MOS is the use of blocks. MOS is line oriented, each statement was
on it's own line and blocks were ended with a keyword like endif and next. For example:
if mode == Record
Record
Overdub
endif
In MSL, if you need to do more than one statement after an if you surrouned it with curly braces:
if mode == :Record {Record Overdub}
Again, you do not need line breaks in MSL. You can use them if you like them but they are not required.
Script Names
If you do no say otherwise, when you load a script the script name that you will see in the UI for bindings
will be the name of the file containing the script. For example the file named "myscript.msl" would be
shown as "myscript". You might want a different more readable name to be displayed in the UI. To do that
you use the name declaration
#name Script of Destiny
Any word that starts with a # character is called a declaration. These say things about how the script
behaves or how it is displayed. In MOS scripts the directive character was ! and the script name
was specified using !name.
Doing things in Tracks
When you run a script from a binding, they will be run in whatever track currently has focus, the track
displayed with the white box around it. Within the script, you might want to operate on a different track.
In MOS, this was done with the for statement:
for 2
Record
next
MSL does something similar with the in statement:
in 2 Record
That should cover about 80% of what people use scripts for. The next most common script needs are sustain
and repeat scripts and using waits. Those are more complex and I'll cover those in another post.