Quote: "It ought to be 'if timer() >= loop_time'..."
Typo, sorry. Of course, it ought to be.
Quote: "Grossman, that wouldn't quite work; Effectively, you increase the loop_time that it's checking for by 1 with the inc command."
It can be like this:
loop_time = timer()+loop_delay
But the main loop rate won't be constant.
So, here's another revision of my sync system:
sync on
sync rate 0
... :`any commands you want to use before the main loop
`prepare syncroniser's data
loop_rate = 60 :`main loop rate limit
loop_delay = 1000/sync_rate :`delay between main loop's passes
loop_time = timer()
`----- sync loop -----
do
`----- main loop -----
time = timer()
if time >= loop_time
... :`main loop's body (interactive, maths, objects controlling)
loop_delay_actual = timer()-time
if loop_delay_actual <= loop_delay
inc loop_time, loop_delay :`increase sync's data by constant value
else
loop_time = timer()+loop_delay
endif
endif
`----- main loop end -----
... :`sync loop's body (2D-output)
sync
loop
`----- sync loop end -----
Quote: "...But it's not bad for a piece of timer-based code. ^^"
It was written "on fly"...