PDA

View Full Version : Error: No object matches name


Thr3ddy
06-14-2005, 06:56 AM
This is my first attempt at MEl and I'm getting the feeling that I did something totally wrong with my script since I get the: //Error: No object matches name: // error. Could you please take a look at it and help me out?

global proc CreateCurve(int $numVerts, float $curveLenght)
{
int $numVerts;
string $curve;
float $calculate;
float $curveLenght;
string $array[];
float $calculate = $curveLenght / $numVerts;
if ($numVerts < 1 || $numVerts = 1)
{
int $arraynumber;
int $arraynumber = 1;
float $newfloat;
do {
$array[$arraynumber] = "-p 0 0" + $calculate + " ";
$newfloat = $newfloat + $calculate;
$arraynumber = $arraynumber + 1;
}while ($newfloat < $curveLenght);
curve $array;
}else{
print("The number of vertices must be larger than the number one.\n");
}
}

any help will be appreciated. Thanks :)

bruegger
06-14-2005, 03:36 PM
A few tips:

1. Procedure parameters shouldn't be redeclared inside the procedure (i.e. $numVerts, and $curveLenght), otherwise their values will be reset.
2. if ( $numVerts < 1 || $numVerts = 1) checks if $numVerts is less than 1 and then sets it to 1. You probably want 'if ( $numVerts >= 1 )'
3. $newfloat should be initialized to 0 (float $newfloat = 0; ), otherwise it will start with a random value
4. It might be easier to use a string instead of a string array to build the parameters:
string $params;
$params += ("-p 0 0 " + $calculate + " ");
5. When executing the curve command, use an eval statement:
eval("curve " + $params);

This may not get you all the way there, but it's a start.

Thr3ddy
06-14-2005, 04:28 PM
Thanks, I fixed it this morning and its working like a charm :)

CGTalk Moderation
06-14-2005, 04:28 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.