View Single Post
Old Aug 9th, 2005, 1:27 PM   #1
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 301
Rep Power: 4 Klarre is on a distinguished road
[MEL (Maya)] Newbie scripter

I have just begun scripting in Maya, and therefor need some help.

The goal is to create a script that generates a textfile that looks like this:
group house
{
    object window
    object door
    object funnel

    position = 23 23 23
    rotation = 45 16 23
    scale = 1 1 1
}
What my Maya script is doing is that it simply goes through the stuff in the scene using ls -as. All my groups in the scene are named like house_grp, where the three last letters should tell the script that it is reading a group.
My problem is:

How do I, from a string, reads the last three characters?

The script look like this so far:
for($each in `ls -as`)
{
    string $str_each = $each;
    // Code here!
    print $str_each;
}

Where it says "Code here!" I want to read the three last characters of the $str_each variable. But how?

/Klarre
Klarre is offline   Reply With Quote