mel and hell rhyme

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 09 September 2005   #1
mel and hell rhyme

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) ) )))
 
Old 09 September 2005   #2
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.
 
Old 09 September 2005   #3
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...
 
Old 09 September 2005   #4
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;
}
 
Old 09 September 2005   #5
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. //

Last edited by gunslingerblack : 09 September 2005 at 08:32 PM.
 
Old 09 September 2005   #6
You missed a space up there!
(`getAttr the_shaker.wander_intensity` == 0) not
if (`getAttrthe_shaker.wander_intensity` == 0)

Last edited by Segmoria : 09 September 2005 at 12:41 PM.
 
Old 09 September 2005   #7
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.
 
Old 09 September 2005   #8
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.
 
Old 09 September 2005   #9
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
 
Old 09 September 2005   #10
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.
__________________
mike hovland
lead technical artist
Robomodo

Life beats down and crushes the soul... art reminds you that you have one. - Stella Adler
 
Old 09 September 2005   #11
with the help of segmoria i have fixed the code so that it works thank you for your help.
 
Old 09 September 2005   #12
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:45 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.