Function formats, Script comments, Conditional statements – Apple Shake 4 User Manual
Page 959: Conditional expression
Chapter 31
Expressions and Scripting
959
Script Comments
To temporarily comment out lines in a script, use the following symbols:
# This line is commented out
// This line is also commented out
This is not commented out //But this is
/*
All of
these lines
are
commented out
*/
Conditional Statements
Like in C, you can use conditional statements in your scripts. These are particularly
useful in macros, where a conditional parameter is input by the user. Keep in mind that
the conditional statements require you to work in the script and cannot be built with
interface tools.
Function Formats
So, where are all of these functions and how do you find their formats? Typically, they
are organized by the type of data they manipulate.
Here is a handy way to get a function format: Create the node(s) in the interface,
select and copy the node(s) (press Command-C or Control-C), and paste the nodes
into a text editor.
For more information:
•
For image functions, see their relative chapters. For example, for information on the
Rand function, see “
•
For mathematical functions, see“
•
For Shake settings, see “
Setting Preferences and Customizing Shake
•
For interface building functions, see “
Setting Preferences and Customizing Shake
•
Examples abound in
well as in Chapter 32, “
Conditional Expression
To simply switch a parameter, use the in-parameter conditional expression
expr1?expr2:expr3, which reads as, “if expr1 is true, use expr2; otherwise, use expr3.” For
example, time>10?0:1 reads as, “if time is greater than 10, then set the value to 0;
otherwise, set it to 1.”