Formulas don't accept globals updated by Flows

EDIT: I realized this happens in (afaik) all formula fields and not just Animation values, I’ve updated the title to reflect that.

I was trying to simulate a Sample & Hold circuit with Flows to use with animations. I coupled it with an RNG global that updates every second, so it’s supposed to take a random number X from the global and pass it to another (S&H) global every X seconds. That is, sample X and hold it for X seconds.

It was meant to be used with object Animations to add some randomness, i.e. make the object repeat an animation but randomize the duration every loop. However the Duration field, when set to Formula and referenced the S&H variable, returns an error err: unknown, yet it doesn’t do that when referenced the RNG variable.


Reproduction steps:

  • Create a text global > rng

    • Formula > $tu(rnd, 1/60, 1, 10)$
  • Create a text global > sh

  • Create a flow

    • Trigger: Formula > $gv(rng)$
    • Action: Delay > $gv(rng)$
    • Action: Formula > $gv(rng)$
    • Action: Set Global Var > sh
  • Create an object

    • Animations: ReactOn > Loop
    • Animations: Duration > $gv(sh)*10$

Expected: Duration field should accept the value from the sh global and update every X seconds (X being a random number passed to the sh global).

Actual: Formula editor returns an err: unknown error, text preview shows the default Text Preview and the Duration value stays on the default 10.

Yeah apparently this was just a classic stupid mistake of naming a variable after a function. Leaving this here for future reference though, lol.

1 Like

This topic was automatically closed 25 days after the last reply. New replies are no longer allowed.