Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Place all of the below into a script named commChannel
- -- 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.
- -- 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.
- ui = ui or {}
- -- Echo chat to chat windows.
- function ui.chatSay (window, text)
- -- Sub 'ui.allChat' for whatever your all chat container is.
- ui.allChat:cecho(text)
- -- Sub 'ui[window .. "Chat"]' for whatever your secondary (if any) windows are.
- ui[window .. "Chat"]:cecho(text)
- end
- -- So gmcp.Comm.Channel comes with color codes embedded in it. All the 'actualComm' string.subs are just stripping those out.
- function commChannel ()
- local comm = gmcp.Comm.Channel
- if ui.chatIgnore(comm.Text.text) then return end
- if comm.Text.channel == "sqt" then
- local actualComm = string.sub(comm.Text.text, 10)
- local actualComm = string.sub(actualComm, 1, -8)
- ui.chatSay("squad", "<red> " .. actualComm .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "tell") then
- local actualComm = string.sub(comm.Text.text, 10)
- local actualComm = string.sub(actualComm, 1, -8)
- ui.chatSay("tells", "<yellow> " .. actualComm .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "says") then
- local actualComm = string.sub(comm.Text.text, 10)
- local actualComm = string.sub(actualComm, 1, -8)
- ui.chatSay("says", "<cyan> " .. actualComm .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "shout") then
- local actualComm = string.sub(comm.Text.text, 8)
- local actualComm = string.sub(actualComm, 1, -8)
- ui.chatSay("misc", "<sea_green> " .. actualComm .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "yell") then
- local actualComm = string.sub(comm.Text.text, 8)
- local actualComm = string.sub(actualComm, 1, -8)
- ui.chatSay("misc", "<sea_green> " .. actualComm .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "clt") then
- ui.chatSay("clan", "<gray> " .. comm.Text.text .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "ct") then
- ui.chatSay("city", "<gray> " .. comm.Text.text .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "cgt") then
- ui.chatSay("city", "<gray> " .. comm.Text.text .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "ot") then
- ui.chatSay("order", "<gray> " .. comm.Text.text .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "gt") then
- ui.chatSay("guild", "<gray> " .. comm.Text.text .. "<reset>\n\n")
- elseif string.find(comm.Text.channel, "gnt") then
- ui.chatSay("guild", "<gray> " .. comm.Text.text .. "<reset>\n\n")
- else
- ui.chatSay("misc", "<gray> " .. comm.Text.text .. "<reset>\n\n")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement