Define FromScript Patch? It's there and it works. (Until it doesn't)

Hello everyone, I’m new here, and feeling guilty for just barging in with questions without ever having contributed but I’m really at my wit’s end here so…

I’m using a simple randomizer script to avoid repeating the same value. It works correctly 99% of the time but very occasionally throws up an error and doesn’t return a new value. Spark then tells me to make the FromScript patch but the patch is already there. On the next screentap it just carries on working as normal.
I can’t honestly figure out what’s causing this and I’ve been hitting my head against the wall for so long. Ugh, I’m seriously considering taking up smoking again. :sob: Really hope someone here has some advice for me.

Welcome!

Does this warning happen when you tap, or does it just pop up randomly? I think it might come up when the filter resets and erroneously sends a pulse to the script. I’m not sure, but the script/patch bridge is finicky…

A more reliable method might be to create a tap event handler directly in script instead of passing it in from the patch graph

1 Like

Thanks so much!

It is actually in it’s original form driven by head leans, left and right, as part of a quiz. I was just trying to narrow down potential causes so I built this very simple test.
And yes the warning only pops up when you tap, or lean. In which case I don’t get a new value. And it only happens very occasionally. The rest of the time it works fine.

It happens in the middle of the quiz and after the one skip just carries on working. So I don’t think it’s the filter resetting either.

Just checking in again to say I seem to have fixed it.


This fixed the problem.

Oh, classic “off by one” error! You could use Math.floor too, instead of subtracting