Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vector COLOR_WHITE = <1.0, 1.0, 1.0>;
- float OPAQUE = 1.0;
- string collectname;
- list convertname; //list to keep track of all the players
- list leaderboard;
- list displayer;
- string convertname2;
- integer nchan;
- integer nhandle;
- key touchid;
- integer GetCh(key id) // make a unieq channel from the key inputted
- {
- return ((integer)("0x"+llGetSubString((string)id,-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
- }
- key Region() // get the region uuid
- {
- vector z = llGetRegionCorner();
- return (key)((string)(z.x/256 + 100*z.y));
- }
- default
- {
- state_entry()
- {
- llSay(0, "Script running");
- llSetText("ScoreBoard", COLOR_WHITE, OPAQUE);
- nchan = GetCh(Region()) - 35; //unique channel
- nhandle = llListen(nchan,"","","");
- }
- listen(integer channel, string what, key id, string msg)
- {
- if(channel == nchan)
- {
- key avi = llGetOwnerKey(id);
- //string avi = llGetUsername(llGetOwnerKey(owner));
- //llSay(0,"the Username ID is: " +(string)avi);
- //key avi = llRequestUsername(llGetOwnerKey(id));
- // string usavi = llGetUsername(avi);
- collectname = (string)msg;
- //leaderboard = (list)collectname;
- //llSay(0,(string)leaderboard);
- list leaderboard = llParseString2List(collectname,["_"],[""]); // change seperator to whatever you used as seperator
- key owner = llList2String(leaderboard,0);
- string username = llList2String(leaderboard,1);
- integer totalpoints = (integer)llList2String(leaderboard,2);
- //convertname2 = (string)convertname;
- //string id = llList2String(leaderboard,0);
- // string username = llList2String(leaderboard,0);
- // string totalpoints = llList2String(leaderboard,2);
- integer idx = llListFindList(leaderboard, [avi]);
- leaderboard = ["Username: "+(string)username] +[" "]+["Total Score: "+(string)totalpoints];
- //displayer += leaderboard;
- llSetText("Scoreboard"+"\n"+ (string)leaderboard,COLOR_WHITE, OPAQUE);
- //llSetText("Scoreboard"+"\n"+ "Username: "+(string)b +" "+"Total Score: "+(string)c,COLOR_WHITE, OPAQUE);
- if(idx != -1)
- {
- llSay(0,"Replace old user");
- leaderboard = llListReplaceList(leaderboard,["Username: "+(string)username] +[" "]+["Total Score: "+(string)totalpoints] ,idx,idx+3);
- }
- else
- {
- llSay(0,"New user");
- leaderboard += ["\n"]+["Username: "+(string)username] +[" "]+["Total Score: "+(string)totalpoints] ;
- }
- }
- //Click on the scoreboard to add name to scoreboard
- //listen for menu correct answer
- // +1 point for every correct
- }
- touch_start(integer num_detected)
- {
- //touchid = llDetectedKey(0);
- //leaderboard += convertname2;
- //integer idx = llListFindList(leaderboard, [touchid]);
- //leaderboard = llList2List(convertname, 0,2);
- //string stringleaderboard = llDumpList2String(leaderboard, "_");
- //integer username = llListFindList(leaderboard, [1]);
- //integer score = llListFindList(leaderboard, [2]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement