public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
{
IDialogModule dm = World.RequestModuleInterface<IDialogModule>();
if (dm == null)
return;
m_host.AddScriptLPS(1);
UUID av = new UUID();
if (!UUID.TryParse(avatar,out av))
{
Error("llDialog", "First parameter must be a key");
return;
}
int length = buttons.Length;
if (length < 1)
{
Error("llDialog", "At least 1 button must be shown");
return;
}
if (length > 12)
{
Error("llDialog", "No more than 12 buttons can be shown");
return;
}
if (message == string.Empty)
{
Error("llDialog", "Empty message");
}
else if (Encoding.UTF8.GetByteCount(message) > 512)
{
Error("llDialog", "Message longer than 512 bytes");
}
string[] buts = new string[length];
for (int i = 0; i < length; i++)
{
if (buttons.Data[i].ToString() == String.Empty)
{
Error("llDialog", "Button label cannot be blank");
return;
}
/*
if (buttons.Data[i].ToString().Length > 24)
{
Error("llDialog", "Button label cannot be longer than 24 characters");
return;
}
*/
buts[i] = buttons.Data[i].ToString();
}
dm.SendDialogToUser(
av, m_host.Name, m_host.UUID, m_host.OwnerID,
message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
ScriptSleep(m_sleepMsOnDialog);
}