Art‎ > ‎Software‎ > ‎Maya‎ > ‎

Mel

Mel is the ancient language used by the Mayans to talk to the god's before they started to read the will of the gods by playing with snakes

Basic
  • Single line comment with //.
  • Multi line comment /**/
  • End every statement with a ;.

Commands
  • Commands are like command-line utilities in a UNIX shell.
  • Run a command with command [-flag value]. Each command has it's own number of flags (or commandline parameters).
  • To get help about a command use the help command. Ex help sphere will print information on the command sphere.
  • The same command is often able to both create, edit and query information.
    • The default is create mode. Ex sphere DaSphere
    • Use flag -query to get values. ex sphere -query -radius DaSphere
    • Use flag -edit to edit values. ex sphere -edit -radius 3 DaSphere
  • To get the return value of a command enclose it in backquotes. Ex $pos = `sphere -q -s DaSphere`

Variables
  • Define a variable with a $ and a name. ex float $earthsize = 100
  • Supported types are int, float, string, vector and matrix
  • If no value is assigned it get the default one for the type.
  • A bool is stored in a int. 0 is false (no and off) , other values true (yes or on). 
  • Logical operators is: || (or), && (and), ! (not).
  • Compare operators is: <, <=, >, >=, == and !=.
Text
  • Merge strings with the + symbol. 
  • Get the length of a string with size. ex size($saymyname).
  • Escape special characters with \.
Vector
  • A vector is variable that contain three floating point numbers called x,y and z.
  • Assign a vector with values in <<>>. ex vector $p = <<10,20,30>>
  • Access each element as x,y,z inside a (). ex move -absolute ($p.x) ($p.y) ($p.z)
  • To assign a vector element create a new one and assign. ex $p = <<($p.x), ($p.y), 40>>
  • * operator acts as dot product for vectors.
  • operator is cross product operator for vectors. Use pow command for exponent of numbers.
Matrix
  • A matrix is a table of floating point numbers.
  • To create a matrix use the matrix type follow by the number of rows and columns. Ex matrix $m[3][4];
  • Assign a matrix by using <<>> separated by commas in each row. matrix $m[2][2] = <<1,2;3,4>> 
  • Assign a element in the matrix with $m[1][2] = 5;
Statements
if ($a == $b) {
...
}
else if(($a == $c) {
...
}
else {
...
}

switch ($form) {
case "circle":
...
break;

case "cone":
...
break;

default:
...
break
}

while ($a < size($array)) {
...
}

do {
} while($a < 100)

for($i = 0; $i < 10; $i++) {
       if ($i == 5) continue;
    ...
}

string $array[3] = {"circle","sphere", "cone"};
for ($k in $array) {
...
}

Reference

Comments