Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- first, add a script named sysConnectionEvent, with the registered event handler sysConnectionEvent, and the following body:
- function sysConnectionEvent()
- showCommunicationWindow()
- end
- -- next, add a script named sysWindowResizeEvent, with the registered event handler sysWindowResizeEvent, and the following body:
- function sysWindowResizeEvent(event, x, y)
- showCommunicationWindow()
- end
- -- now add a script named showCommunicationWindow, with the following body:
- function showCommunicationWindow()
- local windowWidth, windowHeight = getMainWindowSize()
- local fontSize = 8
- local width,height = calcFontSize(fontSize)
- local consoleWidth = width * 80
- local consoleHeight = height * 30
- local scrollBarWidth = 15
- createMiniConsole("communication", windowWidth-consoleWidth-scrollBarWidth,0,consoleWidth,consoleHeight)
- setBackgroundColor("communication",0,0,0,255)
- setMiniConsoleFontSize("communication", fontSize)
- setWindowWrap("communication", 80)
- end
- -- one more script, this one named trackCommunication, with the following body:
- function trackCommunication(channel, user, message)
- local color = "<white:black>"
- local prefix = ""
- local timestamp = os.date("%H:%M:%S")
- if channel == "gossip" then
- color = "<purple:black>"
- if user == "you" then
- prefix = "You gossip"
- else
- prefix = string.format("%s gossips", user)
- end
- elseif channel == "tell" then
- color = "<red:black>"
- prefix = string.format("%s tells you", user)
- elseif channel == "you-tell" then
- color = "<red:black>"
- prefix = string.format("You tell %s", user)
- end
- local text = string.format("%s%s %s: %s\n", color, timestamp, prefix, message)
- cecho("communication", text)
- end
- -- if you want to mess with the colors, or how things are displayed, you can muck about with the trackCommunication function to do so. next, we'll need some triggers to track things. here are some examples:
- -- for your gossips, a trigger with the perl regex:
- ^(?:\d+H \d+M \d+V \d+XP (?:[A-Z]+ )*(?: \[.+\] )?\> )?You gossip, \'(.*)\'
- -- and body:
- trackCommunication("gossip", "you", matches[2])
- -- for other peoples' gossips, a trigger with the perl regex:
- ^(?:\d+H \d+M \d+V \d+XP (?:[A-Z]+ )*(?: \[.+\] )?\> )?(\w+) gossips, \'(.*)\'
- -- and body:
- trackCommunication("gossip", matches[2], matches[3])
- -- for your tells, a trigger with the perl regex:
- ^(?:\d+H \d+M \d+V \d+XP (?:[A-Z]+ )*(?: \[.+\] )?\> )?You tell (\w+), \'(.*)\'
- -- and body:
- trackCommunication("you-tell", matches[2], matches[3])
- -- for other peoples' tells, a trigger with the perl regex:
- ^(?:\d+H \d+M \d+V \d+XP (?:[A-Z]+ )*(?: \[.+\] )?\> )?(\w+) tells you, \'(.*)\'
- -- and body:
- trackCommunication("tell", matches[2], matches[3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement