QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: krovit on February 03, 2020, 02:41:38 pm
-
Hi,
ON UEVENT is not supported by Qb64 (and maybe it never will be, I guess).
Question: Is there an alternative to observe the behavior of a variable?
In other words, I would like a certain function to be activated when a variable takes on a certain value.
Of course, just an IF or a GOSUB or another "manual" system that checks the value at each step but to do so it must be called continuously.
I would like the program to monitor the situation and act accordingly.
Maybe it already exists and I complicate things unnecessarily but at the moment I don't seem to remember anything that is right for me.
-
Use a timer. When the timer hits, check for the variable value and launch the procedure.
http://www.qb64.org/wiki/ON_TIMER(n)
-
Thanks Filippe, Thanks, I will try to implement this function that I already use elsewhere.
-
my 2 cents
moreover you can manage manually a loop like timer or FPS and trigger the event as you need in your code.
for example
DO
_LIMIT 50 ' it gives 50 action per second to this program
FPS = FPS +1
if FPS = 30 then FPS = 0
if FPS = 25 then Trigger UEvent1 (call the SUB/Function)
LOOP UNTIL QUIT$ = True
END
SUB UEvent 1
'what you need to do
END SUB
-
2 cents interesting... thank you