-- Worldgate -- Author: Jeff the Intern -- NOTE: This is the limited capacity World Gate used in Hubworld -- Revisions -- New Script - J.McNab -- 08/06/2008 P.Ferland - Adjusted worldgate to use new world_gate_goto pathing-with-teleport method ui = {window = { width = 400, height = 100}} Define Properties() -- Private Properties -- Public Properties display_name= '' ExposeProperty('display_name', 'The name of the world to display') PersistProperty('display_name') worldgate_target= '' ExposeProperty('worldgate_target', 'The name of the world you wish to send users') PersistProperty('worldgate_target') IncludeScript('13197:21') -- ui_library script_description = 'Worldgate' script_long_description = 'Sends users to a different metaplace world!' end Trigger set_script_param(user, user_id, script_id, param_name, value) if(script_id == '13371:25' and param_name == 'display_name') then Debug("Setting tool tip") SendTo(self, 'set_tool_tip', 200, self, self.id, "Go to " .. self.display_name) end end Trigger attach() if(self.display_name ~= '' and self.display_name ~= nil) then name = "Go to " .. self.display_name else name = "Go to A World" end SendTo(self, 'set_tool_tip', 500, self, self.id, name) end Trigger use(object, ...) if(self.worldgate_target ~= nil and self.worldgate_target ~= '') then use_gate(self, object) end end Trigger goto_world(caller, user_id, window_id) if (window_id ~= nil) then UiDelete(window_id) end local user = get_user(user_id) if (user ~= nil) then SendTo(user, 'world_gate_goto', 0, self) end end function use_gate(self, user) local worldgate_ui = ui_confirm_window(0, 'worldgate_ui', 0, 0, ui.window.width, ui.window.height, string.format('/event goto_world %d %d', self.id, user.id)) local command = string.format('/event goto_world %d %d %d', self.id, user.id, worldgate_ui) local worldgate_ui_accept = UiFindWindow(worldgate_ui, 'worldgate_ui_accept') UiCommand(worldgate_ui_accept, command) local description = UiMultiLabel(worldgate_ui, 'hubgate_ui_description', 6, 30, ui.window.width - 12, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2) UiText(description, string.format('Do you want to go to %s?', self.display_name)) UiAlign(worldgate_ui, 0, 0, 'center', 'scale_none') UiAttachUser(user, worldgate_ui) 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