Thread Tools Display Modes
02-26-11, 07:34 AM   #1
Platine
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 72
Delay function

How to make a proper function of the delay?

function My_Delay(sec)
local My_currentTime=GetTime();
while ( My_currentTime+sec>GetTime() ) do
-- wait a 'sec' time
end
end

My_Delay(5) - Wow sleep on 5 sec., and are not supported any action
  Reply With Quote
02-26-11, 08:44 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
I doubt you can tell wow to sleep for any amount of time as events are processed as they occur.

However, you can create a frame in an addon that has an onupdate routine that can trigger your options within a timer system but only your addon. It will not stop other addons from doing their stuff or wow itself.
__________________
  Reply With Quote
02-26-11, 01:33 PM   #3
Platine
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 72
User-function wait

Yes, you're right, just call the user-function wait:

http://www.wowwiki.com/Wait

Thanks.
  Reply With Quote
02-26-11, 05:33 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
ooh, learn something new every day

I'm assuming you've tried it and it works.
__________________
  Reply With Quote
02-26-11, 06:09 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
That won't make WoW "sleep", though. It sounds as if you want WoW to become unresposive. You can do this, but it would also freeze up the display of the game as well and may disconnect you. Why you would do this, I have no idea.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Delay function

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off