WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Chat problem (https://www.wowinterface.com/forums/showthread.php?t=41619)

Quokka 10-17-11 11:12 AM

Chat problem
 
Hi There,

I started working on my old AI chat.
and found out 1 problem since something past patch 4.x

http://pastiebin.com/?page=p&id=4e9c61309e45f

There is a new button in my case "ChatFrane3ButtonFrameMinimizeButton§
I'd love to hide that, and use a doubleclick on the tabs for this.

Other thing, nearly my whole chat has a thinoutline, except
the preprinted text in the editbox, how would I format this?

Thanks

Phanx 10-17-11 04:28 PM

Your paste appears to be blank, but to answer your second question, you need to set the font in the edit box header separately from the edit box:

Code:

ChatFrame1EditBoxHeader:SetFont("Path\\To\\Font.ttf", 16, "OUTLINE")
For your first question, I've never done anything on double-click, and the client doesn't have a way to specifically detect this, so you would need to implement your own delay (eg. if the same button is clicked twice in X time, treat it as a double click, but if after X time the button has not been clicked again, run the normal click action). From there, you could probably just call the OnClick script from the relevant chat frame's minimize button, or look at Blizzard's code and see which function(s) they actually call when that happens.

Torhal 10-17-11 06:02 PM

There most certainly is an OnDoubleClick script handler. ;)

Phanx 10-17-11 07:18 PM

Since when? o_O

Torhal 10-17-11 08:03 PM

At least since WoTLK; possibly before. Interface diffs would have the info...

Quokka 10-17-11 10:58 PM

Thanks you 2.
Odd the paste shows the lua on my pc, but than again it might be in my local cache

Code:

local FSize = 12

local function Hide(f)
        f:SetScript('OnShow', f.Hide)
        f:Hide()
end

------------------------------------ The Box
for i= 1,10 do
        local editbox = _G['ChatFrame'..i..'EditBox']

        local a, b, c = select(6, editbox:GetRegions())
        a:SetAlpha(0)
        b:SetAlpha(0)
        c:SetAlpha(0)
               
        editbox:ClearAllPoints()
        editbox:SetPoint('BOTTOMLEFT', _G.ChatFrame1, 'TOPLEFT', 0, 20)
        editbox:SetPoint('BOTTOMRIGHT', _G.ChatFrame1, 'TOPRIGHT', 0, 20)
        editbox:SetAltArrowKeyMode(false)
        editbox:SetFont(AIUI["fonts"].Basic, FSize, "THINOUTLINE")
        ChatFrame1EditBoxHeader:SetFont(AIUI["fonts"].Basic, FSize, "THINOUTLINE")
       
        -------------------------------- Chat
        _G["ChatFrame"..i]:SetFont(AIUI["fonts"].Basic, FSize, "THINOUTLINE")        ---- Chat Font
        _G["ChatFrame"..i]:SetShadowOffset(0, 0)
        _G['ChatFrame'..i]:SetFading(1)                                                       
        _G['ChatFrame'..i]:SetTimeVisible(20)       
       
        _G['ChatFrame'..i]:SetClampRectInsets(0,0,0,0) -- Move the frame where you whant
        _G['ChatFrame'..i]:SetMaxResize(0,0) -- Max it your Style
        _G['ChatFrame'..i]:SetMinResize(0,0) -- Shrink it down                       
        ------------------------------------ Hide the damm Tabs 1/2
        _G["ChatFrame"..i.."TabLeft"]:SetTexture(nil)
        _G["ChatFrame"..i.."TabMiddle"]:SetTexture(nil)
        _G["ChatFrame"..i.."TabRight"]:SetTexture(nil)
               
        _G["ChatFrame"..i.."TabSelectedMiddle"]:SetTexture(nil)
        _G["ChatFrame"..i.."TabSelectedRight"]:SetTexture(nil)
        _G["ChatFrame"..i.."TabSelectedLeft"]:SetTexture(nil)
               
        _G["ChatFrame"..i.."TabHighlightLeft"]:SetTexture(nil)
        _G["ChatFrame"..i.."TabHighlightRight"]:SetTexture(nil)
        _G["ChatFrame"..i.."TabHighlightMiddle"]:SetTexture(nil)
