CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 09-18-2005, 06:47 PM   #1
gunslingerblack
Guest
 
Posts: n/a
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-18-2005, 07:21 PM   #2
Segmoria
 
Segmoria's Avatar
portfolio
Eirini St
United%2BKingdom
 
Join Date: Feb 2002
Posts: 424
Send a message via MSN to Segmoria
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-18-2005, 07:55 PM   #3
gunslingerblack
Guest
 
Posts: n/a
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-18-2005, 08:12 PM   #4
Segmoria
 
Segmoria's Avatar
portfolio
Eirini St
United%2BKingdom
 
Join Date: Feb 2002
Posts: 424
Send a message via MSN to Segmoria
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-18-2005, 08:28 PM   #5
gunslingerblack
Guest
 
Posts: n/a
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-18-2005 at 08:32 PM.
 
Old 09-18-2005, 09:20 PM   #6
Segmoria
 
Segmoria's Avatar
portfolio
Eirini St
United%2BKingdom
 
Join Date: Feb 2002
Posts: 424
Send a message via MSN to Segmoria
You missed a space up there!
(`getAttr the_shaker.wander_intensity` == 0) not
if (`getAttrthe_shaker.wander_intensity` == 0)

Last edited by Segmoria : 09-19-2005 at 12:41 PM.
 
Old 09-18-2005, 11:03 PM   #7
gunslingerblack
Guest
 
Posts: n/a
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-18-2005, 11:33 PM   #8
Segmoria
 
Segmoria's Avatar
portfolio
Eirini St
United%2BKingdom
 
Join Date: Feb 2002
Posts: 424
Send a message via MSN to Segmoria
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-19-2005, 12:16 AM   #9
gunslingerblack
Guest
 
Posts: n/a
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-19-2005, 01:37 AM   #10
mhovland
MEL Monkey
 
mhovland's Avatar
portfolio
Mike Hovland
Technical Artist
Robomodo
Chicago, USA
 
Join Date: Feb 2002
Posts: 580
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-19-2005, 02:51 PM   #11
gunslingerblack
Guest
 
Posts: n/a
with the help of segmoria i have fixed the code so that it works thank you for your help.
 
Old 09-19-2005, 02:51 PM   #12
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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 10:53 PM.


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