• 0

    posted a message on Defining script handlers from XML
    <Frame name="BRM_Frame_Timer">
      <Scripts>
        <OnUpdate>BRM.OnUpdate();</OnUpdate>
      </Scripts>
    </Frame>


    Given a block of frame XML like this, how do I pass the arguments to OnUpdate? Do "self" and "elapsed" just exist for the duration of this function?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Did something change about GetGuildRosterInfo?
    Having looked into it some more, I only seem to get this error on the last person in guild. Is that normal?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Did something change about GetGuildRosterInfo?
    Did something change about the GetGuildRosterInfo function recently? I have an addon that registers for GUILD_ROSTER_UPDATE and calls GuildRoster(). In the event handler, it calls GetGuildRosterInfo a bunch of times to get info for people. However, since like 2 days ago, sometimes GetGuildRosterInfo returns nil for character name (the first return).

    Anybody know why this might be happening?
    Posted in: Lua Code Discussion
  • 0

    posted a message on ChatFrame AddMessage without event global
    Oh haha, it turns out I'm just an idiot ...

    I tried using message filters and it had the problem I had above. Fixed the old AddMessage hook I had but forgot to remove the message filters and re-add the hooks.
    Posted in: Lua Code Discussion
  • 0

    posted a message on ChatFrame AddMessage without event global
    Did they change something about how the dropdown that shows up when you right click a player link in chat works? Before, if I changed the player name (the stuff inside |h |h), everything worked just fine. However, now (post 4.0) when I do this, I get the following results:



    Because it for some reason thinks the player's name is "Laud (TestNote)", when I try to whisper or invite through this dropdown, it fails because the player doesn't exist.

    1) Does anyone know if something changed about this behavior in the 4.0 patch?
    2) Any way to avoid this problem? I basically copied Phanx's code from above.
    Posted in: Lua Code Discussion
  • 0

    posted a message on ChatFrame AddMessage without event global
    What do you mean by "everything else that's related"? You mean my usage of arg2 and stuff?
    Posted in: Lua Code Discussion
  • 0

    posted a message on ChatFrame AddMessage without event global
    Gah, forgot to change the thread title after I hit preview :/
    Posted in: Lua Code Discussion
  • 0

    posted a message on ChatFrame AddMessage without event global
    I wrote a mod (ForumName2 on WoWI) a while back that pastes a custom note next to peoples' names in chat messages by running the code below in a hook of ChatFrame.AddMessage for each chat frame. In the post 4.0 UI code though, the code below doesn't do anything because "event" doesn't exist.

    function ForumName2:AddMessage(frame, msg, ...)
        if(event == "CHAT_MSG_SYSTEM") then
            for i, info in pairs(systemMessageInfo) do
                local output = self:SystemMessageHelper(msg, info, string_match(msg, info.pattern))
                if(output) then
                    msg = output
                    break
                end
            end
        elseif(chatEvents[event]) then
            local note = self:GetNote(arg2)
            if note then
                msg = string_gsub(msg, "|h(.*)" .. arg2 .. "(.*)|h", "|h%1" .. arg2 .. " (" .. note .. ")" .. "%2|h", 1)
            end
        end
        self.hooks[frame]["AddMessage"](frame, msg, ...)
    end
    I tried changing this to use the chat message filter system, but the message you are passed in a chat filter does not contain the full formatting so I can't put the note next to the player's name as in the above code. I also tried just changing the name (which IS passed to you in the chat filter) but this causes issues with display in further messages.

    So, I'm looking for a way to either a) get access to "event" in ChatFrame_AddMessage or b) accomplish the above using chat message filters. Any ideas?
    Posted in: Lua Code Discussion
  • 0

    posted a message on How to change the alpha of chat tabs?
    Really unrelated question, but is the format version of this a lot more efficient or something?

    _G[("ChatFrame%d"):format(i)]
    versus
    _G["ChatFrame" .. i]
    Posted in: Lua Code Discussion
  • 0

    posted a message on Enable background sound in Lua
    Thanks, changing to maximized windowed mode did in fact fix the OnUpdate bug. However, I have a new issue now. As far as I can tell, the "propagation" for changing the sound setting isn't time based - it requires me to actually alt-tab back into the game for at least some sliver of time. Is there some better way of doing what I'm trying to do or am I just SOL?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Enable background sound in Lua
    Actually is there some way to delay 2 seconds without using OnUpdate? OnUpdate doesn't fire when I'm alt-tabbed out of the game.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Enable background sound in Lua
    Easiest way to do that is just to set an OnUpdate script after turning BG sound on?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Enable background sound in Lua
    I'm trying to write a little mod for myself that turns on background sound when a ready check fires because I tend to alt-tab a lot during downtime in raids but don't want background sound on all the time.

    My problem is that setting background sound to on seems to take some time to propagate or something. Using the code I have below, the first time I get a ready check, the bg sound setting gets turned on but I can't hear the sound in the background. However, without changing anything else, if I send a second ready check, that one works. Does anyone know how to avoid this issue (or a better way to do what I'm trying to do)? Thanks.

    local frame = CreateFrame("FRAME", nil, ReadyCheckListenerFrame)
    
    ReadyCheckListenerFrame:SetScript("OnShow", nil)
    
    local bgSound = nil
    local function BgSoundOn()
        bgSound = BlizzardOptionsPanel_GetCVarSafe("Sound_EnableSoundWhenGameIsInBG")
        if(bgSound == 0) then
            AudioOptionsSoundPanelSoundInBG:SetValue(1)
        end
        print(BlizzardOptionsPanel_GetCVarSafe("Sound_EnableSoundWhenGameIsInBG"))
    end
    
    local function BgSoundOff()
        if(bgSound == 0) then
            AudioOptionsSoundPanelSoundInBG:SetValue(0)
        end
    end
    
    function ReadyCheckListenerFrame_OnShow()
        print("ReadyCheckListenerFrame_OnShow")
        BgSoundOn()
        
        PlaySound("ReadyCheck")
        
        --BgSoundOff()
    end
    
    frame:SetScript("OnShow", ReadyCheckListenerFrame_OnShow)
    Posted in: Lua Code Discussion
  • 0

    posted a message on What causes font strings to not show up?
    Heh, sorry, there's just a lot of it so I was trying to keep it simple. Pasted here: http://paste.wowace.com/1653/. The function ObjectiveDisplayHandler is the WatchFrame_UpdateHook I described above, SetTrackerPosition sets the anchor point, and SaveTrackerPosition updates the saved top, bottom, left, and right positions. The call in question is the commented out one on line 1155 - if I comment it out, everything works fine but if I put it in, suddenly the lines sometimes just don't show up.
    Posted in: Lua Code Discussion
  • 0

    posted a message on What causes font strings to not show up?
    Updated the original post with a simplified version of what each of the functions does. WatchFrameLineTemplate is defined in WatchFrame.xml (it's basically a frame with a font string that's defined in line.text).

    To clarify my point about the frames being visible as far as I can tell, I also checked (using GetPoint) to make sure each line has a valid anchor and that WatchFrameLines (the frame the lines are parented to) has a valid anchor.
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.