View Single Post
Unread 04-16-10, 12:44 PM   #7
Cripsii
A Black Drake
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 81
So, I found the script of the chat tab

After a few test, It seem to be OK.

Fisrt, create a script object nammed "autoexec" in your package explorer (I've created it in "script" package)
Then right click in your package and choose package info. Just Tick the checkbox "run autoexec" and save

Then in your autoexec script file copy/paste the script:

Code:
local event = CreateFrame"Frame"
local _G = getfenv(0)
local inherit = GameFontNormalSmall
local type = type
local _AddMessage = ChatFrame1.AddMessage
local buttons = {"UpButton", "DownButton", "BottomButton"}
local dummy = function() end

_G.CHAT_GUILD_GET = "(G) %s:\32"
_G.CHAT_RAID_GET = "(R) %s:\32"
_G.CHAT_PARTY_GET = "(P) %s:\32"
_G.CHAT_RAID_WARNING_GET = "(W) %s:\32"
_G.CHAT_RAID_LEADER_GET = "(L) %s:\32"
_G.CHAT_OFFICER_GET = "(O) %s:\32"
_G.CHAT_BATTLEGROUND_GET = "(B) %s:\32"
_G.CHAT_BATTLEGROUND_LEADER_GET = "(L) %s:\32"
_G.CHAT_SAY_GET = "%s:\32"
_G.CHAT_YELL_GET = "%s:\32"
_G.CHAT_WHISPER_GET = "%s:\32"
_G.CHAT_WHISPER_INFORM_GET = "(T) %s:\32"
_G.CHAT_FLAG_AFK = "[AFK] "
_G.CHAT_FLAG_DND = "[DND] "
_G.CHAT_FLAG_GM = "[GM] "

local str = "(%d) %3$s"
local channel = function(...)
    return str:format(...)
end

local AddMessage = function(self, text,...)
    if(type(text) == "string") then
        text = text:gsub("|Hplayer:([^:]+):(%d+)|h%[(.-)%]|h", "|Hplayer:%1:%2|h%3|h")
        text = text:gsub("%[(%d+)%. (.+)%].+(|Hplayer.+)", channel)
    end

    return _AddMessage(self, text, ...)
end

local scroll = function(self, dir)
    if(dir > 0) then
        if(IsShiftKeyDown()) then
            self:ScrollToTop()
        elseif(IsControlKeyDown()) then
            self:ScrollUp(); self:ScrollUp(); self:ScrollUp()
        else
            self:ScrollUp()
        end
    elseif(dir < 0) then
        if(IsShiftKeyDown()) then
            self:ScrollToBottom()
        elseif(IsControlKeyDown()) then
            self:ScrollDown(); self:ScrollDown(); self:ScrollDown()
        else
            self:ScrollDown()
        end
    end
end

for i=1, NUM_CHAT_WINDOWS do
    local cf = _G["ChatFrame"..i]
    cf:SetScript("OnMouseWheel", scroll)

    cf:SetFading(false)
    cf:EnableMouseWheel(true)

    for k, button in pairs(buttons) do
        button = _G["ChatFrame"..i..button]
        button:Hide()
        button.Show = dummy
    end

    cf.AddMessage = AddMessage
end

ChatFrameMenuButton:Hide()
ChatFrameMenuButton.Show = dummy

local editbox = ChatFrameEditBox
editbox:ClearAllPoints()
editbox:SetPoint("BOTTOMLEFT",  ChatFrame1, "TOPLEFT", -10, 15)
editbox:SetPoint("BOTTOMRIGHT", ChatFrame1, "TOPRIGHT", 5, 15)
editbox:SetAltArrowKeyMode(false)

local a, b, c = select(6, editbox:GetRegions())
a:Hide(); b:Hide(); c:Hide()

local function tellTarget(s)
    if not UnitExists('target') and UnitName('target') and UnitIsPlayer('target') and GetDefaultLanguage('player') == GetDefaultLanguage('target') or not (s and s:len()>0) then
        return
    end

    local name, realm = UnitName('target')
    if realm and realm ~= GetRealmName() then
        name = ('%s-%s'):format(name, realm)
    end
    SendChatMessage(s, 'WHISPER', nil, name)
end

SlashCmdList['TELLTARGET'] = tellTarget
SLASH_TELLTARGET1 = '/tt'

local OnEnter = function(self)
-- Mouseover
  self:SetNormalFontObject(GameFontNormalSmall)
if(_G["ChatFrame"..self:GetID()] == SELECTED_CHAT_FRAME) then
       self:SetNormalFontObject(GameFontNormalSmall)
    --    message("Vert!");
    else
       self:SetNormalFontObject(GameFontNormalSmall)
    end
 

end
local OnLeave = function(self)
   if(_G["ChatFrame"..self:GetID()] == SELECTED_CHAT_FRAME) then
       self:SetNormalFontObject(GameFontNormalSmall)
    --    message("Vert!");
    else
       self:SetNormalFontObject(GameFontNormalSmall)
    end 

end
local OnShow = function(self)
    self:GetParent():SetNormalFontObject(GameFontRedSmall)
end
local OnHide = function(self)

    self:GetParent():SetNormalFontObject(GameFontNormalSmall)
end

local rollCF = function()
    for i = 1, 7 do
        local chat = _G["ChatFrame"..i]
        local tab = _G["ChatFrame"..i.."Tab"]
        local flash = _G["ChatFrame"..i.."TabFlash"]

        flash:GetRegions():SetTexture(nil)
        flash:SetScript("OnShow", OnShow)
        flash:SetScript("OnHide", OnHide)

        _G["ChatFrame"..i.."TabLeft"]:Hide()
        _G["ChatFrame"..i.."TabMiddle"]:Hide()
        _G["ChatFrame"..i.."TabRight"]:Hide()

        tab:SetScript("OnEnter", OnEnter)
        tab:SetScript("OnLeave", OnLeave)

        tab.SetAlpha = dummy
        if(chat == SELECTED_CHAT_FRAME) then
            tab:SetNormalFontObject(GameFontNormalSmall)
        else
            tab:SetNormalFontObject(GameFontNormalSmall)
        end
        tab:GetHighlightTexture():SetTexture(nil)

        if(chat.isDocked) then
            tab:Show()
            tab.Hide = dummy
        else
            tab.SetAlpha = nil
            tab.Hide = nil
        end
    end
end

event.PLAYER_LOGIN = function()
    rollCF()
    hooksecurefunc("FCF_OpenNewWindow", rollCF)
    hooksecurefunc("FCF_Close", function(self)
        UIParent.Hide(_G[self:GetName().."Tab"])
    end)

    local _orig_FCF_Tab_OnClick = FCF_Tab_OnClick
    FCF_Tab_OnClick = function(button)
        _orig_FCF_Tab_OnClick(button)

        for k, v in pairs(DOCKED_CHAT_FRAMES) do
            if(v == SELECTED_CHAT_FRAME) then
                _G[v:GetName().."Tab"]:SetNormalFontObject(GameFontNormalSmall)
            else
                _G[v:GetName().."Tab"]:SetNormalFontObject(GameFontNormalSmall)
            end
        end
    end

    FCF_ChatTabFadeFinished = dummy
end

event:SetScript("OnEvent", function(self, event, ...)
    self[event](self, event, ...)
end)
event:RegisterEvent"PLAYER_LOGIN"
Then reload your UI.

This script is OLD, probably it had a few bug.

Sorry for english

Regard,

Cripsii
Cripsii is offline   Reply With Quote