-- player_tells - Player component of private messaging -- (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 -- 07/10/2008 P.Ferland - Cross-world support -- 08/04/2008 P.Ferland - Added XW auto-sub upgrade logic -- 08/08/2008 P.Ferland - Made xworld/Metaplace the default chat channel -- Constants CURRENT_XW_SUB_STATUS = 'Metaplace' OLD_XW_SUBS = { 'Alpha', 'Testers' } -- Script properties Define Properties() chat_system_tell_reply = '' chat_system_tell_afk = '' chat_system_xworld_subscriptions = { ['Metaplace'] = 1 } PersistProperty('chat_system_xworld_subscriptions') chat_system_xw_sub_status = 'Alpha' PersistProperty('chat_system_xw_sub_status') IncludeScript('11302:12') -- chat_utility end -- Commands -- no commands -- Triggers Trigger attach() if (self.chat_system_xw_sub_status ~= CURRENT_XW_SUB_STATUS) then local sub = '' for _, sub in ipairs(OLD_XW_SUBS) do self.chat_system_xworld_subscriptions[sub] = nil end self.chat_system_xworld_subscriptions[CURRENT_XW_SUB_STATUS] = 1 self.chat_system_xw_sub_status = CURRENT_XW_SUB_STATUS SaveToDb(self) end end -- User receives a tell Trigger chat_system_tell(sender) local w = GetWorld() if (w.chat_system.chat_system_tell_enabled == 1) then -- Set reply-to target self.chat_system_tell_reply = sender.name -- If user is AFK, send auto-responder back if (self.chat_system_tell_afk ~= '') then local afk_message = self.name .. ' is afk: ' .. self.chat_system_tell_afk local channel = chat_system_channel_name('user', sender.name) local w = GetWorld() SendTo(w.chat_system, 'chat_system_send_message', 0, sender, afk_message, channel, self, 'tell') end end end -- Local functions -- no functions