Page 1 of 1

Using variables in a condition and incrementing them too

Posted: Mon Aug 12, 2024 2:45 pm
by notme
Hi,

I would like to output something in a text object depending on a variable value with a condition and increment the variable in the same step. The (non-working - syntax error) expression looks like this:

{condition ? "" : start + offset; offset = offset +1}

It should output nothing, if condition is true. If not, it should output start+offset and increment the offset after.
Is there a way to do this with one text object?

As workaround, I use this expression:
{condition ? "" : start + offset}
and a second text object with this expression:
{condition ? "" : offset = offset +1}
and hide its output by using an empty text brush :oops:

thanks!
Christian

Re: Using variables in a condition and incrementing them too

Posted: Tue Aug 13, 2024 7:22 pm
by Lech Kulikowski
Hello Christian,

You can use the following expression:
{condition ? 0 : start + offset++}

Thank you.