Categories
Uncategorized

Scripting

The result of my first attempt at scripting in Mel (Maya’s Programming language). I was fascinated by the logic of programming, but found the inflexibility of the commands extremely difficult to adhere to and quite frustrating. I realised that there are many different mathematical routes to achieve the same result, but they are more often than not the simplest routes, depending on the what you want to achieve and what the programmer wanted to create the language for in the first place. Having created a three-dimensional grid our next task is to randomly fill a 2D grid then somehow apply the rules of “The Game of Life” to make intricate patterns that move across the grid:

promptDialog
-title "my dialog box"
-message "Enter x"
-button "OK" ;
int $v1 = `promptDialog -query -text` ;
promptDialog
-title "my second dialog box"
-message "Enter y"
-button "OK" ;
int $v2 = `promptDialog -query -text` ;
promptDialog
-title "my second dialog box"
-message "Enter z"
-button "OK" ;
int $v3 = `promptDialog -query -text` ;
for( $i=0; $i<$v1; ++$i )
{
for( $j=0; $j<$v1; ++$j )
{
for( $k=0; $k<$v1; ++$k )
{
sphere ;
xform -translation (2*$i) (2*$j) (2*$k);
}
}
}

Here is a breakdown of the process of creating the Game of Life.