View Full Version : String Problem. Whats that ?

01 January 2004, 07:22 PM

I am writting a mel but I have a problem with my script. When I try execute my script an error displayed.

Error: Line 8.26: Initialization of global variable "$lwtRA" requires a constant value.

Whats that ? Do yu know something ?

//My codes.

int $cFW = 425;
int $cwW = 464;
int $cwH = 350;
global string $x = ".rx" ;
global string $y = ".ry" ;
global string $z = ".rz" ;
global string $hist = "" ;
global string $lwtRA = $x; // <- This is a problem !
global string $lwtObj ;

if (`window -q -exists twindow`) deleteUI twindow;
window -menuBar 1 -maximizeButton false -w $cwW -h $cwH twindow;
string $tabUI = `tabLayout`;

string $scroll01UI = `scrollLayout`;
setParent ..;
setParent ..;

string $scroll04UI = `scrollLayout`;
columnLayout -adj true;
frameLayout -label "" -cll true -width $cFW ;
rowColumnLayout -nc 8 -width 360
-cw 1 75 -cw 2 25 -cw 3 25
-cw 4 205 -cw 5 20 -cw 6 20
-cw 7 25 -cw 8 25;

text -vis 0;text -vis 0;text -vis 0;
floatSliderGrp -min $lwtMin -max $lwtMax -v $lwtDval
-f true -cw2 45 45 -w 30 sld_lwt; connectControl sld_lwt ( $lwtObj + $lwtRA );

setParent ..;
setParent ..;

setParent ..;
setParent ..;
tabLayout -e -tabLabel $scroll01UI "V" $tabUI;
tabLayout -e -tabLabel $scroll04UI "H" $tabUI;
showWindow twindow;

01 January 2004, 07:28 PM
I think I once solved this problem like this:
First you declare your global, after that you set the value.

global string $lwtRA;
$lwtRA = $x;

Does that work?

01 January 2004, 07:32 PM
Instead of using

global string $lwtRA = $x;

try writing it as

global string $lwtRA;
$lwtRA = $x;


I just tried it out and it worked that way. I ran into a problem similar to this the other night, but I wanted to make sure that's what I did to fix it. I'm still learning a lot about MEL, but I'm going to assume variables can't be defined by other variables, even though they can be written to contain them?

But anyway, break that one line up into two and it should work! :)

01 January 2004, 07:35 PM
curses! beaten by less than 4 minutes!

I need to either type faster or log out of instant messenger... :p

01 January 2004, 04:22 PM
Hehe...instant messengers are the work of the devil :P

At least equinox has proper verification now that this is the solution :)

01 January 2004, 08:38 AM
yeahh now working. Thanks :bounce:

CGTalk Moderation
01 January 2006, 05:00 AM
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.