Jump to content

Points system


You are about to reply to a thread that has been inactive for 80 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

1 hour ago, WiccanSeductress said:

the points system used in Harry Potter

Since I haven't read the movie or watched the book in years, I looked it up. The Harry potter wiki says:

Quote

The House Cup is a yearly award at Hogwarts. It is given at the end of the school year to the House with the most House points. Points are given to Houses by teachers and prefects throughout the year for various things including answering questions correctly and doing good deeds. The winners of school Quidditch games also receive points. Points can be taken away for things such as misbehaving or rule-breaking.

On its face, seems like a rather simple idea, but there are a lot of fiddly nuances depending on exactly how you'd want it to work. I don't know of anywhere in-world that would magically have exactly what you're looking for.

Link to comment
Share on other sites

4 minutes ago, Quistess Alpha said:
Quote

The House Cup is a yearly award at Hogwarts. It is given at the end of the school year to the House with the most House points. Points are given to Houses by teachers and prefects throughout the year for various things including answering questions correctly and doing good deeds. The winners of school Quidditch games also receive points. Points can be taken away for things such as misbehaving or rule-breaking.

On its face, seems like a rather simple idea, but there are a lot of fiddly nuances depending on exactly how you'd want it to work. I don't know of anywhere in-world that would magically have exactly what you're looking for.

It almost seems more like a "voting" system, since points aren't awarded "automatically" by accomplishing tasks (I forgot that part), but manually by characters..

Link to comment
Share on other sites

Something something, scripting forum isn't the place to ask for custom scripts etc. etc. but I was bored, so. . .

Quote
//Public domain script, by Quistess Alpha.
//USAGE: 
//   Edit the global variables for setup, then press 'save' in the lower right of this window.
//   anyone may touch the object to get a menu, to list points or full point change log.
//   teachers may use a 'chat command' on gChan to add or remove points from a given house.
//       /gChan pointChange House explanation
//   for example: 
//       /17 3 Plum for Miss Winsor's superb performance on her potions exam
//       /17 -7 Weasel as a deterrent to all those who would blatently scorn curfew
//       /17 +4 Weasel to soften the impact of the overwrathful curfew deterrence from Proffessor Q
//
//   The owner of this object may use the chat command 'CLEAR' on the same channel to wipe the entire log and reset all points to 0.
      

// setup variables, edit these and save script to configure:

integer gChan = 17; // channel this object uses for dialog and chat commands.
float gReadSleep = 1.0; // how long to sleep between reading messages.

list gTeachers =  // UUID, fancy name.
[   "8645873d-1306-4f22-a60c-4f2bc3bb9ca2", "Proffessor Q",
    "68686474-391b-44ea-b68f-9b88a566af9f", "Teacher #2" // no final ',' in the list.
];

list gHouses = // case sensitive! (Gryffindor is different than gryffindor)
[   "Snake",
    "Weasel",
    "Pony",
    "Plum"
];

// working variables, changing default value has little to no effect:
    // Intentionally left blank.
// LSD key values used:
 // houseName:points
 // numLogs:totalNumberOfLogs
 // log#:log // starts at log1

default
{
    state_entry()
    {   llListen(gChan, "","","");
        // initialize points if not already:
        integer i = llGetListLength(gHouses);
        while(~--i)
        {   string house = llList2String(gHouses,i);
            string points = llLinksetDataRead(house);
            if(""==points)
            {   llLinksetDataWrite(house,"0");
                llOwnerSay("Initializing "+house);
            }
        }
    }
    touch_start(integer n)
    {   while(~--n)
        {   llDialog(llDetectedKey(n),
                "Points: Point totals for each house.\n"+
                "Full log: List every point change (may be very long).",["Points","Full log"],gChan);
        }
    }
    listen(integer Channel, string Name, key ID, string Text)
    {   integer indexTeacher;
        if("Points"==Text)
        {   list pointList; // read into list, then sort.
            integer i = llGetListLength(gHouses);
            while(~--i)
            {   string house = llList2String(gHouses,i);
                integer points = (integer)llLinksetDataRead(house);
                pointList+=[house,points];
            }
            pointList = llListSortStrided(pointList,2,1,FALSE);
            i = llGetListLength(pointList); // could micro-optimize by *2 original i.
            while((i-=2)>=0)
            {   string house = llList2String(pointList,i);
                string points = llList2String(pointList,i+1); // implicit type-cast.
                llSay(0,"House "+house+" has "+points+" points.");
                llSleep(gReadSleep);
            }
        }else if("Full log"==Text)
        {   integer index;
            integer indexMax = (integer)llLinksetDataRead("numLogs");
            for(index=0;index<=indexMax;++index)
            {   llSay(0,llLinksetDataRead("log"+(string)index));
                llSleep(gReadSleep);
            }
        }else if("CLEAR"==Text && ID==llGetOwner())
        {   llSay(0,"I have reset all my data!");
            llLinksetDataReset();
            llResetScript(); // lazy hack to redo 0 point initialization.
        }else if(-1!= (indexTeacher=llListFindList(gTeachers,[(string)ID])) )
        {   // teacher setting points and is authorized.
            string name = llList2String(gTeachers,indexTeacher+1);
            // assume format: points housename flavor text
            integer points = (integer)Text;
            Text = llDeleteSubString(Text,0,llSubStringIndex(Text," ")); // pop points
            string house = llGetSubString(Text,0,llSubStringIndex(Text," ")-1);
            Text = llDeleteSubString(Text,0,llSubStringIndex(Text," ")); // pop housename
            // Capitalization:
            string l = llToUpper(llGetSubString(Text,0,0));
            Text = l+llDeleteSubString(Text,0,0);
            
            if(-1==llListFindList(gHouses,[house]))
            {   llRegionSayTo(ID,0,"Error: "+house+" is not a valid house!");
            }else
            {   // set the log:
                string time = llGetTimestamp();
                time = llDeleteSubString(time,llSubStringIndex(time,"T"),-1);
                string sign; // because I'm fiddly.
                if(points>0)
                {   sign="+";
                }
                string sPoints = sign+(string)points;
                string log = time+" : "+Text+" : "+sPoints+" to house "+house+" from "+name;
                integer numLog = (integer)llLinksetDataRead("numLogs");
                llLinksetDataWrite("numLogs",(string)(++numLog));
                llLinksetDataWrite("log"+(string)numLog,log);
                // update points:
                integer pointsPrev = (integer)llLinksetDataRead(house);
                llLinksetDataWrite(house,(string)(pointsPrev+points));
                string pointsNow = llLinksetDataRead(house); // reading from LSD for sanity-check.
                // report:
                llRegionSayTo(ID,0,log);
                llRegionSayTo(ID,0,house+" had "+(string)pointsPrev+" points, but now has "+pointsNow+".");
            }
        }else
        {   llRegionSayTo(ID,0,"Not authorized.");
        }
    }
}

 

(quote reduces spaminess)

  • Like 1
  • Thanks 2
  • Haha 1
Link to comment
Share on other sites

On 3/20/2024 at 12:53 PM, Quistess Alpha said:

yes.

Thank you! Also, the script has the four houses in it, but can it be adjusted to just one house for each cup? For example, one script for one house, one script for another house and so on?

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 80 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...