View Full Version : MEL:Syntax

05 May 2007, 07:28 PM
1. There are 5 spheres in my simple scene...

2. I type this little string variable in the Script Editor:

string $selectedObject[] = `ls -sl`;

3. I execute the command and I get this error;

----// Error: Invalid redeclaration of variable "$selectedObject" as a different type. //

4. Then , I type exactly the same string variable except for the small "s" letter in front of the name of my variable, which is "selectedObject"...

string $SelectedObject[] =`ls -sl`;

I get this.... I am about to go crazy!

----// Result: pSphere3 pSphere4 //

what is going on man!?!?! ıf there is a rule indicatin us that we should only use capital "s" letters while naming our variables, please fill me in about that rule. I tried many letters and all of them worked.

Do you know anything?

NOtE: wait a second wait a second fox!! I relized that Maya always keeps in minde till It is closed by the user.. I restart Maya and small s worked fine... So, What should ı do to fix this without restarting the application?

now, you can answer this basic question I think.. :)

05 May 2007, 07:46 PM
Restart Maya.

You defined global variables which are resident in Memory.
When you restart Maya they are free again.

Otherwise start and close your script with {}

For Example:


Then everything will be defined locally...


05 May 2007, 08:09 PM
Thank you so much. I will do it from now on.. :)

CGTalk Moderation
05 May 2007, 08:09 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.