Script manual – Apple Shake 4 User Manual

Page 951

Advertising
background image

Chapter 31

Expressions and Scripting

951

In this example, to break a noise() function into 5 steps between 0 and 1, multiply the
value by 6 (float values of 0 to 6), knock off the decimal places with a floor() function
(returning values of 0, 1, 2, 3, 4, 5), and then divide by 5, returning values of 0, .2, .4, .6,
.8, and 1.

Another helpful expression is modulus, written as a%b. This divides a by b and returns
only the remainder. This is helpful to fit an infinite range of values into a repeating limit.

A good application of modulus is if you have an angle of any potential amount (for
example, 4599) but you need to fit it into a range of 0 to 360. You would use
angle%360, which equals 279.

Script Manual

When Shake saves a script, it creates a file that essentially uses the C programming
language. This makes the product open and flexible, as you can add your own
functions, or use programming structures to procedurally perform what would
otherwise be tedious operations. You can also quickly make minor modifications that
might be cumbersome to do in the Shake interface (for example, changing a FileIn to
read BG2.iff instead of BG1.rla). This section of the guide explains the basic principles of
this scripting language, and how they can be manipulated to create your own macros.

The examples in “

Attaching Parameter Widgets

” on page 919, provide step-by-step user

interface scripting examples.

noise(time) floor(noise(time)*6)/5

time%10:

Advertising