end

DEFAULT_CHATFRAME_ALPHA = 0

------------------------------------ Real ID Frame
BNToastFrame:SetClampedToScreen(true)

------------------------------------ New
CHAT_FLAG_AFK = "[|cffff0000AFK|r] "
CHAT_FLAG_DND = "[|cffff0000DND|r] "
CHAT_FLAG_GM = "[|cffff0000GM|r] "

------------------------------------ Hide the damm Tabs 2/2
CHAT_FRAME_BUTTON_FRAME_MIN_ALPHA = 0
CHAT_TAB_HIDE_DELAY = 0

CHAT_FRAME_TAB_SELECTED_MOUSEOVER_ALPHA = 1
CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 0
CHAT_FRAME_TAB_NORMAL_MOUSEOVER_ALPHA = 1
CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 0
CHAT_FRAME_TAB_ALERTING_MOUSEOVER_ALPHA = 1
CHAT_FRAME_TAB_ALERTING_NOMOUSE_ALPHA = 0
               
------------------------------------ Sticky Channels
ChatTypeInfo.BATTLEGROUND.sticky = 1
ChatTypeInfo.BATTLEGROUND_LEADER.sticky = 1
ChatTypeInfo.CHANNEL.sticky = 1
ChatTypeInfo.GUILD.sticky = 1
ChatTypeInfo.OFFICER.sticky = 1
ChatTypeInfo.PARTY.sticky = 1
ChatTypeInfo.RAID.sticky = 1
ChatTypeInfo.SAY.sticky = 1

------------------------------------ Not So Sticky Channels
ChatTypeInfo.EMOTE.sticky = 0
ChatTypeInfo.RAID_WARNING.sticky = 0
ChatTypeInfo.WHISPER.sticky = 0
ChatTypeInfo.YELL.sticky = 0

------------------------------------ Moving & Hiding Buttons
local function UpdateBottomButton(frame)
        local button = frame.buttonFrame.bottomButton
        if frame:AtBottom() then
                button:Hide()
        else
                button:Show()
        end
end

local function OnClick(button)
        UpdateBottomButton(button:GetParent():GetParent())
end

hooksecurefunc('FloatingChatFrame_OnMouseScroll', UpdateBottomButton)
for i= 1,10 do
        local frame = _G['ChatFrame'..i]
        frame:HookScript('OnShow', UpdateBottomButton)
       
        local bFrame = frame.buttonFrame
        bFrame:DisableDrawLayer('BACKGROUND')
        bFrame:DisableDrawLayer('BORDER')
       
        local bButton = bFrame.bottomButton
        bButton:ClearAllPoints()
        bButton:SetPoint('TOPRIGHT', frame, 'TOPRIGHT')
        bButton:HookScript('OnClick', OnClick)
        bButton:SetAlpha(.5)
       
        Hide(bFrame.upButton)
        Hide(bFrame.downButton)
        UpdateBottomButton(frame)
end

ChatFrameMenuButton:HookScript('OnShow', function(self) self:Hide() end)
ChatFrameMenuButton:Hide()
FriendsMicroButton:SetScript('OnShow', function(self) self:Hide() end)
FriendsMicroButton:Hide()

------------------------------------ URL test
local color = "C0C0C0"
local pattern = "[wWhH][wWtT][wWtT][\46pP]%S+[^%p%s]"

function string.color(text, color)
        return "|cff"..color..text.."|r"
end

function string.link(text, type, value, color)
        return "|H"..type..":"..tostring(value).."|h"..tostring(text):color(color or "ffffff").."|h"
end

StaticPopupDialogs["LINKME"] = {
        text = "URL COPY",
        button2 = CANCEL,
        hasEditBox = true,
    editBoxWidth = 400,
        timeout = 0,
        exclusive = 1,
        hideOnEscape = 1,
        EditBoxOnEscapePressed = function(self) self:GetParent():Hide() end,
        whileDead = 1,
        maxLetters = 255,
}

local function f(url)
        return string.link("["..url.."]", "url", url, color)
end

local function hook(self, text, ...)
        self:f(text:gsub(pattern, f), ...)
end

