Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: JavaScript  |  size: 0.93 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. scope test initializer i
  3.     globals
  4.         private constant real DURATION=5.
  5.         private constant string TITLE="HELLO WOLD"
  6.         private timer time=CreateTimer()
  7.         private timerdialog tDia
  8.     endglobals
  9.    
  10.     private function p takes nothing returns nothing
  11.         call BJDebugMsg("timer finished")
  12.     endfunction
  13.    
  14.     private function c takes nothing returns boolean
  15.         call TimerStart(time,DURATION,false,function p)
  16.         set tDia=CreateTimerDialog(time)
  17.         call TimerDialogSetTitle(tDia,TITLE)
  18.         call TimerDialogDisplay(tDia,true)
  19.         return false
  20.     endfunction
  21.    
  22.     private function i takes nothing returns nothing
  23.         local trigger t=CreateTrigger()
  24.         local boolexpr cond=Condition(function c)
  25.         call TriggerRegisterTimerEvent(t,1.,false)
  26.         call TriggerAddCondition(t,cond)
  27.         set t=null
  28.         set cond=null
  29.     endfunction
  30. endscope