-- chat_channel_colors - Logic to handle and display colored chat channels -- (component of Chat System) -- Template attachment: 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 -- 07/10/2008 P.Ferland - Cross-world support -- 07/22/2008 P.Ferland - Commented out sync scripts -- 10/08/2008 P.Ferland - OX friendliness pass -- 10/10/2008 P.Ferland - Color Versioning Logic -- Constants PLAYER_CHANNEL_COLOR_SCRIPT = '11302:19' COLOR_CURRENT_VERSION = { VERSION = '2', VALUES = { ['chat_system_channel_color_spatial_color'] = '#FFCCFF', ['chat_system_channel_color_place_color'] = '#FFFFCC', ['chat_system_channel_color_world_color'] = '#FFAAAA', ['chat_system_channel_color_user_color'] = '#CC99CC', ['chat_system_channel_color_xworld_color'] = '#CCCCFF', } } -- Script properties Define Properties() script_description = "Chat Channel Colors" script_long_description = "Assign colors to the various standard chat channels, like global or local chat" chat_system_channel_color_enabled = 1 ExposeProperty('chat_system_channel_color_enabled', 'Allow chat color by channel?', 'checkbox') PersistProperty('chat_system_channel_color_enabled') chat_system_channel_color_spatial = 0 ExposeProperty('chat_system_channel_color_spatial', 'Color the Spatial channel?', 'checkbox') PersistProperty('chat_system_channel_color_spatial') chat_system_channel_color_spatial_color = '#FFCCFF' ExposeProperty('chat_system_channel_color_spatial_color', 'Color (web-style) for Spatial channel') PersistProperty('chat_system_channel_color_spatial_color') chat_system_channel_color_place = 1 ExposeProperty('chat_system_channel_color_place', 'Color the Place channel?', 'checkbox') PersistProperty('chat_system_channel_color_place') chat_system_channel_color_place_color = '#FFFFCC' ExposeProperty('chat_system_channel_color_place_color', 'Color (web-style) for Place channel') PersistProperty('chat_system_channel_color_place_color') chat_system_channel_color_world = 1 ExposeProperty('chat_system_channel_color_world', 'Color the World channel?', 'checkbox') PersistProperty('chat_system_channel_color_world') chat_system_channel_color_world_color = '#FFAAAA' ExposeProperty('chat_system_channel_color_world_color', 'Color (web-style) for World channel') PersistProperty('chat_system_channel_color_world_color') chat_system_channel_color_user = 1 ExposeProperty('chat_system_channel_color_user', 'Color the User channel?', 'checkbox') PersistProperty('chat_system_channel_color_user') chat_system_channel_color_user_color = '#CC99CC' ExposeProperty('chat_system_channel_color_user_color', 'Color (web-style) for User channel') PersistProperty('chat_system_channel_color_user_color') chat_system_channel_color_xworld = 1 ExposeProperty('chat_system_channel_color_xworld', 'Color Cross-world channels?', 'checkbox') PersistProperty('chat_system_channel_color_xworld') chat_system_channel_color_xworld_color = '#CCCCFF' ExposeProperty('chat_system_channel_color_xworld_color', 'Color (web-style) for Cross-world channels') PersistProperty('chat_system_channel_color_xworld_color') chat_system_color_version = '1' PersistProperty('chat_system_color_version') IncludeScript('11302:12') -- chat_utility end -- Commands -- no commands -- Triggers -- System trigger: fired on script attachment (attached in builder or object instantiation) Trigger attach() -- Register scripts for loading chat_system_register_player_script(self, PLAYER_CHANNEL_COLOR_SCRIPT) chat_system_version_check(self) end -- System trigger: Fired when script is detached Trigger detach() -- Unregister scripts chat_system_unregister_player_script(self, PLAYER_CHANNEL_COLOR_SCRIPT) end Trigger chat_system_version_check() chat_system_version_check(self) end -- Local functions function chat_system_version_check(self) if (self.chat_system_color_version ~= COLOR_CURRENT_VERSION.VERSION) then local property = '' local value = '' for property, value in pairs(COLOR_CURRENT_VERSION.VALUES) do if (self[property] ~= nil) then self[property] = value end end self.chat_system_color_version = COLOR_CURRENT_VERSION.VERSION end end