PDA

View Full Version : MEL: two strings, one line value?


Toast
09-06-2011, 05:40 PM
Just a question on syntax for all the MEL experts here, how do you do this properly (first line is correct, i have to declare two strings to be the same value on second line)

if (`checkBox -q -v randScale` == 0)
$getScaleMin, $getScaleMax = 1;

Obviously second line currently fails, just don't know how to do it properly.

Ben Apuna
09-06-2011, 05:56 PM
I don't know mel but a wild stab at it would go like this:


if (`checkBox -q -v randScale` == 0) {
$getScaleMin = 1;
$getScaleMax = 1;
}


EDIT:

On second thought though if these variables are strings wouldn't the values need to be enclosed in quotes? like this:


if (`checkBox -q -v randScale` == 0) {
$getScaleMin = "1";
$getScaleMax = "1";
}


Though in this case I'd guess you actually want these variables to be ints instead of strings so you'd have something like this:


int $getScaleMin;
int $getScaleMax;

if (`checkBox -q -v randScale` == 0) {
$getScaleMin = 1;
$getScaleMax = 1;
}


lol, I should probably learn mel one of these days.

Toast
09-06-2011, 06:00 PM
Edit: nevermind. Thanks very much for your help that last code worked

I had to declare blank strings before the if statement for it to work!

Solved. :)

I agree, I didn't understand how much you could do with MEL and improve tools before starting to learn it.

Ben Apuna
09-06-2011, 06:12 PM
Oh it worked! cool.

Yeah,


$getScaleMin,


doesn't really work because it doesn't know what you want to do with the $getScaleMin, since you aren't declaring a new variable like this:


int $getScaleMin;
or assigning a value to it like:


$getScaleMin = 1;
or doing both at the same time (which is probably possible) like this:


int $getScaleMin = 1;
Anyway I'm glad I could help :)

haiddasalami
09-06-2011, 06:40 PM
Just as a general heads up. Its always better to set your value type in mel cause you actually have to tell MEL what you're going to return if your doing functions. Also helps the reader and you know what that value is :)