Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timer Trap Problem
#4
Erik, don't take this the wrong way, but that's about the worst idea I think I've ever heard of from a programmer.

On Timer can occur at ANY point inside your code.  

You could have executed 10 lines of your code and went to the On Timer.
You could have executed 40 lines of your code and went to the On Timer.  
As for you next 60 lines of code?  PAH!!  You may as well cut them out of the damn program, as your On Timer triggers and stops execution from ever getting to them.  Oh, maybe not on YOUR PC, but on Pete's old slow one?  Or how about if your PC has a heavy workload and is running slow?  

You don't know where the heck that event was called from, or how deep into your program things might run before it triggers.  

The idea of On Timer is "skip out, do something, skip back..."   

What you're suggesting is "skip out, do something, go someplace completely unrelated".

If that's what you're wanting to do, set up your code to do it with a flag or something:

Code: (Select All)
Rem sample of timer return
t1 = _FreeTimer
On Timer(t1, .1) GoSub Trap
Timer(t1) On
Start:
Do
    x$ = InKey$
    If x$ = Chr$(27) Then End
    If start Then start = 0: GoTo Start 'copy this line where ever the hell you need an exit back to start
Loop
End
Trap:
Count = Count + 1
Print "Trap count:"; Count
start = -1
Return

Return label just isn't designed to work like that with ON TIMER. and it never should be.
Reply


Messages In This Thread
Timer Trap Problem - by eoredson - 10-09-2024, 01:30 AM
RE: Timer Trap Problem - by SMcNeill - 10-09-2024, 01:51 AM
RE: Timer Trap Problem - by eoredson - 10-09-2024, 02:28 AM
RE: Timer Trap Problem - by SMcNeill - 10-09-2024, 02:55 AM
RE: Timer Trap Problem - by eoredson - 10-09-2024, 03:02 AM
RE: Timer Trap Problem - by eoredson - 10-09-2024, 03:37 AM
RE: Timer Trap Problem - by ahenry3068 - 10-09-2024, 11:18 AM
RE: Timer Trap Problem - by Cobalt - 10-09-2024, 03:42 PM
RE: Timer Trap Problem - by bplus - 10-09-2024, 06:40 PM
RE: Timer Trap Problem - by eoredson - 10-10-2024, 12:24 AM



Users browsing this thread: 1 Guest(s)