PDA

View Full Version : MEL-Problem


M-J
11-13-2002, 08:06 PM
hey everyone,

i recently ran into a MEL-problem for which i just can't find a solution...

e.g. you have something like the following:

string $test = "test";
...
...
...
button -command "bla($test)";

every time i try ro invoke the procedure "bla" (passing $test as an argument) by pressing the button Maya tells me that $test is an undeclared variable!

i really don't know what else to do since $test IS declared...

well, hope somebody can help me with that

cheers
MJ

stunndman
11-13-2002, 08:57 PM
basically you are passing $test as a string and not as a variable - if that is what you want i think you will have to declare $test as a global variable

global string $test;

or do you just want to assign bla's parameter from the variable $test the first time you create the button? - then you will have to properly escape it so that it's not taken literally but rather reads out the variable

jschleifer
11-14-2002, 02:21 AM
Here's an example of properly escaping $test so it works..

string $test = "yeehaw";

button -command ("bla \"" + $yeehaw + "\"");

M-J
11-14-2002, 05:52 PM
jason, thanx i'll try that out...i'm sure it works :-)

stunndman, i haven't tried out your suggestion yet, but i'm not too fond of global variables...they just take up memory :-) i'd be glad if there'd be another way :-) thanx anyway man

cheers
m-j

artifish
11-14-2002, 06:05 PM
Jason, there is a small typo in your script, it should be:

button -command ("bla \"" + $test+ "\"");

but I guess M-J already figured that out ;)

jschleifer
11-14-2002, 07:13 PM
hah! oops! :) test.. yeehaw.. what's the dif! :)

thanks for pointing that out! <grin>

CGTalk Moderation
01-13-2006, 10:00 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.