ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Syntax Change;

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alex Printz
Syntax Change;
on Oct 15, 2018 at 6:02:06 pm

Hey All, the newest version of AE was just released and the expression engine has been switched from ExtendScript to Javascript. Problem is that the syntax has been changed just a bit, and some of my code is now broken and I can't figure out where. All that the error report returns is "Error at line 1".

I've tracked isolating chunks of my expressions down to a single function, but I am not sure where the syntax change is now wrong for the new engine.

This function is never being called in my isolation, yet is breaking the expression, meaning I think the program is reading it incorrect. If I comment around the section, it is fine. If I switch the engine back to Legacy ExtendScript (under the project settings), all of this runs fine.


Does anyone have any ideas?

function rebelFind(i){
try{
T = clamp(effect("Rebel Rebel")(i).value, min=-1, max=99);
if(T == -1){return parent};
else return effect(String("Surrogate Idol " + T.toFixed(0)))(1);
}catch(err){return thisLayer;}
}


Alex Printz
Mograph Designer


Return to posts index

Dan Ebberts
Re: Syntax Change;
on Oct 15, 2018 at 6:54:50 pm

I think you'll be OK if you remove the semicolon in the 4th line (or move it inside the curly braces).

Dan



Return to posts index

Alex Printz
Re: Syntax Change;
on Oct 15, 2018 at 7:25:23 pm

That seems to work when the function is isolated, but unfortunately not when it is all together, so either there are multiple problems or something else is happening. Unfortunately the new debug is not even returning a description, only that line 1 has an error.

Here is a demo scene, showing off the scripts in question. The scripts (work mostly the same) are on the child null, and are looking at the parent nulls for position (and other properties). When the project's expression engine is switched to Javascript, all of the scripts break. I am guessing it is something simple and syntax since it breaks on all the scripts, but I have no idea where to begin looking at it.

12810_rebelrebelbrokenscriptsdemo.aep.zip

Alex Printz
Mograph Designer


Return to posts index


Dan Ebberts
Re: Syntax Change;
on Oct 15, 2018 at 7:35:41 pm

With the new engine, you can't end an expression with a function. I moved them to the top of the expression for the Child's Anchor Point and that eliminated the error message, so give that a try.

Dan



Return to posts index

Alex Printz
Re: Syntax Change;
on Oct 15, 2018 at 7:39:03 pm

Oh man Dan you're a life saver, I never would have thought something like that; here I was looking for code issues in my if/for loops. Crazy.

Thanks so so much.

Alex Printz
Mograph Designer


Return to posts index

Dan Ebberts
Re: Syntax Change;
on Oct 15, 2018 at 7:42:53 pm

There is an if/else issue with the new engine, but I didn't see any instances of it in your code.

You used to be able to do this:

if (x) a else b;

Now you need to do this

if (x){ a }else{ b }

or this:

if (x) a; else b

or use this format:

x ? a : b;


Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]