Jump to content

Yunaofsnakes

Resident
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Yunaofsnakes

  1. ok so im trying to make a script that sit's inside a prim and outputs a score once you distroy your opposition but i seem to be missing somethning as i can get the outputs both on the prim and in chat but i cant seem to get the output on the board or who made the kill if anyone can point me in the right way or help i would be greatful as ive been trying to fix this for a few hours now xD

    integer channel = -933;
    vector text_color = <1.0, 1.0, 1.0>;
    integer number_of_scores = 3;

    list highscores = [];

    print_scores()
    {
        string text = "HIGH SCORES\n----------------";
        
        integer i;
        for (i = 0; i < (number_of_scores * 2); i += 2) {
            if (llList2Integer(highscores, i) == 0) {
                text += "\n-";
            } else {
                text += "\n" + llList2String(highscores, i + 1) + " (" + llList2String(highscores, i) + ")";
            }
        }
        
        llSetText(text, text_color, 1.0);
    }

    default
    {
        state_entry()
        {
                    llListen(-933,"", NULL_KEY, "");
            if (number_of_scores < 1) number_of_scores = 1;
            
            print_scores();
        }
     listen(integer channel, string name, key id, string message) {
            if (message == "Score") {
    llOwnerSay("You Sank My Battleship!");
                highscores += [(string)id];
                highscores = llListSort(highscores, 1, FALSE);
                highscores = llList2List(highscores, 0, (number_of_scores * 2) - 1);
                print_scores();
            } //else if (str == "clear scores") {
                highscores = [];
                print_scores();
            }   
        }

     

×
×
  • Create New...