Advertisement
Fredbob

Untitled

Dec 14th, 2013
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1. -- Place all of the below into a script named commChannel
  2. -- Type 'gmcp.Comm.Channe.Start' into the 'Add User Defined Event Handler' box and hit enter. It should show up under Registered Event Handlers afterwards.
  3. -- Initialize ui table. This is just the variable I use, you could name it whatever. Just make sure you change all the references to it if you do.
  4.  
  5. ui = ui or {}
  6.  
  7. -- Echo chat to chat windows.
  8. function ui.chatSay (window, text)
  9.     -- Sub 'ui.allChat' for whatever your all chat container is.
  10.     ui.allChat:cecho(text)
  11.     -- Sub 'ui[window .. "Chat"]' for whatever your secondary (if any) windows are.
  12.     ui[window .. "Chat"]:cecho(text)
  13. end
  14.  
  15. -- So gmcp.Comm.Channel comes with color codes embedded in it. All the 'actualComm' string.subs are just stripping those out.
  16.  
  17. function commChannel ()
  18.     local comm = gmcp.Comm.Channel
  19.     if ui.chatIgnore(comm.Text.text) then return end
  20.     if comm.Text.channel == "sqt" then
  21.         local actualComm = string.sub(comm.Text.text, 10)
  22.         local actualComm = string.sub(actualComm, 1, -8)
  23.         ui.chatSay("squad", "<red>  " .. actualComm .. "<reset>\n\n")
  24.     elseif string.find(comm.Text.channel, "tell") then
  25.         local actualComm = string.sub(comm.Text.text, 10)
  26.         local actualComm = string.sub(actualComm, 1, -8)
  27.         ui.chatSay("tells", "<yellow>  " .. actualComm .. "<reset>\n\n")
  28.     elseif string.find(comm.Text.channel, "says") then
  29.         local actualComm = string.sub(comm.Text.text, 10)
  30.         local actualComm = string.sub(actualComm, 1, -8)
  31.         ui.chatSay("says", "<cyan>  " .. actualComm .. "<reset>\n\n")  
  32.     elseif string.find(comm.Text.channel, "shout") then
  33.         local actualComm = string.sub(comm.Text.text, 8)
  34.         local actualComm = string.sub(actualComm, 1, -8)
  35.         ui.chatSay("misc", "<sea_green>  " .. actualComm .. "<reset>\n\n") 
  36.     elseif string.find(comm.Text.channel, "yell") then
  37.         local actualComm = string.sub(comm.Text.text, 8)
  38.         local actualComm = string.sub(actualComm, 1, -8)
  39.         ui.chatSay("misc", "<sea_green>  " .. actualComm .. "<reset>\n\n") 
  40.     elseif string.find(comm.Text.channel, "clt") then
  41.         ui.chatSay("clan", "<gray>  " .. comm.Text.text .. "<reset>\n\n")
  42.     elseif string.find(comm.Text.channel, "ct") then
  43.         ui.chatSay("city", "<gray>  " .. comm.Text.text .. "<reset>\n\n")
  44.     elseif string.find(comm.Text.channel, "cgt") then
  45.         ui.chatSay("city", "<gray>  " .. comm.Text.text .. "<reset>\n\n")
  46.     elseif string.find(comm.Text.channel, "ot") then
  47.         ui.chatSay("order", "<gray>  " .. comm.Text.text .. "<reset>\n\n")
  48.     elseif string.find(comm.Text.channel, "gt") then
  49.         ui.chatSay("guild", "<gray>  " .. comm.Text.text .. "<reset>\n\n")
  50.     elseif string.find(comm.Text.channel, "gnt") then
  51.         ui.chatSay("guild", "<gray>  " .. comm.Text.text .. "<reset>\n\n")
  52.     else
  53.         ui.chatSay("misc", "<gray>  " .. comm.Text.text .. "<reset>\n\n")
  54.     end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement