Here's the code I sent steve, all I did was comment out the blinking part as it stacks up if you don't click the tab and change the colors to blue for tab with focus and red for a tab with an associated window which has had new pasting.
ChatStuff = ChatStuff or {}
ChatStuff.fontSize = ChatStuff.fontSize or 9
ChatStuff.fontWidth, ChatStuff.fontHeight = calcFontSize(ChatStuff.fontSize)
mainWidth, mainHeight = getMainWindowSize()
ChatStuff.width = math.floor(mainWidth / 2) - 30
ChatStuff.height = math.floor((mainHeight - 30) / 2)
ChatStuff.wordwrap = (ChatStuff.width / ChatStuff.fontWidth) - 1
ChatStuff.blinkyTimers = ChatStuff.blinkyTimers or {}
ChatStuff.blinkyColor = ChatStuff.blinkyColor or {}
function ChatStuff.posY()
return 25 --because the tabs are 25 high
end
function ChatStuff.posX()
return mainWidth - ChatStuff.width - 15 --the -15 is to keep it from covering the scroll bar
end
function ChatStuff.append(chat)
appendBuffer(string.format("chat%s", chat))
local tab = string.format("tab%s", chat)
if ChatStuff.blinkyTimers[chat] or ChatStuff.currentTab == chat or chat == "All" then
return true
else
-- stop the blink
--ChatStuff.blinkyTimers[chat] = tempTimer(0.5, string.format([[ChatStuff.blink("%s")]], chat))
setBackgroundColor(tab, 255, 0, 0, 125)
ChatStuff.blinkyColor[chat] = 1
end
return true
end
function ChatStuff.blink(chat)
local tab = string.format("tab%s", chat)
if ChatStuff.blinkyColor[chat] == 1 then
setBackgroundColor(tab, 0, 0, 0, 0)
ChatStuff.blinkyColor[chat] = 0
else
setBackgroundColor(tab, 200, 0, 0, 125) -- no focus, but has had new data
ChatStuff.blinkyColor[chat] = 1
end
-- stop the blink
--ChatStuff.blinkyTimers[chat] = tempTimer(0.5, string.format([[ChatStuff.blink("%s")]], chat))
end
chatTable = {
"All",
"IC",
"Toasts",
}
ChatStuff.tabWidth, ChatStuff.tabHeight = math.floor( ChatStuff.width / #chatTable ), 25
ChatStuff.tabPosX, ChatStuff.tabPosY = ChatStuff.posX(), ChatStuff.posY() - 25
-- Functions
function ChatStuffCreate()
local startX = ChatStuff.tabPosX
for _,v in ipairs( chatTable ) do
local tab = "tab" .. v
createLabel( tab, startX, ChatStuff.tabPosY, ChatStuff.tabWidth, ChatStuff.tabHeight, 0 )
resizeWindow( tab, ChatStuff.tabWidth, ChatStuff.tabHeight )
setLabelClickCallback( tab, "switchchat", v )
echo( tab, [[<center><font color="white">]] .. v .. [[</font></center></b></p>]] )
moveWindow( tab, startX, ChatStuff.tabPosY )
startX = startX + ChatStuff.tabWidth
local chat = "chat" .. v
createMiniConsole( chat, ChatStuff.posX(), ChatStuff.posY(), ChatStuff.width, ChatStuff.height )
resizeWindow( chat, ChatStuff.width, ChatStuff.height )
setWindowWrap( chat, ChatStuff.wordwrap )
setMiniConsoleFontSize( chat, ChatStuff.fontSize )
setBackgroundColor( chat, 0, 0, 0, 0 )
moveWindow( chat, ChatStuff.posX(), ChatStuff.posY() )
hideWindow( chat )
end
ChatStuff.currentTab = "none"
switchchat( "All" )
end
function switchchat ( chat )
local o_c = "chat" .. ChatStuff.currentTab
local o_t = "tab" .. ChatStuff.currentTab
local n_c = "chat" .. chat
local n_t = "tab" .. chat
if ChatStuff.currentTab ~= chat then
if ChatStuff.blinkyTimers[chat] then
killTimer(ChatStuff.blinkyTimers[chat])
ChatStuff.blinkyTimers[chat] = nil
ChatStuff.blinkyColor[chat] = nil
end
hideWindow( o_c )
showWindow( n_c )
ChatStuff.currentTab = chat
setBackgroundColor( o_t, 0, 0, 0, 0 )
setBackgroundColor( n_t, 0, 0, 200, 125 ) -- tab with focus
end
end
function ChatStuffResize()
ChatStuff.fontWidth, ChatStuff.fontHeight = calcFontSize(ChatStuff.fontSize)
mainWidth, mainHeight = getMainWindowSize()
ChatStuff.height = ChatStuff.fontHeight * 35
ChatStuff.wordwrap = (ChatStuff.width / ChatStuff.fontWidth) - 1
ChatStuff.tabWidth, ChatStuff.tabHeight = math.floor( ChatStuff.width / #chatTable), 25
ChatStuff.tabPosX, ChatStuff.tabPosY = ChatStuff.posX(), ChatStuff.posY() - 25
ChatStuffCreate()
end
if not ChatStuff.initialized then
ChatStuffCreate()
ChatStuff.initialized = true
end