-- player_channel_colors - Player component of channel coloring
-- (component of Chat System)
-- Template attachment: player (dynamically via Chat System)
-- Created by: Patrick Ferland
-- Created on: 05/27/2008
-- Revision History
-- 05/27/2008 P.Ferland - New script
-- 05/30/2008 P.Ferland - Initial release
-- 06/02/2008 P.Ferland - Cleanup and documentation
-- 06/10/2008 P.Ferland - Removed spurious debug
-- 07/10/2008 P.Ferland - Cross-world support
-- Constants
-- no constants
-- Script properties
Define Properties()
IncludeScript('11302:12') -- chat_utility
end
-- Commands
-- no commands
-- Triggers
-- Preprocess message: Add color font tags now!
-- This message can be extended with more channels for coloration...
Trigger chat_system_message_pre(message, channel, sender, command)
if (self.chat_system_current_message == '') then
self.chat_system_current_message = message
end
local pre = ''
local post = ''
local w = GetWorld()
if (w.chat_system.chat_system_channel_color_enabled == 1) then
-- TODO: Extensible map of channel colors
if (channel == chat_system_channel_name('world')) then
if (w.chat_system.chat_system_channel_color_world == 1) then
pre = ''
post = ''
end
elseif (string.find(channel, '/_spatial_') ~= nil) then
if (w.chat_system.chat_system_channel_color_spatial == 1) then
pre = ''
post = ''
end
elseif (string.find(channel, chat_system_channel_name('world') .. '#') ~= nil) then
if (w.chat_system.chat_system_channel_color_place == 1) then
pre = ''
post = ''
end
elseif (string.find(channel, '/user/') ~= nil) then
if (w.chat_system.chat_system_channel_color_user == 1) then
pre = ''
post = ''
end
elseif (string.find(channel, '/xworld/') ~= nil) then
if (w.chat_system.chat_system_channel_color_xworld== 1) then
pre = ''
post = ''
end
end
end
self.chat_system_current_message = pre .. self.chat_system_current_message .. post
-- message will now go through message and message_finalize triggers...
SendTo(self, 'chat_system_message_pre_done', 0, message, channel, sender, command)
end
-- Local functions
-- no functions