Thread Tools Display Modes
11-22-06, 07:49 AM   #1
Hashram
A Defias Bandit
Join Date: Nov 2006
Posts: 2
How to delay a "channel join"

Hi

I'm trying to develop a little addon in order to play with wow ui customization.

In my first addon I have to automatically rejoin a channel at startup so here is my OnEvent :

Code:
if (event == "ADDON_LOADED") then
        
    if(GetChannelName("MYCHANNEL") == 0) then
         id = JoinChannelByName("MYCHANNEL", "SECRET");
    end

    fu();

end
So here is my problems :

- The channel is joined before blizzard classics chans
- When the fu function executes, the channel is not yet joined

Do you have solutions ?
  Reply With Quote
11-22-06, 11:10 AM   #2
sarf
A Cyclonian
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 47
a) to delay the channel join you need to create / use a frame or an addon made for that (Chronos for instance)
b) execute fu() on the even CHANNEL_JOINED or whatever with the "right" parameters.


Solution for a:

function doSomeStuff()
if(GetChannelName("MYCHANNEL") == 0) then
id = JoinChannelByName("MYCHANNEL", "SECRET");
end
end

local frame = CreateFrame("Frame", "MyDelayFrame");
frame.waitUntil = GetTime() + X;
frame:Hide();
frame:SetScript("OnUpdate", function() t=this.waitUntil if ( t ) and ( GetTime() >= t ) then this.waitUntil=nil doSomeStuff() this:Hide(); end end);
frame:Show();


Change X to the time you wish to wait for from the current time.

It is probably better to wait for the CHANNEL_JOINED for Blizz channels (with a timeout if the Blizz channels do not show themselves).

Sarf
  Reply With Quote
11-22-06, 11:16 AM   #3
Hashram
A Defias Bandit
Join Date: Nov 2006
Posts: 2
Thank you

I'm going to try that
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to delay a "channel join"


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