AE ENHANCERS

Expressions/Scripts/Presets
It is currently Fri Oct 24, 2014 2:15 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Illegal use of reserved word
PostPosted: Wed Aug 25, 2010 5:31 pm 
Offline
User avatar

Joined: Sat Jun 05, 2004 8:05 am
Posts: 137
Location: Los Angeles, CA
Trying this
Code:
if(time<4);
   {opacity=0};
else
   {opacity=100};
opacity

I get an error message for line 3 saying "illegal use of reserved word"
Line 3 is the "else"
What am I doing wrong? Is it a syntax error here?

Thanks
Alex


Top
 Profile  
 
 Post subject: Re: Illegal use of reserved word
PostPosted: Thu Aug 26, 2010 12:45 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 698
Location: London, UK
Well it's kind of strange that you're using the word opacity, but that isn't it. You shouldn't have a semi-colon on the first line.

Not that this matters, but here's how I'd format it:
Code:
if (time<4) {
    opacity=0;
} else {
    opacity=100;
}
opacity;


EDIT: Actually I just realised it does matter that you're using the word opacity, although that just produces the wrong result and doesn't cause an error. Try this instead:

Code:
if (time<4) {
    banana=0;
} else {
    banana=100;
}
banana;


Top
 Profile  
 
 Post subject: Re: Illegal use of reserved word
PostPosted: Thu Aug 26, 2010 1:51 pm 
Offline
User avatar

Joined: Sat Jun 05, 2004 8:05 am
Posts: 137
Location: Los Angeles, CA
Ha, so why is it that you can't use the name of the property to target itself? This doesn't seem to be the case with position or scale?

Thanks Paul

Alex


Top
 Profile  
 
 Post subject: Re: Illegal use of reserved word
PostPosted: Thu Aug 26, 2010 2:12 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 698
Location: London, UK
Well, no you couldn't do this on the position property:
Code:
position = [0,0];
position;

Or you could, but the first line wouldn't do anything, then the second line is like saying "apply the position property's value to the position property", so the result is the same as without the expression.

In an expression you can create a new variable and assign a value to it, but you can't directly assign a value to the property. You can of course read the value of a property and you do this by using the name of the property, but it's essentially read only so it's not a good idea to try using it as a variable.

Then, the resulting value from the last line of the expression is what becomes the property's value.

Hope that makes sense.


Top
 Profile  
 
 Post subject: Re: Illegal use of reserved word
PostPosted: Thu Aug 26, 2010 2:16 pm 
Offline
User avatar

Joined: Sat Jun 05, 2004 8:05 am
Posts: 137
Location: Los Angeles, CA
Yes it does, actually just phrasing the question made me realize what the answer was. Thank you for clarifying even further

Alex


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group