Adds dialog methods for MRM.
Thanks ziah.
soprefactor
Justin Clark-Casey (justincc) 2010-05-21 23:37:05 +01:00
parent 074937e0e5
commit b2197e3b94
2 changed files with 60 additions and 2 deletions

View File

@ -189,9 +189,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
/// </summary>
/// <param name="msg">The message to send to the user</param>
void Say(string msg);
/// <summary>
/// Causes the object to speak to on a specific channel,
/// equivilent to LSL/OSSL llSay
/// </summary>
/// <param name="msg">The message to send to the user</param>
/// <param name="channel">The channel on which to send the message</param>
void Say(string msg,int channel);
/// <summary>
/// Opens a Dialog Panel in the Users Viewer,
/// equivilent to LSL/OSSL llDialog
/// </summary>
/// <param name="avatar">The UUID of the Avatar to which the Dialog should be send</param>
/// <param name="message">The Message to display at the top of the Dialog</param>
/// <param name="buttons">The Strings that act as label/value of the Bottons in the Dialog</param>
/// <param name="chat_channel">The channel on which to send the response</param>
void Dialog(UUID avatar, string message, string[] buttons, int chat_channel);
//// <value>
/// Grants access to the objects inventory
/// </value>

View File

@ -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<IDialogModule>();
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