Set global value without touch


I'm trying to create a resettable, looping counter which seems to be a troublesome endeavor, if it's even possible at all.

But one of my approaches would need the ability to change the value of a global like you can do by using touch actions but instead I want to do it using conditions (if statements).

Something like: if( gv(A) = 1, gv(B) = gv(B) + 5)

Is there any way to do this?

This would create an infinite loop since gv(A) is not "1" at a given moment, what you want is to fire an event when A value changes and do something when that happens, this is not possible right now (i have that idea in the pipeline) though, please create an idea in the ideas forum and request to create an "event based system" similar to tasker to do things like this