-- About - configurable behavior to show users what the attached object is all about. -- -- Created by: Thor Alexander -- Created on: 09/06/2008 -- Revision History -- 09/06/2008 TA - New script - I could have been playing spore :) -- Listens for these triggers -- Broadcasts these triggers -- Constants -- Script properties Define Properties() IncludeScript('13197:21') -- ui_library IncludeScript('12071:3') -- configurable -- Private Properties image_window = 0 -- Friendly script name for OX -- script_load_first = 1 about_version = '1.1' -- TODO: this should come from the module stylesheet info -- Public Parameters icon_sprite_id = '-1:-1' -- TODO: point to default Icon here. ExposeProperty('icon_sprite_id', 'Select a Sprite for the About Icon?', 'spriteId') PersistProperty('icon_sprite_id') about_name = "" ExposeProperty('about_name', 'What is this smart object called?') PersistProperty('about_name') about_text = "This is a Metaplace Smart Object. Build with it, Modify it and Share it with your friends and the community." ExposeProperty('about_text', 'What is this smart object all about?') PersistProperty('about_text') about_creator = "" ExposeProperty('about_creator', 'Who created this Smart Object?') PersistProperty('about_creator') script_description = "About" script_icon = '12071:439' script_long_description = "Find out more about this smart object, such as the creator and version number" end -- Triggers -- Delete UI if object is destroyed Trigger destroyed() if (self.image_window ~= 0) then UiDelete(self.image_window) end end -- Redraw if properties are changed in OX Trigger set_script_param(caller, user_id, script_id, name, value) if (script_id == scriptId) then SendTo(self, 'update_about_screen', 50) end end -- Custom config Trigger custom_config(caller, user_id, script_id) if(script_id == scriptId) then local template_name = self.type local template_id_curr = 0 -- Find template Id for _, template_id in pairs(stylesheet.templates._all_) do if(stylesheet.templates[template_id].name == template_name) then template_id_curr = template_id end end local module_id = string.gsub(template_id_curr, ':(.+)', '') for _, module_item in pairs(stylesheet.modules._all_) do local module_data = stylesheet.modules[module_item] if(tostring(module_data.worldId) == module_id) then self.about_version = module_data.version end end local display_area = config_window(self, user_id, script_id, 300, 400) local font_prefix = '' local font_postfix = '' uiId = UiLabel(display_area.id, 'about_name', 0, 16, font_prefix .. self.about_name .. font_postfix) local font_prefix = 'Created by: ' local font_postfix = '' uiId = UiLabel(display_area.id, 'about_version', 0, 40, font_prefix .. self.about_creator .. font_postfix) local font_prefix = 'Version ' local font_postfix = '' uiId = UiLabel(display_area.id, 'about_version', 0, 56, font_prefix .. self.about_version .. font_postfix) local icon_button = UiImageButton( display_area.id, -- parentId 'about_icon', -- name 226, -- x pos 0, -- y pos 64, -- width 64, -- height self.icon_sprite_id, -- default art id self.icon_sprite_id, -- hover art id self.icon_sprite_id, -- press art id '/event about ' .. self.id .. ' ' .. display_area.id -- cmd ) local about_blurb_id = UiMultiLabel( display_area.id, 'about_blurb', 0, -- x pos 74, -- y pos 280, -- width 180, -- height 0, -- red 0, -- green 0, -- blue 128, -- bg red 128, -- bg green 128, -- bg blue 0.80, -- bg alpha 0, -- scroll 0, -- autoscroll 0 -- alignment ) local font_prefix = '' local font_postfix = '' UiText(about_blurb_id, font_prefix .. self.about_text .. font_postfix) end end