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

Problem using two expressions for controlling text.

Community Beginner ,
Aug 04, 2021 Aug 04, 2021

I found two great expressions on the web, one for random words (based on words in the layer name), and another for random fonts (from a font list in the expression.) They both work great on their own, but when I stack them together only the lower one works. I know this is a common problem but I can't figure it out. I see other posts with solutions to similar non-text scripts, but I can't figure how to apply those solutions to this. Thank you for any assistance you can give. I would love to be able to apply both of these to on text layer!
Here're the scripts (there's a frame rate slider associated with the random word script, but I'm not sure how to include that:
//random words

words=thisLayer.name.split(" ");

wordCount=words.length;

frameRate=effect("Frame Rate")("Slider");

seedRandom(Math.floor(time*frameRate), timeless = true)

randomNumber=random(0,wordCount);

roundedNumber=Math.floor(randomNumber);

words[roundedNumber]

 

// random fonts

var array = [ "Courier-Bold", "Copperplate-Bold", "Compacta-Normal", "Citore", "Cochin", "Izzard", ];

hold=0.2;

seed=Math.round(random(time/hold));

seedRandom(seed,true);

r=Math.round(random(53));

style.setFont(array[r])

words=thisLayer.name.split(" ");

wordCount=words.length; frameRate=effect("Frame Rate")("Slider");

seedRandom(Math.floor(time*frameRate), timeless = true)

randomNumber=random(0,wordCount);

roundedNumber=Math.floor(randomNumber);

words[roundedNumber]

TOPICS
Expressions , Scripting
157
Translate
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
LEGEND ,
Aug 04, 2021 Aug 04, 2021

The expressions need to be used on different layers with one feeding in the random words into the other's source text.

 

Mylenium

Translate
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 Beginner ,
Aug 05, 2021 Aug 05, 2021

Thank you! I will try that.

Translate
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 Beginner ,
Aug 05, 2021 Aug 05, 2021

It's still over-riding the change font script. I am using the pickwhip, should I not?

Translate
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
LEGEND ,
Aug 05, 2021 Aug 05, 2021
LATEST

Perhaps an issue with parsing the font names? Have you tried to debug it by inserting a font name directly into the setStyle()?

 

Mylenium

Translate
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