diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs index 29f7f68419..e189489d75 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs @@ -189,9 +189,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule /// /// The message to send to the user void Say(string msg); - + + /// + /// Causes the object to speak to on a specific channel, + /// equivilent to LSL/OSSL llSay + /// + /// The message to send to the user + /// The channel on which to send the message void Say(string msg,int channel); + /// + /// Opens a Dialog Panel in the Users Viewer, + /// equivilent to LSL/OSSL llDialog + /// + /// The UUID of the Avatar to which the Dialog should be send + /// The Message to display at the top of the Dialog + /// The Strings that act as label/value of the Bottons in the Dialog + /// The channel on which to send the response + void Dialog(UUID avatar, string message, string[] buttons, int chat_channel); + //// /// Grants access to the objects inventory /// diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index f51498cc3a..96cccb77d0 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -31,6 +31,7 @@ using System.Security; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; using OpenSim.Region.Physics.Manager; @@ -402,7 +403,48 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule SceneObjectPart sop = GetSOP(); m_rootScene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Say,channel, sop.AbsolutePosition, sop.Name, sop.UUID, false); } - + + public void Dialog(UUID avatar, string message, string[] buttons, int chat_channel) + { + if (!CanEdit()) + return; + + IDialogModule dm = m_rootScene.RequestModuleInterface(); + + if (dm == null) + return; + + if (buttons.Length < 1) + { + Say("ERROR: No less than 1 button can be shown",2147483647); + return; + } + if (buttons.Length > 12) + { + Say("ERROR: No more than 12 buttons can be shown",2147483647); + return; + } + + foreach(string button in buttons) + { + if (button == String.Empty) + { + Say("ERROR: button label cannot be blank",2147483647); + return; + } + if (button.Length > 24) + { + Say("ERROR: button label cannot be longer than 24 characters",2147483647); + return; + } + } + + dm.SendDialogToUser( + avatar, GetSOP().Name, GetSOP().UUID, GetSOP().OwnerID, + message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons); + + } + #endregion