PDA

View Full Version : Problems Learning maya MEL Scripting


LadyMedusa
06-25-2005, 09:48 AM
I'm following Lesson 27 of Learing maya 6 Foundation. I came to the point where I'm going to make the script. I try it out and it says I got an error in line 1, but I wrote it exactly like it said in the book. Why doesnt it work? :argh:


//
// Creation Date: 25.jun.05
// Author: Valentina D'Este
//
// Description:
// Learning Maya tutorial script
// This script builds a procedure for animating
// Salty the seal's eyeControl.blink attribute
//

global proc blink (float $blinkDelay){

// Set up variables that will be used in the script
string $blink = "eyeControl.blink";
float $time = 'currentTime -query';
float $blinkCurrent = 'getAttr $blink';
// set key for the blink attribute
// at the current time


setKeyframe -value $blinkCurrent
-time $time
-attribute $blink
$blink;

// set key for a blink of 0
// half way through the blink


setKeyframe -value 0
-time ($time + $blinkDelay/2)
-attribute $blink
$blink;

// set key for the original blink value
// at the end of blink

setKeyframe -value $blinkCurrent
-time ($time + $blinkDelay)
-attribute $blink
$blink;


}

goleafsgo
06-25-2005, 11:55 AM
I copy/pasted your code and the first thing I see is that you have used the wrong type of quotes on a couple of lines.
This line here...

float $time = 'currentTime -query';


should be...

float $time = `currentTime -query`;


and I think there is another line like that. The tick mark you are supposed to use is the one in the top left corner beside the 1 key...at least on most keyboards.

LadyMedusa
06-25-2005, 12:23 PM
I copy/pasted your code and the first thing I see is that you have used the wrong type of quotes on a couple of lines.
This line here...

float $time = 'currentTime -query';


should be...

float $time = `currentTime -query`;


and I think there is another line like that. The tick mark you are supposed to use is the one in the top left corner beside the 1 key...at least on most keyboards.
Thanks for the help
It's shift+\ on my keyboard (scandinavian keyboard)
Edit:
no it did not work...
it gives me this
blink 10;
// Error: line 1: Cannot find procedure "blink". // :S

mark_wilkins
06-25-2005, 04:42 PM
Hi!

I'm wondering whether you might be missing a step.

Try placing the entire script that you pasted here into Maya's script editor and pressing the evaluation key (in the U.S. it's Enter on the numeric keypad.)

Then, type

blink 10;

and execute that.

If you don't do the first step (which is actually execute your definition for the blink procedure) before you try the blink 10 command, you would get the error you've been asking about.

The problem is that you have to force Maya to evaluate the script before you can use it. (The exception to this would be if you put it in a file called blink.mel in one of the scripts directories in your Maya installation -- then Maya could find it on its own. However, I wouldn't assume you've gotten that far yet.)

-- Mark

LadyMedusa
06-25-2005, 05:19 PM
Hi!

I'm wondering whether you might be missing a step.

Try placing the entire script that you pasted here into Maya's script editor and pressing the evaluation key (in the U.S. it's Enter on the numeric keypad.)

Then, type

blink 10;

and execute that.

If you don't do the first step (which is actually execute your definition for the blink procedure) before you try the blink 10 command, you would get the error you've been asking about.

The problem is that you have to force Maya to evaluate the script before you can use it. (The exception to this would be if you put it in a file called blink.mel in one of the scripts directories in your Maya installation -- then Maya could find it on its own. However, I wouldn't assume you've gotten that far yet.)

-- Mark
acctually, thats where I was stuck... maby I saved it in the wrong directory :|

But now its working. Thank you :)

CGTalk Moderation
06-25-2005, 05:19 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.