Looping through a specific bit of text gives me unstable result
Hi!
Working with text wanting to be able to specify which exact part of the whole text I want to fetch. The setup now is Point Expression Control that defines the start and the end of the splitted string and render it using a for loop. It works, but. The result is unstable when I'm changing the start value, often it gets stuck at "UNDEFINIED".
t = thisComp.layer("txtSource").text.sourceText;
t = t.split(" ");
txtFrom = effect("txt FromTo ")("Point")[0];
txtTo = effect("txt FromTo ")("Point")[1];
t2 = "";
for (i = txtFrom; i < txtTo; i++) {
t2 += t[i] + " ";
}
l1 = thisComp.layer("Font STYLE 1").text.sourceText;
l2 = thisComp.layer("Font STYLE 2").text.sourceText;
l3 = thisComp.layer("Font STYLE 3").text.sourceText;
textStyles = [l1, l2, l3];
c = clamp(effect("current style")("Slider"), 0, textStyles.length-1);
style = textStyles[c].getStyleAt(0,0);
style.setText(t2);that's the entire code, that also fetches styles from three different layers.
I'm guessing there is some kind of try or break function that I need to add? Anyone has an idea how to make this more stable?
