HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Function-linked timers

09-27-2006, 10:17 AM#1
darkwulfv
Ok I have a 3 second timer that, when finished, will set a function into action. This timer is in a loop. Now, when the timer is over...
1. The rest of the loop finishes itself while the function runs
2. The loop stands still until the function is done, then continues
(which is correct?)
Timers and loops seem to be an issue with me lately...
09-27-2006, 10:39 AM#2
corvy
You mean the timer loops, as in a periodic timer? If so, you can use this kind of thing in your callback's actions:

Code:
function eh takes nothing returns nothing
local timer t = GetExpiredTimer()
  
  call PauseTimer(t)

  - Do stuff -
  
  call ResumeTimer(t)
  set t = null
endfunction

If you mean a loop as in 'loop ... endloop', then you'd have to use something like your own 'Wait for'
09-27-2006, 10:58 AM#3
darkwulfv
Hold on I thought of something... Because the timer isn't periodic, if I put a polled wait inside the loop equal to the time it will take for the function to complete (theres a wait in the function), like 1.1 length poll wait, could that achieve a similar effect?