Add boolean expressions and the possibility to fill boolean parameters with expressions

Important: do not confuse this post with “Add a way to change boolean variables using a expression”, because my idea covers all the boolean parameters, not only the boolean variable ones

Explanation:

We have numbers expressions, ones that return a number. Examples listed below:

Object.Animation::Index()
Object.Sprite()
Object.AnimationFrameCount()
Object.Variable(variable)

We also have string expressions, ones that return a string. Examples listed below:

Object.Animation::Name()
Object.ObjectName()
Object.Layer()
Object.VariableString(variable)

The idea:

Now, think about the possibility of having boolean expressions, ones that return a boolean state, either “true” or “false”. Examples listed below:

Object.Flippable::IsHorizontallyFlipped()
Object.Flippable::IsVerticallyFlipped()
Object.Effect::IsActive(effectName)
LayerEffectActive(layer,effectName)

And there is more, what if we were able to insert a exclamation mark before the expression to invert its logical result?

!Object.Flippable::isHorizontallyFlipped()

(These expressions would behave similarly to conditions, but ahead in this post I will explain how they can actually be used in advanced ways)

Why:

Allowing us to use boolean expressions directly in boolean parameters would certainly be something that you can achieve with just using conditions, but it would compress the size of events, reducing the number of conditions and actions required to achieve certain effects.

My own experience:

Recently, I was creating an action that would toggle the horizontal flip state of an object, I thought it was going to be just a simple “if flipped → unflip”, and “if unflipped → flip”.

But then I realized that if the object were flipped, it would unflip it as expected, but the event right below would just flip it back.

The solution was just simply adding a third event with a boolean check to avoid flipping again if the unflip event were already triggered.

My point is: it would be better if we could just do something like this:

“Horizontally flip Object: !Object.Flippable::IsHorizontallyFlipped()

Ending:

Since this whole boolean expressions concept would possibly cause confusion to new users, I don’t want it to be a thing that you can easily be able to see.

My suggestion is to it be a feature that you can toggle there:

FilePreferencesAdvancedShow boolean expressions and allow the use of expressions in boolean parameters (experimental)

2 Likes

I’ve thought the same. They could handle it the same way they handle the animations by name with a [use an expression button]. It would toggle between a true/false dropdown and an empty box.

ScreenRecorderProject58

1 Like