PDA

View Full Version : mel and hell rhyme


gunslingerblack
09-18-2005, 06:47 PM
this is the script i am working on

i have no experience with mel but i am getting a syntax error, does anyone know what the problem is??
using maya 7

if (the_shaker.wander_intensity == 0)

the_shaker.translateX = ( gauss ( ( rand ( 0 , ( the_shaker.shake_intensity * ( the_shaker.shake_xtrans_master * 0.1 ) )))) ) + ( ( ( noise ((time-50) * the_shaker.destabilise_xtrans_scale)) * (the_shaker.destabilise_intensity/2) ) ) + ( rand ( the_shaker.jitter_intensity * ( the_shaker.jitter_xtrans_master/10 ) , ( the_shaker.jitter_xtrans_master/10 )) ) );

else

the_shaker.translateX = ( gauss ( ( rand ( 0 , ( the_shaker.shake_intensity * ( the_shaker.shake_xtrans_master * 0.1 ) )))) ) + ( ( ( noise ((time-50) * the_shaker.destabilise_xtrans_scale)) * (the_shaker.destabilise_intensity/2) ) ) + ( rand ( the_shaker.jitter_intensity * ( the_shaker.jitter_xtrans_master/10 ) , ( the_shaker.jitter_xtrans_master/10 )) ) ) + the_shaker.translateX + (( rand ( - (the_shaker.wander_intensity * (the_shaker.wander_xtrans_master/5)) , (the_shaker.wander_intensity * (the_shaker.wander_xtrans_master/5) ) )))

Segmoria
09-18-2005, 07:21 PM
Well for a start, you cant access the the_shaker attributes in the way you do.
Instead you should use:

if (`getAttr the_shaker.wander_intensity` == 0)
{
setAttr "the_shaker.translateX" ( gauss ( ( rand ( 0 , ( `getAttr the_shaker.shake_intensity` * ( `getAttr the_shaker.shake_xtrans_master` * 0.1 ) )))) ) + ( ( ( noise ((time-50) * `getAttr the_shaker.destabilise_xtrans_scale`)) * (`getAttr the_shaker.destabilise_intensity`/2) ) ) + ( rand ( `getAttr the_shaker.jitter_intensity` * ( `getAttr the_shaker.jitter_xtrans_master`/10 ) , ( `getAttr the_shaker.jitter_xtrans_master`/10 )) ) );
}

I believe you can figure out the rest.
You might consider breaking that whole thing into smaller groups and store them into seperate float variables, for the sake or easier reading of it!
Don't forget braces as well.

gunslingerblack
09-18-2005, 07:55 PM
here is what i get after i made the changes you suggested segmoria

// Error: {if ( 'getAttr the_shaker.wander_intensity' == 0 )
//
// Error: Syntax error //
// Error: else
//
// Error: Syntax error //
// Error: } //
// Error: Syntax error //
// Error: Expression invalid after edit. //


no clue...

Segmoria
09-18-2005, 08:12 PM
No, you misunderstood there
The braces are used to encapsulate the contents of the if statement.

if ( A==0 )
{
do this;
do that;
}

else
{
do that;
do that;
}

gunslingerblack
09-18-2005, 08:28 PM
this is exactly what i put into the expression editor:

if ('getAttrthe_shaker.wander_intensity' == 0)
{
setAttr "the_shaker.translateX" = ( gauss ( ( rand ( 0 , ( 'getAttr the_shaker.shake_intensity' * ( 'getAttr the_shaker.shake_xtrans_master' * 0.1 ) )))) ) + ( ( ( noise ((time-50) * 'getAttr the_shaker.destabilise_xtrans_scale')) * ('getAttr the_shaker.destabilise_intensity'/2) ) ) + ( rand ( 'getAttr the_shaker.jitter_intensity' * ( 'getAttr the_shaker.jitter_xtrans_master'/10 ) , ( 'getAttr the_shaker.jitter_xtrans_master'/10 )) ) );
}
else
{
setAttr "the_shaker.translateX" = ( gauss ( ( rand ( 0 , ( 'getAttr the_shaker.shake_intensity' * ( 'getAttr the_shaker.shake_xtrans_master' * 0.1 ) )))) ) + ( ( ( noise ((time-50) * 'getAttr the_shaker.destabilise_xtrans_scale')) * ('getAttr the_shaker.destabilise_intensity'/2) ) ) + ( rand ( 'getAttr the_shaker.jitter_intensity' * ( 'getAttr the_shaker.jitter_xtrans_master'/10 ) , ( 'getAttr the_shaker.jitter_xtrans_master'/10 )) ) ) + 'getAttr the_shaker.translateX' + (( rand ( - ('getAttr the_shaker.wander_intensity' * ('getAttr the_shaker.wander_xtrans_master'/5)) , ('getAttr the_shaker.wander_intensity' * ('getAttr the_shaker.wander_xtrans_master'/5) ) )))
}
and this is the error i recieved:

// Error: {if ('getAttrthe_shaker.wander_intensity' == 0)
//
// Error: Syntax error //
// Error: else
//
// Error: Syntax error //
// Error: } //
// Error: Syntax error //
// Error: Expression invalid after edit. //

Segmoria
09-18-2005, 09:20 PM
You missed a space up there!
(`getAttr the_shaker.wander_intensity` == 0) not
if (`getAttrthe_shaker.wander_intensity` == 0)

gunslingerblack
09-18-2005, 11:03 PM
i probably shoulda edited that to avoid wasting more time, i actually added the space in the code and still got the exact same error...well im about to give up on mel officially.

Segmoria
09-18-2005, 11:33 PM
Don't worry, you'll get this to work :P
But you didn't quite follow exactly what I said , did you?
it's setAttr "the_shaker.translateX" 10; not setAttr "the_shaker.translateX" = 10;

I can try and edit this whole thing, if its such a big problem for you to get it working.

gunslingerblack
09-19-2005, 12:16 AM
segmoria i see u r browsing the thread atm if u have aim im me at t3amz3r0 that way this will be alittle more interactive

mhovland
09-19-2005, 01:37 AM
Well if what you posted is what you entered, you need to use the backtick character (the same key as the tilde in the upper left hand of the keyboard.

gunslingerblack
09-19-2005, 02:51 PM
with the help of segmoria i have fixed the code so that it works thank you for your help.

CGTalk Moderation
09-19-2005, 02:51 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.