Exemplo n.º 1
0
        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(m_sleepMsOnDialog));
            }
            if (buttons.Length > 12)
            {
                Error("llDialog", "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)
                {
                    Error("llDialog", "Button label cannot be blank");
                    return(DateTime.Now);
                }
                if (buttons.Data[i].ToString().Length > 24)
                {
                    Error("llDialog", "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(m_sleepMsOnDialog));
        }
Exemplo n.º 2
0
        private void onChat(object sender, OSChatMessage chat)
        {
            lock (m_dialogs)
            {
                DialogData data = m_dialogs.Find(x => x.ListenerID == chat.Channel && x.UserID == chat.Sender.AgentId);

                if (data != null)
                {
                    if (chat.Message != "<--" && chat.Message != "-->" && chat.Message != "<- EXIT ->" && chat.Message != " " && chat.Message != String.Empty)
                    {
                        m_scriptEngine.PostScriptEvent(data.ScriptID, "listen", new Object[] { data.ListenerID, chat.From.ToString(), data.UserID.ToString(), chat.Message });
                        return;
                    }

                    if (chat.Message == " " || chat.Message == String.Empty)
                    {
                        return;
                    }

                    if (chat.Message == "<- EXIT ->")
                    {
                        m_dialogs.Remove(data);
                        return;
                    }

                    if (chat.Message == "-->")
                    {
                        data.CurrentPage++;
                    }

                    if (chat.Message == "<--")
                    {
                        data.CurrentPage--;
                    }

                    m_dialogModule.SendDialogToUser(data.UserID, data.ObjectName, data.HostID, data.OwnerID, data.getMessage(), new UUID("00000000-0000-2222-3333-100000001000"), data.ListenerID, data.getPageButtons(data.CurrentPage));
                }
            }
        }
Exemplo n.º 3
0
        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);
        }