Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

archiv:opensim:downloads:scripts:pacman [2024/01/09 22:25] – Externe Bearbeitung 127.0.0.1archiv:opensim:downloads:scripts:pacman [Unbekanntes Datum] (aktuell) – Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1
Zeile 1: Zeile 1:
 +===== Pacman =====
 +
 +==== Game ====
 +
 +<code>
 +// open pacman game server script by kefcom belgium (kefcom@hotmail.com)
 +
 +string currentplayer;
 +integer score;
 +integer maxscore;
 +integer timesplayed;
 +integer timecounter;
 +string playername1;
 +string playername2;
 +string playername3;
 +string playername4;
 +string playername5;
 +integer playerscore1;
 +integer playerscore2;
 +integer playerscore3;
 +integer playerscore4;
 +integer playerscore5;
 +integer maxtime;
 +
 +default
 +{
 +    state_entry()
 +    {
 + 
 +  //////////////////////////////////////////////////////////////////////////////////////
 +        maxscore = 137; //change this value to the number of balls you have on the field
 +        maxtime = 500;
 +/////////////////////////////////////////////////////////////////////////////////////
 + 
 +        playername1 = "nobody";
 +        playername2 = "nobody";
 +        playername3 = "nobody";
 +        playername4 = "nobody";
 +        playername5 = "nobody";
 +        playerscore1 = 300;
 +        playerscore2 = 300;
 +        playerscore3 = 300;
 +        playerscore4 = 300;
 +        playerscore5 = 300;
 +        timesplayed = 0;
 +        score = 0;
 +        llSetText("Game Server", <1,1,1>,1.0);
 +        llListen(1966, "","","");
 +    }
 +   
 +    listen( integer channel, string name, key id, string msg)
 +    {
 +        if(msg=="STOP")
 +        {
 +            llSetTimerEvent(0);
 +            llSay(0, "Game stopped!");
 +            timecounter = 0;
 +            score = 0;
 +            currentplayer = "nobody";
 +            llSetText("Game Server, click for stats", <1,1,1>,1.0);
 +        }
 +        if(msg=="START")
 +        {
 +            score = 0;
 +            llSetText("Score: " + (string) score, <1,1,1>, 1.0);
 +            currentplayer = name;
 +            timecounter = 0;
 +            timesplayed = timesplayed + 1;
 +            llSetTimerEvent(1);
 +        }
 +        if(msg=="POINTS!")
 +        {
 +            score = score + 1;
 +            llSetText("Score: " + (string) score, <1,1,1>, 1.0);
 +            if(score >= maxscore)
 +            {
 +                //GAME OVER!
 +                llShout(0, "Game over");
 +                llSetTimerEvent(0);
 +                llShout(0, "You needed " + (string) timecounter + " Seconds to complete the game!");
 +                llSetText("Game Server, Click me for stats", <1,1,1>, 1.0);
 +               
 +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CALCULATE PLACE IN TOP 5 ////////////////////////////////////////
 +////////////////////////////////////////////////////////////////////////////////////////////
 +               
 +if(timecounter < playerscore5)
 +{
 +    if(timecounter < playerscore4)
 +    {
 +        if(timecounter < playerscore3)
 +        {
 +            if(timecounter < playerscore2)
 +            {
 +                if(timecounter < playerscore1)
 +                {
 +                    //first place
 +                    playerscore5 = playerscore4;
 +                    playerscore4 = playerscore3;
 +                    playerscore3 = playerscore2;
 +                    playerscore2 = playerscore1;
 +                    playerscore1 = timecounter;
 +                   
 +                    playername5 = playername4;
 +                    playername4 = playername3;
 +                    playername3 = playername2;
 +                    playername2 = playername1;
 +                    playername1 = currentplayer;
 +               
 +                    llSay(0, "You are in first place on the scoreboard!");
 +                }else{
 +                    //second place
 +                    playerscore5 = playerscore4;
 +                    playerscore4 = playerscore3;
 +                    playerscore3 = playerscore2;
 +                    playerscore2 = timecounter;
 +                   
 +                    playername5 = playername4;
 +                    playername4 = playername3;
 +                    playername3 = playername2;
 +                    playername2 = currentplayer;
 +               
 +                    llSay(0, "You are in second place on the scoreboard!");                                  }
 +            }else{
 +                    //third place
 +                    playerscore5 = playerscore4;
 +                    playerscore4 = playerscore3;
 +                    playerscore3 = timecounter;
 +                   
 +                    playername5 = playername4;
 +                    playername4 = playername3;
 +                    playername3 = currentplayer;
 +               
 +                    llSay(0, "You are in third place on the scoreboard!");                 
 +            }
 +        }else{
 +                    //fourth place
 +                    playerscore5 = playerscore4;
 +                    playerscore4 = timecounter;
 +                   
 +                    playername5 = playername4;
 +                    playername4 = currentplayer;
 +               
 +                    llSay(0, "You are in fourth place on the scoreboard!");                 
 +        }
 +    }else{
 +                    //fifth place
 +                    playerscore5 = timecounter;
 +                   
 +                    playername5 = currentplayer;
 +               
 +                    llSay(0, "You are in fifth place on the scoreboard!");                 
 +    }
 +}else{
 +    llSay(0, "You were not fast enough to get on the scoreboard");
 +}
 +               
 +               
 +               
 +               
 +               
 +               
 +            }
 +        }
 +    }
 +   
 +    touch_start(integer numdetected)
 +    {
 +        //TYPE SCORE LIST!!!
 +        llSay(0, "SCORE LIST:");
 +        llSay(0, "1. " + playername1 + " - " + (string) playerscore1 + " seconds.");
 +        llSay(0, "2. " + playername2 + " - " + (string) playerscore2 + " seconds.");
 +        llSay(0, "3. " + playername3 + " - " + (string) playerscore3 + " seconds.");
 +        llSay(0, "4. " + playername4 + " - " + (string) playerscore4 + " seconds.");
 +        llSay(0, "5. " + playername5 + " - " + (string) playerscore5 + " seconds.");
 +        llSay(0, "Game has been played " + (string) timesplayed + " times since reset");
 +    }
 +   
 +    timer()
 +    {
 +        timecounter = timecounter + 1;
 +        if(timecounter >= maxtime)
 +        {
 +            llShout(1966, "STOP");
 +            llSay (0, "Game over due to timeout...");
 +            llSetTimerEvent(0);
 +            llSetText("Game Server, Touch for stats", <1,1,1>, 1.0);
 +        }
 +    }
 +   
 +}
 +</code>
 +
 +==== Yellow Balls ====
 +
 +<code>
 +// open pacman game server script by kefcom belgium (kefcom@hotmail.com)
 +
 +string currentplayer;
 +integer score;
 +integer maxscore;
 +integer timesplayed;
 +integer timecounter;
 +string playername1;
 +string playername2;
 +string playername3;
 +string playername4;
 +string playername5;
 +integer playerscore1;
 +integer playerscore2;
 +integer playerscore3;
 +integer playerscore4;
 +integer playerscore5;
 +integer maxtime;
 +
 +default
 +{
 +    state_entry()
 +    {
 + 
 +  //////////////////////////////////////////////////////////////////////////////////////
 +        maxscore = 137; //change this value to the number of balls you have on the field
 +        maxtime = 500;
 +/////////////////////////////////////////////////////////////////////////////////////
 + 
 +        playername1 = "nobody";
 +        playername2 = "nobody";
 +        playername3 = "nobody";
 +        playername4 = "nobody";
 +        playername5 = "nobody";
 +        playerscore1 = 300;
 +        playerscore2 = 300;
 +        playerscore3 = 300;
 +        playerscore4 = 300;
 +        playerscore5 = 300;
 +        timesplayed = 0;
 +        score = 0;
 +        llSetText("Game Server", <1,1,1>,1.0);
 +        llListen(1966, "","","");
 +    }
 +   
 +    listen( integer channel, string name, key id, string msg)
 +    {
 +        if(msg=="STOP")
 +        {
 +            llSetTimerEvent(0);
 +            llSay(0, "Game stopped!");
 +            timecounter = 0;
 +            score = 0;
 +            currentplayer = "nobody";
 +            llSetText("Game Server, click for stats", <1,1,1>,1.0);
 +        }
 +        if(msg=="START")
 +        {
 +            score = 0;
 +            llSetText("Score: " + (string) score, <1,1,1>, 1.0);
 +            currentplayer = name;
 +            timecounter = 0;
 +            timesplayed = timesplayed + 1;
 +            llSetTimerEvent(1);
 +        }
 +        if(msg=="POINTS!")
 +        {
 +            score = score + 1;
 +            llSetText("Score: " + (string) score, <1,1,1>, 1.0);
 +            if(score >= maxscore)
 +            {
 +                //GAME OVER!
 +                llShout(0, "Game over");
 +                llSetTimerEvent(0);
 +                llShout(0, "You needed " + (string) timecounter + " Seconds to complete the game!");
 +                llSetText("Game Server, Click me for stats", <1,1,1>, 1.0);
 +               
 +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CALCULATE PLACE IN TOP 5 ////////////////////////////////////////
 +////////////////////////////////////////////////////////////////////////////////////////////
 +               
 +if(timecounter < playerscore5)
 +{
 +    if(timecounter < playerscore4)
 +    {
 +        if(timecounter < playerscore3)
 +        {
 +            if(timecounter < playerscore2)
 +            {
 +                if(timecounter < playerscore1)
 +                {
 +                    //first place
 +                    playerscore5 = playerscore4;
 +                    playerscore4 = playerscore3;
 +                    playerscore3 = playerscore2;
 +                    playerscore2 = playerscore1;
 +                    playerscore1 = timecounter;
 +                   
 +                    playername5 = playername4;
 +                    playername4 = playername3;
 +                    playername3 = playername2;
 +                    playername2 = playername1;
 +                    playername1 = currentplayer;
 +               
 +                    llSay(0, "You are in first place on the scoreboard!");
 +                }else{
 +                    //second place
 +                    playerscore5 = playerscore4;
 +                    playerscore4 = playerscore3;
 +                    playerscore3 = playerscore2;
 +                    playerscore2 = timecounter;
 +                   
 +                    playername5 = playername4;
 +                    playername4 = playername3;
 +                    playername3 = playername2;
 +                    playername2 = currentplayer;
 +               
 +                    llSay(0, "You are in second place on the scoreboard!");                                  }
 +            }else{
 +                    //third place
 +                    playerscore5 = playerscore4;
 +                    playerscore4 = playerscore3;
 +                    playerscore3 = timecounter;
 +                   
 +                    playername5 = playername4;
 +                    playername4 = playername3;
 +                    playername3 = currentplayer;
 +               
 +                    llSay(0, "You are in third place on the scoreboard!");                 
 +            }
 +        }else{
 +                    //fourth place
 +                    playerscore5 = playerscore4;
 +                    playerscore4 = timecounter;
 +                   
 +                    playername5 = playername4;
 +                    playername4 = currentplayer;
 +               
 +                    llSay(0, "You are in fourth place on the scoreboard!");                 
 +        }
 +    }else{
 +                    //fifth place
 +                    playerscore5 = timecounter;
 +                   
 +                    playername5 = currentplayer;
 +               
 +                    llSay(0, "You are in fifth place on the scoreboard!");                 
 +    }
 +}else{
 +    llSay(0, "You were not fast enough to get on the scoreboard");
 +}
 +               
 +               
 +               
 +               
 +               
 +               
 +            }
 +        }
 +    }
 +   
 +    touch_start(integer numdetected)
 +    {
 +        //TYPE SCORE LIST!!!
 +        llSay(0, "SCORE LIST:");
 +        llSay(0, "1. " + playername1 + " - " + (string) playerscore1 + " seconds.");
 +        llSay(0, "2. " + playername2 + " - " + (string) playerscore2 + " seconds.");
 +        llSay(0, "3. " + playername3 + " - " + (string) playerscore3 + " seconds.");
 +        llSay(0, "4. " + playername4 + " - " + (string) playerscore4 + " seconds.");
 +        llSay(0, "5. " + playername5 + " - " + (string) playerscore5 + " seconds.");
 +        llSay(0, "Game has been played " + (string) timesplayed + " times since reset");
 +    }
 +   
 +    timer()
 +    {
 +        timecounter = timecounter + 1;
 +        if(timecounter >= maxtime)
 +        {
 +            llShout(1966, "STOP");
 +            llSay (0, "Game over due to timeout...");
 +            llSetTimerEvent(0);
 +            llSetText("Game Server, Touch for stats", <1,1,1>, 1.0);
 +        }
 +    }
 +   
 +}
 +</code>
 +
 +==== Start Button ====
 +
 +<code>
 +// open pacman game by kefcom belgium (kefcom@hotmail.com)
 +
 +default
 +{
 +    state_entry()
 +    {
 +        llSetText("Klick me to play", <1,1,1>,1.0);
 +    }
 +    touch_start(integer num_detected)
 +    {
 +        llDialog(llDetectedKey(0), "Press Start to play", ["START", "STOP"],1966);
 +    }
 +}
 +</code>
  
Navigation

Alternative Startseite
Helpdesk
Links
Maps
Radio
Suchmaschine


Drucken/exportieren