function LinkMeURL()
        for i = 1, NUM_CHAT_WINDOWS do
                if ( i ~= 2 ) then
                        local lframe = _G["ChatFrame"..i]
                        lframe.f = lframe.AddMessage
                        lframe.AddMessage = hook
                end
        end
end
LinkMeURL()

local ur = ChatFrame_OnHyperlinkShow
function ChatFrame_OnHyperlinkShow(self, link, text, button)
        local type, value = link:match("(%a+):(.+)")
        if ( type == "url" ) then
                local dialog = StaticPopup_Show("LINKME")
                local editbox1 = _G[dialog:GetName().."EditBox"] 
                editbox1:SetText(value)
                editbox1:SetFocus()
                editbox1:HighlightText()
                local button = _G[dialog:GetName().."Button2"]
           
                button:ClearAllPoints()
         
                button:SetPoint("CENTER", editbox1, "CENTER", 0, -30)
        else
                ur(self, link, text, button)
        end
end

------------------------------------ Shorten Channel Names
local gsub = _G.string.gsub
local newAddMsg = {}
local chn, rplc

CHAT_BATTLEGROUND_GET = "BG %s: "
CHAT_BATTLEGROUND_LEADER_GET = "BGL: %s "
CHAT_SAY_GET = "%s: "
CHAT_YELL_GET = "%s: "
CHAT_WHISPER_GET = "F %s: "
CHAT_WHISPER_INFORM_GET = "T %s: "
CHAT_GUILD_GET = "G %s: "
CHAT_OFFICER_GET = "O %s: "
CHAT_PARTY_GET = "P %s: "
CHAT_PARTY_LEADER_GET = "PL %s: "
HAT_PARTY_GUIDE_GET = "DG %s: "
CHAT_RAID_GET = "R %s: "
CHAT_RAID_LEADER_GET = "RL %s: "
CHAT_RAID_WARNING_GET = "RW %s: "

CHAT_FLAG_AFK = "[AFK] "
CHAT_FLAG_DND = "[DND] "
CHAT_FLAG_GM = "[GM] "

        rplc = {
                "[g]", --General
                "[t]", --Trade
                "[WD]", --WorldDefense
                "[LD]", --LocalDefense
                "[LFG]", --LookingForGroup
                "[gr]", --GuildRecruitment
        }

        local L = GetLocale()
        if  L == "deDE" then --German
                chn = {
                        "%[%d+%. Allgemein.-%]",
                        "%[%d+%. Handel.-%]",
                        "%[%d+%. Weltverteidigung%]",
                        "%[%d+%. LokaleVerteidigung.-%]",
                        "%[%d+%. SucheNachGruppe%]",
                        "%[%d+%. Gildenrekrutierung.-%]",
                }
        else
                chn = {
                        "%[%d+%. General.-%]",
                        "%[%d+%. Trade.-%]",
                        "%[%d+%. WorldDefense%]",
                        "%[%d+%. LocalDefense.-%]",
                        "%[%d+%. LookingForGroup%]",
                        "%[%d+%. GuildRecruitment.-%]",
                }
        end

local function AddMessage(frame, text, ...)
        for i = 1, 6 do
                text = gsub(text, chn[i], rplc[i])
        end
        text = gsub(text, "%[(%d0?)%. .-%]", "[%1]") --custom channels
        return newAddMsg[frame:GetName()](frame, text, ...)
end

        for i = 1, 5 do
                if i ~= 2 then -- skip combatlog
                        local ch = _G[format("%s%d", "ChatFrame", i)]
                        newAddMsg[format("%s%d", "ChatFrame", i)] = ch.AddMessage
                        ch.AddMessage = AddMessage
                end
    end

--Alt click invite.
local origSetItemRef = SetItemRef
SetItemRef = function(link, text, button)
        local linkType = string.sub(link, 1, 6)
        if IsAltKeyDown() and linkType == "player" then
                local aname = string.match(link, "player:([^:]+)")
                InviteUnit(aname)
                return nil
        end
        return origSetItemRef(link,text,button)
  end


Seerah 10-18-11 08:17 PM

My screen shows the Lua in the paste, too, though it took a second to appear.


All times are GMT -6. The time now is 12:38 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI