2009

Table Of Contents
The string data type is used to store multiple characters. The print
command outputs the value of a variable to the Script Editor.
NOTE Variables can be declared and assigned a value in the same statement.
To declare an int variable
1 Type the following in the Script Editor
int $testInt = 5;
print ($testInt/2);
The following is output to the Script Editor:
2
The int data type is used to store integer values. Integers are positive and
negative whole numbers. In programming, when an integer is divided
by another integer, the result is an integer, which is why the output here
is not 2.5 (2.5 is not an integer).
The print commands argument is enclosed in brackets. The print
command can only take one argument, so brackets are used to tell Maya
to evaluate the contents of the brackets before executing the command.
Brackets can also be nested in a method similar to mathematical
statements to determine the order of evaluation of statements.
In the steps that follow, you create a row of barrels by spacing the barrels
evenly. This creates barrels that are just touching, which ensures that there
are no intersections during the rigid body simulation
In the next section, well use the move command to position the duplicate
barrels, using the saved value of the diameter as an argument for the Z value
of the command.
Create a row of barrels
Here, well use the stored value of the diameter to space the duplicates of the
barrel. Variable values can be recalled at any time. Variables can be used as
values for arguments.
To duplicate the barrels
1 Select the barrel.
Create a row of barrels | 617