• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Out of Date After Effects Expression Undefined Value

New Here ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

Hello,

 

First time posting here, so apologies in advance.

 

I have imported a glitch effect .aep file which was created using an older version of After Effects. Not sure how to update it so that it works with the 2021 version.

 

Here's the expression:

 

x = thisComp.width/2 + thisComp.layer("Edit Settings").effect("Motion Controls")(2);

y = thisComp.height/2 + thisComp.layer("Edit Settings").effect("Motion Controls")(3);

defx = thisComp.width/2;

defy = thisComp.height/2;

m = thisComp.layer("Edit Settings").effect("Motion Controls")(1);

if (m==1) {[x, defy]};

if (m==2) {[defx, y]};

if (m==3) {[x,y]};

 

It's showing the following error:

Error : undefined value used in expression (could be an out of range array subscript?)

 

There may be other issues with the expression, but I only know the very basics unfortunately.

 

Any help woud be greatly appreciated.

 

Thanks.

TOPICS
Expressions

Views

48

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

I think you might get that error if whatever thisComp.layer("Edit Settings").effect("Motion Controls")(1) is gets set to something greater than 3. The expression should probably check for that condition and fail more gracefully.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

The "Motion Controls" effect is probably a pseudo-effect created with a script or whatever which simply falls apart without the relevant XML bits being present in the respective file. Hard to say what it uses, but you may want to start by replacing the relevant bits with direct references to custom expression sliders. Also when adressing an index the value needs to be rounded to produce a proper integer. That would have been wrong even in the old code. That and of course your syntax for the conditionals is terrible and may similarly break whenever neither of the three defined conditions isn't met and there is no fallback. So more to the point, you code probably should look more like this:

 

mLay=thisComp.layer("Edit Settings");

mConA=mLay.effect("Slider A")("Slider");

mConB=mLay.effect("Slider B")("Slider");

 

x = thisComp.width/2 + mConA;

y = thisComp.height/2 + mConB;

defx = thisComp.width/2;

defy = thisComp.height/2;

 

m = Math.round(mLay.effect("Slider C")("Slider"));

 

if (m==1) {[x, defy]}

else if (m==2) {[defx, y]}

else if (m==3) {[x,y]}

else{[value[0],value[1]]}

 

Again, the code was terrible even for old AE and likely never worked reliably in the first place.

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 12, 2022 Aug 12, 2022

Copy link to clipboard

Copied

Thanks Mylenium,

I have tried the code in the pre-comp, unfortunately it now says the "Slider A" control is missing or doesn't exist.

It looks like the expression should link to wiggle sliders for Amplitude and Frequency (have included a screenshot below). If I amend the expression to reference these it still says they don't exist.

Should have included the screenshot in the original post, apologies.

Thanks again,

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2022 Aug 12, 2022

Copy link to clipboard

Copied

LATEST

Yeah, sure. Of course you will need to adjust the references to point to the correct controls for things to work.

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines