Exemplo n.º 1
0
 private void onReset()
 {
     if (DebugLogging)
     {
         Log.Write("Resetting world.");
     }
     ScenePrivate.ResetScene();
 }
Exemplo n.º 2
0
 public void Error(string name)
 {
     Log.Write(LogLevel.Error, "DEBUGGER", "A SCRIPT ON WATCHED OBJECT " + name + " HAS CRASHED.");
     if (ResetScene)
     {
         Log.Write(LogLevel.Error, "RESET", "RESETTING WORLD.");
         ScenePrivate.ResetScene();
     }
 }
Exemplo n.º 3
0
    private void ResetScene(AgentPrivate agent)
    {
        ModalDialog Dlg;

        //AgentPrivate agent = ScenePrivate.FindAgent(hitter);
        if (agent == null)
        {
            return;
        }

        Dlg = agent.Client.UI.ModalDialog;
        WaitFor(Dlg.Show, "Are you sure you want to reset the entire scene?", "YES", "NO");
        if (Dlg.Response == "YES")
        {
            StartCoroutine(() =>
            {
                ScenePrivate.Chat.MessageAllUsers("Resetting scene");
                Wait(TimeSpan.FromSeconds(1));
                ScenePrivate.ResetScene();
            });
        }
    }
Exemplo n.º 4
0
        void MemoryUpdate(MemoryData data)
        {
            if (data.UseLevel == MemoryUseLevel.Critical ||
                data.UseLevel == MemoryUseLevel.Limit ||
                Memory.UsedBytes > Memory.PolicyCritical)
            {
                if (!HasLogged)
                {
                    Log.Write(LogLevel.Error, "RESET", "SCRIPT MEMORY HAS PASSED CRITICAL LEVEL" + (ResetScene ? ", RESETTING WORLD" : "") + ". " + Memory.UsedBytes + "/" + Memory.PolicyCritical);
                    HasLogged = true;
                }

                if (ResetScene)
                {
                    ScenePrivate.ResetScene();
                }
            }
            else
            {
                HasLogged = false;
            }
        }
Exemplo n.º 5
0
    public override void Init()
    {
        Script.UnhandledException += UnhandledException;

        //Init Songlist
        var songlist = new List <Tuple <string, string, int> >
        {
            Tuple.Create("Fmaa", "vtfKVoUYzyE", 56),
            Tuple.Create("Cirrus", "WF34N4gJAKE", 202),
            Tuple.Create("Boy & Bear", "sy4IhE-KAEg", 205),
            Tuple.Create("We Are Number One", "DUzBtXi-9Bs", 163),
            Tuple.Create("Spocktopus", "qc57-IcwnB0", 196),
            Tuple.Create("Warriors", "Ve_p5lfYIIs", 260),
            Tuple.Create("Miami Nights 1984", "rDBbaGCCIhk", 234),
            Tuple.Create("The Awakening", "i_Pn4myR8Cw", 334),
            Tuple.Create("Never Dance Again (Battle Tapes Remix)", "cmW4d7CrqBw", 251),
            Tuple.Create("Out For A Rip", "F-glHAzXi_M", 210)
        };

        var playlists = new List <Tuple <string, string, int> >
        {
            Tuple.Create("Pogo", "PLupdJjxWWYR55JN3UlaQdS2LPe5-fjlx7", 28),
            Tuple.Create("Jaboody Dubs", "PLSZtrpAn6e8eP_U7Fbf-jA2ob-76IqY2u", 24)
        };

        ScenePrivate.Chat.Subscribe(0, (ChatData data) => {
            if (isSmoCmd(data))
            {
                //remove cmdChar
                string cmdstr = data.Message.Substring(1, data.Message.Length - 1);

                //split on sep max 3 parts
                string[] parts = cmdstr.Split(new string[] { " " }, 3, StringSplitOptions.RemoveEmptyEntries);

                //find out operation
                if (parts.Length > 0)
                {
                    string oper = parts[0].ToLower();
                    switch (oper)
                    {
                    case "commands":
                        msgId(data.SourceId,
                              "\nCommand List: " +
                              "\n " + cmdChar + "yt       Plays youtube urls" +
                              "\n " + cmdChar + "ytpl     Plays youtube playlist" +
                              "\n " + cmdChar + "reset    Reset experience" +
                              "\n " + cmdChar + "about    About experience" +
                              "\n " + cmdChar + "commands This command" +
                              "\n "
                              );
                        break;

                    case "about":
                        SceneInfo info = ScenePrivate.SceneInfo;
                        msgId(data.SourceId,
                              "About: " + info.ExperienceName +
                              "\n- AvatarId: " + info.AvatarId
                              );
                        break;

                    case "yt":
                        //Make sure there is parameter
                        if (parts.Length > 1)
                        {
                            //string ytUrl = parts[2];
                            string ytUrl = getYtEmbedUrl(parts[1]);
                            msgId(data.SourceId, "yturl: " + ytUrl);
                            stopYt(false);
                            ScenePrivate.OverrideMediaSource(ytUrl);
                        }
                        else
                        {
                            playRandomSong(songlist);
                        }
                        break;

                    case "ytpl":
                        stopYt(false);
                        if (parts.Length > 1)
                        {
                            string ytPlUrl = getYtPlEmbedUrl(parts[1]);
                            msgId(data.SourceId, "ytplurl: " + ytPlUrl);
                            ScenePrivate.OverrideMediaSource(ytPlUrl);
                        }
                        else
                        {
                            Random r = new Random();
                            int rInt = r.Next(0, playlists.Count);
                            msgAll(
                                "[" + (rInt + 1) + "/" +
                                playlists.Count + "]" +
                                playlists[rInt].Item1
                                );
                            curPlayId = rInt;
                            ScenePrivate.OverrideMediaSource(getYtPlEmbedUrl(playlists[rInt].Item2));
                        }
                        break;

                    case "live":
                        stopYt(false);
                        ScenePrivate.OverrideMediaSource("http://wantsmo.com:8000/live.html");
                        msgAll("Starting Stream Please Stand By");
                        break;

                    case "url":
                        if (parts.Length > 1)
                        {
                            ScenePrivate.OverrideMediaSource(parts[1]);
                        }
                        break;

                    case "stop":
                        stopYt(true);
                        break;

                    case "reset":
                        msgAll("Reset in 5 seconds");
                        Wait(TimeSpan.FromSeconds(5));
                        ScenePrivate.ResetScene();
                        break;

                    default:
                        //msgId(data.SourceId, "Invalid Command");
                        break;
                    }
                }
            }
        });
        //Play some random youtubes
        playRandomSong(songlist);
    }