YATCO - Yet Another Tabbed Chat Option. This time it blinks

Share your scripts and packages with other Mudlet users.
Yetzederixx
Posts: 186
Joined: Sun Nov 14, 2010 5:57 am

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Yetzederixx »

Send me a pm, I'm at school right now and don't have access to my triggers, but there are lines you can comment out to stop the blinking. I had issues with mudlet slowing down if I ignored the blinks for a long time since I had so little ram.

Also, here's a paste of edits from a post I made on the DSL forums about this script, this is assuming the line numbers haven't changed of course.
Line 38: setBackgroundColor(tab, 200, 0, 0, 125) [window, r, g, b, transparency: 0-255]
Line 26: If you make changes here it'll blink that color once first before it starts to blink
Line 63: This should be the tab text color, may require a restart of mudlet to take affect
Line 95: This will change the tab color for the current tab
Of course, you can just start commenting out single lines and seeing what happens.... :twisted:

Yetzederixx
Posts: 186
Joined: Sun Nov 14, 2010 5:57 am

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Yetzederixx »

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.
Code: [show] | [select all] lua
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
 

Phoenix
Posts: 92
Joined: Tue Feb 15, 2011 3:23 am

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Phoenix »

I've got a problem with this, where the blinking starts happening faster than normal, and it actually will get to where it crashes the system. If I comment out all the temptimers, so that there is no blinking (just a solid color change), then I don't get this problem. I notice this problem more often when I've got multiple profiles open, and it seems to get worse when I use the bomb button in the course of debugging other things. Anyone else have this problem??

Yetzederixx
Posts: 186
Joined: Sun Nov 14, 2010 5:57 am

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Yetzederixx »

Every time a window that doesn't have the focus gets activated before you've clicked its tab it starts another blink sequence. So the blinking isn't actually getting faster it's multiple blinks which are offset from one another. At some point there needs to be some boolean variables, in a table, which get set to true when it's set to blink the first time and checked against before it initiates another set of blinks (then sent to false when you click to check that window/tab), or you just do what myself and Phoenix did.

Phoenix
Posts: 92
Joined: Tue Feb 15, 2011 3:23 am

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Phoenix »

Oh, I see now what you mean... Shouldn't be hard to add in that table. I just didn't know why the hell it was doing it... If and when I get around to adding in that table, I'll post the code I changed. Thanks, Yetz!

Rurik
Posts: 12
Joined: Thu Dec 16, 2010 8:21 pm

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Rurik »

Lua syntax error:[string "ChatStuff = Chatstuff or {}... "]:19: or '...' expected near '

I get that when I copy and paste your first script.

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by demonnic »

edited top post to point to new revision... which I first posted over at the lusternia forums. This one is a mudlet xml file and configuration information is included in the post.

Iktomi
Posts: 46
Joined: Sat Sep 03, 2011 4:00 am

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Iktomi »

Hey Demonnic, thanks for this, it's my favorite tabbed chat so far. The only thing I would like different is if the tabs just lit up, instead of blinked. Is there a way to change it so it'll behave this way?

Trendor
Posts: 20
Joined: Mon Oct 10, 2011 2:51 am

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Trendor »

Silly question: Which post contains the latest script?

Phoenix
Posts: 92
Joined: Tue Feb 15, 2011 3:23 am

Re: YATCO - Yet Another Tabbed Chat Option. This time it bli

Post by Phoenix »

demonnic wrote:edited top post to point to new revision... which I first posted over at the lusternia forums. This one is a mudlet xml file and configuration information is included in the post.
I'd say the first one! All hail Mudlet Forums and infinite editing of the posts!

Post Reply