PDA

View Full Version : I have the script curse.



kcberry
05-05-2010, 03:06 PM
I'm watching the Cartoon Character Rigging in Maya and I'm working on the mel script. I can never get scripts to work.

It gives me a,
// Error: rowColumnLayout –numberOfColumns 2 - cw 2 50; //
// Error: Syntax error //

This is what I have so far,

//checks for our Window and Deletes it

if (`window -exists Node_Generate`) {
delete -window Node_Generate;
}

//Window for our Node Generator

string $Node_Generator = `window
-title "Node Generator"
-wh 128 256
Node_Generate`;
//Define our Row and Column Layout

rowColumnLayout –numberOfColumns 2 - cw 2 50;

//Column1: buttons Column2: button descriptions

separator; separator;

button -label "arcLen Maker" -c "CurveInfo ()"; text -label "CurveInfo";

//shows our window
showWindow $Node_Generator

Thanks for your time,

Keyton

chrisg
05-05-2010, 05:01 PM
Hi kcberry,

What application are you writing the scripts in?

rowColumnLayout –numberOfColumns 2 - cw 2 50;

Issue 1: - is not the same as –. Make sure you type the minus key and don't let the text editor change it. I think Word and possibly WordPad changes - into – sometimes.

Issue 2: You need to delete the space between - and 'cw'

so this line should work:

rowColumnLayout -numberOfColumns 2 -cw 2 50;

MEL sees the '-' character as a new flag, or in other words, a new thing it needs to plug a number into. If there is a space after the -, it sees the flag as "" nothingness.

THNKR
05-05-2010, 05:14 PM
You've got some weird invisible characters in there, inbetween - and numberOfColumns. You also shouldn't have spaces after a - in a flag like -cw

I would also use deleteUI, not delete and I would specify the width of BOTH columns.





//checks for our Window and Deletes it

if (`window -exists Node_Generate`) {
deleteUI -window Node_Generate;
}

//Window for our Node Generator

string $Node_Generator = `window
-title "Node Generator"
-wh 128 256
Node_Generate`;

//Define our Row and Column Layout

rowColumnLayout -numberOfColumns 2 -columnWidth 1 80 -columnWidth 2 80;


//Column1: buttons Column2: button descriptions

separator; separator;

button -label "arcLen Maker" -c "CurveInfo ()"; text -label "CurveInfo";

//shows our window
showWindow $Node_Generator;

Fusedgore
05-05-2010, 06:18 PM
I think everyone gets the script curse a few times when learning.I know I have had mine and still have it .Having said that make sure you turn on show line errors in the script editor if your coding in maya .It will be easier to find your errors .

The error is on the last line it should be


showWindow $Node_Generator;

kcberry
05-17-2010, 06:04 PM
Thank you all for your help. It is working now. :)