public DateTime llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
{
IDialogModule dm = World.RequestModuleInterface<IDialogModule>();
if (dm == null)
return DateTime.Now;
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return DateTime.Now;
UUID av = new UUID();
if (!UUID.TryParse(avatar, out av))
{
//Silently accepted in in SL NOTE: it does sleep though!
//LSLError("First parameter to llDialog needs to be a key");
return PScriptSleep(1000);
}
if (buttons.Length > 12)
{
LSLError("No more than 12 buttons can be shown");
return DateTime.Now;
}
string[] buts = new string[buttons.Length];
for (int i = 0; i < buttons.Length; i++)
{
if (buttons.Data[i].ToString() == String.Empty)
{
LSLError("button label cannot be blank");
return DateTime.Now;
}
if (buttons.Data[i].ToString().Length > 24)
{
LSLError("button label cannot be longer than 24 characters");
return DateTime.Now;
}
buts[i] = buttons.Data[i].ToString();
}
if (buts.Length == 0)
buts = new[] { "OK" };
dm.SendDialogToUser(
av, m_host.Name, m_host.UUID, m_host.OwnerID,
message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
return PScriptSleep(1000);
}