Thread Tools Display Modes
03-14-07, 09:40 PM   #1
Porrohman
A Defias Bandit
Join Date: Dec 2006
Posts: 3
pausing a mod

is it possible to pause the output of a mod for say 5 seconds

I am trying to output multiple lines of text to the windows & I want to have enough time to read it before the next line overwrites it
  Reply With Quote
03-31-07, 01:38 PM   #2
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Originally Posted by Porrohman
is it possible to pause the output of a mod for say 5 seconds

I am trying to output multiple lines of text to the windows & I want to have enough time to read it before the next line overwrites it
You could:

(1) Go into a while loop, checking when 5 seconds have passed with time(), and then continue.

Pros: Very easy to do
Cons: Locks up the game for 5 seconds

(2) Use OnUpdate to calculate when 5 seconds have passed, and then continue by calling a function which does the rest of what you need to do.

Pros: Doesn't lock up the game; the "preferred" way to do it
Cons: Not the easiest thing to understand for newer programmers

http://www.wowwiki.com/HOWTO:_Use_OnUpdate_Correctly
  Reply With Quote
03-31-07, 02:02 PM   #3
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
http://www.wowinterface.com/download...7-Cadence.html looks what you want.
  Reply With Quote
05-09-08, 01:08 PM   #4
Treader
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 5
Originally Posted by Porrohman View Post
is it possible to pause the output of a mod for say 5 seconds

I am trying to output multiple lines of text to the windows & I want to have enough time to read it before the next line overwrites it
Edit: Wow! I didn't even realize how old this thread was. It was still on the first page of the forum listing.

You would need to queue the messages (you probably knew that already). OnUpdate would be the prefered way as using a while true or until false loop would just be stupid and annoying, why Shirik even offered it as an option is beyond me.

Anywho,

Code:
-- assumes the following:
-- f is a local frame or a local reference to a global frame with the following
--   user-defined elements:
--     NextMessage (function) -- you're on your own for writing this.
--     pauseTime (number)
--     lastUpdate (number)
-- f:NextMessage() outputs and removes the next message in the queue. :)
-- f.pauseTime already exists and is set to a number value.
-- f.lastUpdate already exists and is set to 0 (zero) when the
--   frame loads or immediately after it is created.
f:SetScript("OnUpdate", function(self, elapsed)
    self.lastUpdate = self.lastUpdate + elapsed
    -- f:NextMessage() will call every time if f.pauseTime <= 0.
    -- f.lastUpdate will keep getting bigger and bigger if f.pauseTime < 0.
    if self.lastUpdate >= self.pauseTime then
        self:NextMessage()
        self.lastUpdate = self.lastUpdate - self.pauseTime
    end
end)
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » pausing a mod


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