Hey all. i have done a few copy chat meathods and both find the same error. but not ingame. it crashed the clant.
(code == CODE_NEWLINE || code == CODE_PIPE || code == CODE_INVALIDCODE) || code == CODE_HYPERLINKSTOP || code == CODE_EMBEDDEDTEXTURESTOP
|
code
Code:
local frame = CreateFrame("Frame", "CopyFrame", UIParent)
frame:SetBackdrop({
bgFile = "Interface\\AddOns\\wChat\\media\\UI-DialogBox-Background.blp",
edgeFile = "Interface\\AddOns\\wChat\\media\\UI-DialogBox-Border.blp",
tile = true, tileSize = 16, edgeSize = 16,
insets = {left = 3, right = 3, top = 5, bottom = 3
}})
frame:SetBackdropColor(0, 0, 0, 1)
frame:SetWidth(500)
frame:SetHeight(400)
frame:SetPoint("LEFT", UIParent, "LEFT", 3, 10)
frame:SetFrameStrata("DIALOG")
frame:Hide()
local scrollArea = CreateFrame("ScrollFrame", "CopyFrameScroll", frame, "UIPanelScrollFrameTemplate")
scrollArea:SetPoint("TOPLEFT", frame, "TOPLEFT", 8, -30)
scrollArea:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -30, 8)
local editBox = CreateFrame("EditBox", "CopyBox", frame)
editBox:SetMultiLine(true)
editBox:SetMaxLetters(20000)
editBox:EnableMouse(true)
editBox:SetAutoFocus(true)
editBox:SetFontObject(ChatFontNormal)
editBox:SetWidth(450)
editBox:SetHeight(270)
editBox:SetScript("OnEscapePressed", function() frame:Hide() end)
scrollArea:SetScrollChild(editBox)
local close = CreateFrame("Button", "CopyClose", frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -1)
local lines = {}
local getLines = function(...)
local count = 1
for i = select("#", ...), 1, -1 do
local region = select(i, ...)
if region:GetObjectType() == "FontString" then
lines[count] = tostring(region:GetText())
count = count + 1
end
end
return count - 1
end
local copyChat = function(self, chatTab)
local chatFrame = _G["ChatFrame" .. chatTab:GetID()]
local _, fontSize = chatFrame:GetFont()
FCF_SetChatWindowFontSize(chatFrame, chatFrame, 0.01)
local lineCount = getLines(chatFrame:GetRegions())
FCF_SetChatWindowFontSize(chatFrame, chatFrame, fontSize)
if lineCount > 0 then
local text = table.concat(lines, "\n", 1, lineCount)
frame:Show()
editBox:SetText(text)
end
end
local info = {
text = "Copy Chat Contents",
func = copyChat,
notCheckable = 1
}
local origFCF_Tab_OnClick = _G.FCF_Tab_OnClick
local FCF_Tab_OnClickHook = function(chatTab, ...)
origFCF_Tab_OnClick(chatTab, ...)
info.arg1 = chatTab
UIDropDownMenu_AddButton(info)
end
FCF_Tab_OnClick = FCF_Tab_OnClickHook
i have two types of copy chat codes. this one i like more. so i would like to try to keep it for cata. mainly to have the open copy chat. when you right click on the chat tab. a great thing.
i guess i should say how the error happens. all is fine. even when that copy chat box is open. its when i click in the chat box. or try to copy. the chat.
help would be very very greatfull. or if i can have help on shorting this down
thanks again for your time.
edit.
after going though things. i think its to do with
if CHAT_TIMESTAMP_FORMAT and not text:find("^|r") then
text = BetterDate(CHAT_TIMESTAMP_FORMAT, _G.time())..text
|
of what is not in that part of the code i posted. but its in the script. it adds a timestamp to things that dont always have a timestamp. as when i remove it., it seems to be ok. and also if i dont remove this. and just remove
frame:SetBackdrop({
bgFile = "Interface\\AddOns\\wChat\\media\\UI-DialogBox-Background.blp",
edgeFile = "Interface\\AddOns\\wChat\\media\\UI-DialogBox-Border.blp",
tile = true, tileSize = 16, edgeSize = 16,
insets = {left = 3, right = 3, top = 5, bottom = 3
}})
frame:SetBackdropColor(0, 0, 0, 1)
frame:SetWidth(500)
frame:SetHeight(400)
frame:SetPoint("LEFT", UIParent, "LEFT", 3, 10)
frame:SetFrameStrata("DIALOG")
frame:Hide()
|
from the copy code. it is fine also. the background isnt there but is fine. very stange.