-- Object Browse To Behavior -- Author: Jeff The Intern -- Created On: 08/22/08 -- CONSTANTS SCRIPT_ID = '0:20' -- Properties Define Properties() browse_to_url = '' ExposeProperty('browse_to_url', 'What website do you want to send users to?') PersistProperty('browse_to_url') IncludeScript('12071:3') -- configurable script_description = "Goto Website" script_long_description = "Takes users to a website you define." end -- Triggers Trigger attach() self.user_tooltip = 1 end Trigger detach() end Trigger destroy() end Trigger use(user, ...) open_website(self, user) end Trigger set_script_param(caller, user_id, script_id, param, value) if(script_id == scriptId and param == 'browse_to_url') then local user = GetObjectByid(user_id) SendTo(self, 'set_tool_tip', 0, user, self.id, value) end end Trigger custom_config(caller, user_id, script_id) local user = get_user(user_id) local window = config_window(caller, user_id, script_id, 300, 400) if(IsSuperuser(user) == 1) then local title = UiMultiLabel(window.id, 'window_title', -6, -60, 200, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) UiText(title, string.format("Edit Behavior")) local info = UiMultiLabel(window.id, 'url_value_label', 0, 20, window.width, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) UiText(info, string.format("%s", stylesheet.scripts[SCRIPT_ID].params['browse_to_url'].comment)) local param_value = self['browse_to_url'] local input = UiTextField(window.id, 'url_input', 0, 60, window.width - 6, 15, 0, 0, 0, 255, 255, 255, .8, string.format('/event set_script_param %d %d %s %s', self.id, user_id, SCRIPT_ID, 'browse_to_url'), param_value) else local text = UiMultiLabel(window.id, 'error', 50, 50, window.width - 100, window.height - 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2) UiText(text, string.format('You must be a SuperUser to customize this behavior')) end end -- Functions function open_website(self, user) -- No URL set if(self.browse_to_url == '') then return end OutputToUser(user, '[S_BROWSE]|' .. self.browse_to_url) end function get_user(user_id) local w = GetWorld() for _, user in pairs(w.users) do if(user.id == user_id) then return user end end return nil end