User:Allen Kerensky/Myriad Lite Preview2/Myriad Lite Meter v0.0.2 20110609

From Second Life Wiki
< User:Allen Kerensky
Revision as of 14:01, 11 June 2011 by Allen Kerensky (talk | contribs) (created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Myriad Lite Meter v0.0.2 20110609

<lsl> //============================================================================ // Myriad Lite Meter v0.0.2 20110609 // Copyright (c) 2011 By Allen Kerensky (OSG/SL) // The Myriad RPG System was designed, written, and illustrated by Ashok Desai // Myriad is published under a: // Creative Commons License (Attribution 2.0 UK: England and Wales) // Myriad Lite Meter is published under a: // Creative Commons License Attribution-NonCommercial-ShareAlike 3.0 Unported //============================================================================

integer CHANPLAYER; string DIV = "|"; string STATUS; // settext message vector COLOR = <0,1,0>; // set text color float ALPHA = 1.0; // set text alpha 0.0 = clear, 1.0 = solid

default {

   state_entry() {
       llSetText("",<0,0,0>,0);
       CHANPLAYER = (integer)("0x"+llGetSubString((string)llGetOwner(),0,6));
       llListen(CHANPLAYER,"",NULL_KEY,"");
   }
   
   on_rez(integer params) {
       llResetScript();
   }
   
   changed(integer changes) {
       if ( changes & CHANGED_OWNER ) {
           llResetScript();
       }
   }
   
   listen(integer channel,string name,key id,string message) {
       //llOwnerSay("METER DEBUG: "+message);
       list fields = llParseString2List(message,[DIV],[]);
       string command = llList2String(fields,0);
       string dead = "no";
       string incap = "no";
       if ( command == "METER") {
           string playername   = llList2String(fields,1);
           list   name2 = llParseString2List(playername,[" "],[]);
           string firstname    = llList2String(name2,0);
           string lastname     = llList2String(name2,1);
           string gamename     = llList2String(fields,2);
           integer curwounds   = llList2Integer(fields,3);
           integer maxwounds   = llList2Integer(fields,4);
           integer curcritical = llList2Integer(fields,5);
           integer maxcritical = llList2Integer(fields,6);
           integer isdead      = llList2Integer(fields,7);
           integer isincap     = llList2Integer(fields,8);
           if ( isdead == 1 ) dead = "yes";
           if ( isincap == 1 ) incap = "yes"; 
           STATUS = firstname+" \""+gamename+"\" "+lastname+"\nWounds: "+(string)curwounds+"/"+(string)maxwounds+" Critical: "+(string)curcritical+"/"+(string)maxcritical+"\nIncapacitated: "+incap+" Dead: "+dead;
           llSetText(STATUS,COLOR,ALPHA);
       }
   }

} </lsl>