<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://opensimulator.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://opensimulator.org/index.php?action=history&amp;feed=atom&amp;title=User%3AAllen_Kerensky%2FMyriad_Lite_Preview_5%2FMeter</id>
		<title>User:Allen Kerensky/Myriad Lite Preview 5/Meter - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://opensimulator.org/index.php?action=history&amp;feed=atom&amp;title=User%3AAllen_Kerensky%2FMyriad_Lite_Preview_5%2FMeter"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Meter&amp;action=history"/>
		<updated>2026-07-04T03:34:19Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.9</generator>

	<entry>
		<id>http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Meter&amp;diff=27330&amp;oldid=prev</id>
		<title>Allen Kerensky: moved User:Allen Kerensky:Myriad Lite Preview 5:Meter to User:Allen Kerensky/Myriad Lite Preview 5/Meter: move into subsite</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Meter&amp;diff=27330&amp;oldid=prev"/>
				<updated>2012-02-06T22:35:24Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/wiki/User:Allen_Kerensky:Myriad_Lite_Preview_5:Meter&quot; class=&quot;mw-redirect&quot; title=&quot;User:Allen Kerensky:Myriad Lite Preview 5:Meter&quot;&gt;User:Allen Kerensky:Myriad Lite Preview 5:Meter&lt;/a&gt; to &lt;a href=&quot;/wiki/User:Allen_Kerensky/Myriad_Lite_Preview_5/Meter&quot; title=&quot;User:Allen Kerensky/Myriad Lite Preview 5/Meter&quot;&gt;User:Allen Kerensky/Myriad Lite Preview 5/Meter&lt;/a&gt;: move into subsite&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:35, 6 February 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Allen Kerensky</name></author>	</entry>

	<entry>
		<id>http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Meter&amp;diff=27198&amp;oldid=prev</id>
		<title>Allen Kerensky: created</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Meter&amp;diff=27198&amp;oldid=prev"/>
				<updated>2012-02-06T17:07:13Z</updated>
		
		<summary type="html">&lt;p&gt;created&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Myriad Lite Meter =&lt;br /&gt;
&lt;br /&gt;
Many people prefer a hovertext meter to let others see the in-character alias name of the player and see the relative damage or health of their opponents during combat.&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
# Create a cylinder 0.025m for X and Y, and 0.5 meters for Z&lt;br /&gt;
# Set the texture to &amp;quot;Default Transparent&amp;quot; and set the transparency to at least 2% &lt;br /&gt;
# Drag and Drop the Myriad Lite Meter script (below) from inventory into the object&lt;br /&gt;
# Take the meter into inventory.&lt;br /&gt;
# Attach the meter object from inventory to a convenient spot, such as an ear or eye.&lt;br /&gt;
# Press CTRL-ALT-T to &amp;quot;Show Transparent&amp;quot;&lt;br /&gt;
# Edit the position and rotation of the meter attachment.&lt;br /&gt;
# Detach the meter back into inventory to &amp;quot;save&amp;quot; the new default attachment point.&lt;br /&gt;
# Attach or wear the meter when designed.&lt;br /&gt;
&lt;br /&gt;
You should see &amp;quot;waiting for update&amp;quot; at first, which gets replaced with your character sheet alias and health on the next meter update event.&lt;br /&gt;
&lt;br /&gt;
== Myriad_Lite_Meter-v0.0.5-20120202.lsl ==&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
//============================================================================&lt;br /&gt;
// Myriad_Lite_Meter-v0.0.5-20120202.lsl&lt;br /&gt;
// Copyright (c) 2012 By Allen Kerensky (OSG/SL)&lt;br /&gt;
// The Myriad RPG System was designed, written, and illustrated by Ashok Desai&lt;br /&gt;
// Myriad RPG licensed under the Creative Commons Attribution 2.0 UK: England and Wales&lt;br /&gt;
// http://creativecommons.org/licenses/by/2.0/uk/&lt;br /&gt;
// Myriad Lite software Copyright (c) 2011 by Allen Kerensky (OSG/SL)&lt;br /&gt;
// Baroun's Adventure Machine Copyright (c) 2008-2011 by Baroun Tardis (SL)&lt;br /&gt;
// Myriad Lite and Baroun's Adventure Machine licensed under the&lt;br /&gt;
// Creative Commons Attribution-Share Alike-Non-Commercial 3.0 Unported&lt;br /&gt;
// http://creativecommons.org/licenses/by-nc-sa/3.0/&lt;br /&gt;
// You must agree to the terms of this license before making any use of this software.&lt;br /&gt;
// If you do not agree to this license, simply delete these materials.&lt;br /&gt;
// There is no warranty, express or implied, for your use of these materials.&lt;br /&gt;
//============================================================================&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// MESSAGE FORMAT REFERENCE&lt;br /&gt;
//============================================================================&lt;br /&gt;
// CHANPLAYER IN - METER|str PLAYER NAME|str GAMENAME|int CURWOUNDS|int MAXWOUNDS|int CURCRITICAL|int MAXCRITICAL|int ISDEAD|int ISINCAPACITATED&lt;br /&gt;
     &lt;br /&gt;
//============================================================================&lt;br /&gt;
// GLOBAL VARIABLES&lt;br /&gt;
//============================================================================&lt;br /&gt;
integer CHANATTACH; // dynamic channel for player attachments &lt;br /&gt;
integer HANDATTACH; // attach channel handle for llRemove&lt;br /&gt;
string CHAN_PREFIX = &amp;quot;0x&amp;quot;; // prefix to convert to hexadecimal&lt;br /&gt;
string DIV = &amp;quot;|&amp;quot;; // Myriad message field divider&lt;br /&gt;
string  STATUS; // settext message&lt;br /&gt;
integer NAME_FORMAT; // 1 = Alias only, 2 = First &amp;quot;Alias&amp;quot; Last, 3 = Alias (First Last)&lt;br /&gt;
integer SHOW_HEALTH; // show the health percentage or not?&lt;br /&gt;
vector  COLOR = &amp;lt;0,1,0&amp;gt;; // set text color&lt;br /&gt;
float   ALPHA = 1.0; // set text alpha 0.0 = clear, 1.0 = solid&lt;br /&gt;
vector GREEN = &amp;lt;0,1,0&amp;gt;; // color constant for convenience&lt;br /&gt;
vector YELLOW = &amp;lt;1,1,0&amp;gt;; // color constant for convenience&lt;br /&gt;
vector RED = &amp;lt;1,0,0&amp;gt;; // color constant for convencience&lt;br /&gt;
vector BLACK = &amp;lt;0,0,0&amp;gt;; // color constant for convenience&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// GLOBAL SETUP()&lt;br /&gt;
//============================================================================&lt;br /&gt;
SETUP() {&lt;br /&gt;
    llSetText(&amp;quot;--- Waiting for Myriad Update ---&amp;quot;,&amp;lt;1,0,0&amp;gt;,1); // set a default banner to show we haven't been updated yet&lt;br /&gt;
    NAME_FORMAT = 1; // 1 = Alias only, 2 = First &amp;quot;Alias&amp;quot; Last, 3 = Alias (First Last)&lt;br /&gt;
    SHOW_HEALTH = TRUE; // show the health percentage or not?&lt;br /&gt;
    CHANATTACH = (integer)(CHAN_PREFIX+llGetSubString((string)llGetOwner(),1,7)); // calculate wearer's dynamic attachment channel&lt;br /&gt;
    if ( HANDATTACH != 0 ) llListenRemove(HANDATTACH); // remove previously open channel&lt;br /&gt;
    HANDATTACH = llListen(CHANATTACH,&amp;quot;&amp;quot;,NULL_KEY,&amp;quot;&amp;quot;); // start a listener on the dynamic channel&lt;br /&gt;
    llWhisper(CHANATTACH,&amp;quot;ATTACHMETER&amp;quot;); // tell HUD we're attached&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// DEFAULT STATE&lt;br /&gt;
//============================================================================&lt;br /&gt;
default {&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // STATE_ENTRY EVENT&lt;br /&gt;
    //------------------------------------------------------------------------    &lt;br /&gt;
    state_entry() {&lt;br /&gt;
        SETUP(); // setup the hovertext meter&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // ON_REZ EVENT&lt;br /&gt;
    //------------------------------------------------------------------------    &lt;br /&gt;
    on_rez(integer param) {&lt;br /&gt;
        param = 0; // LSLINT&lt;br /&gt;
        SETUP(); // setup the hovertext meter&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // ATTACH EVENT&lt;br /&gt;
    //------------------------------------------------------------------------    &lt;br /&gt;
    attach(key id) { // &lt;br /&gt;
        if ( id != NULL_KEY ) {&lt;br /&gt;
            SETUP(); // wearing, let's setup&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        if ( id == NULL_KEY ) { // detach, drop, derezzed to inventory - NOT ON LOGOUT&lt;br /&gt;
            if ( HANDATTACH != 0 ) llListenRemove(HANDATTACH);&lt;br /&gt;
            llWhisper(CHANATTACH,&amp;quot;DETACHMETER&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // CHANGED EVENT&lt;br /&gt;
    //------------------------------------------------------------------------    &lt;br /&gt;
    changed(integer changes) {&lt;br /&gt;
        if ( changes &amp;amp; CHANGED_OWNER ) { // if owner has changed, we need to recalculate the dynamic channel&lt;br /&gt;
            SETUP(); // setup the hovertext meter&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        if ( changes &amp;amp; CHANGED_REGION || changes &amp;amp; CHANGED_TELEPORT ) { // owner jumped to new location? restart&lt;br /&gt;
            SETUP(); // setup hovertext and channel&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // LISTEN EVENT&lt;br /&gt;
    //------------------------------------------------------------------------    &lt;br /&gt;
    listen(integer channel,string name,key id,string message) {&lt;br /&gt;
        name = &amp;quot;&amp;quot;; // LSLINT&lt;br /&gt;
        id = NULL_KEY; // LSLINT&lt;br /&gt;
        if ( channel == CHANATTACH ) { // did this message come in on attachment channel?&lt;br /&gt;
            list fields = llParseString2List(message,[DIV],[]); // break message down into list separated by |&lt;br /&gt;
            string command = llList2String(fields,0); // read first item in list to get the Myriad command&lt;br /&gt;
            if ( command == &amp;quot;METER&amp;quot;) { // if this is the METER command, let's update the meter status&lt;br /&gt;
                string playername   = llList2String(fields,1); // get the full player name from the list of METER values&lt;br /&gt;
                list   name2        = llParseString2List(playername,[&amp;quot; &amp;quot;],[]); // separate first and last name by space&lt;br /&gt;
                string firstname    = llList2String(name2,0); // get the firstname from the name2&lt;br /&gt;
                string lastname     = llList2String(name2,1); // get the lastname, if any, from the name2&lt;br /&gt;
                string gamename     = llList2String(fields,2); // get player's alias/game name (originally set in their character sheet)&lt;br /&gt;
                integer curwounds   = llList2Integer(fields,3); // what is player's current wound value?&lt;br /&gt;
                integer maxwounds   = llList2Integer(fields,4); // what is player's maximum healed wounds allowed by level/stats?&lt;br /&gt;
                integer curcritical = llList2Integer(fields,5); // what is player's current critical wounds value?&lt;br /&gt;
                integer maxcritical = llList2Integer(fields,6); // what is player's maximum healed critical wounds value?&lt;br /&gt;
                integer isdead      = llList2Integer(fields,7); // is player dead?&lt;br /&gt;
                integer isincap     = llList2Integer(fields,8); // is player incapacitated?&lt;br /&gt;
                // okay, we've broken down status, lets create a banner from that using colors&lt;br /&gt;
                STATUS = &amp;quot;&amp;quot;; // start with an empty string&lt;br /&gt;
                COLOR = GREEN; // start with fully healthy color&lt;br /&gt;
                if ( NAME_FORMAT == 1 ) { // what name format do we want to see?                &lt;br /&gt;
                    STATUS = gamename; // 1 == just Alias name from character sheet&lt;br /&gt;
                } else if ( NAME_FORMAT == 2 ) { // not format 1, so format 2?&lt;br /&gt;
                    STATUS = firstname + &amp;quot;\&amp;quot;&amp;quot; + gamename + &amp;quot;\&amp;quot;&amp;quot; + lastname; // firstname &amp;quot;alias&amp;quot; lastname&lt;br /&gt;
                } else if ( NAME_FORMAT == 3 ) { // not format 1, or 2, so...&lt;br /&gt;
                    STATUS = gamename + &amp;quot;(&amp;quot;+playername+&amp;quot;)&amp;quot;; // alias (firstname lastname)&lt;br /&gt;
                }&lt;br /&gt;
                if ( SHOW_HEALTH == TRUE ) { // do we want a health number (unrealistic)&lt;br /&gt;
                    float currentpoints = (float)curwounds + (float)curcritical; // add up noncritical and critical wounds boxes remaining&lt;br /&gt;
                    float maxpoints = (float)maxwounds + (float)maxcritical; // add up total wounds boxes player should have&lt;br /&gt;
                    if ( currentpoints &amp;gt; 0.0 ) { // if player has some wounds left&lt;br /&gt;
                        float health = ( ( currentpoints / maxpoints ) * 100.0 ); // get a percentage&lt;br /&gt;
                        STATUS += &amp;quot;\nHealth: &amp;quot;+(string)llRound(health)+&amp;quot;%&amp;quot;; // add the percentage health to the status&lt;br /&gt;
                    } else { // oops all resilience gone&lt;br /&gt;
                        STATUS += &amp;quot;\nHealth; 0%&amp;quot;; // so add a zero% to status&lt;br /&gt;
                    }&lt;br /&gt;
                }&lt;br /&gt;
                if ( curwounds == maxwounds &amp;amp;&amp;amp; curcritical == maxcritical ) { // are all health boxes full?&lt;br /&gt;
                    COLOR = GREEN; // fully healthy&lt;br /&gt;
                }&lt;br /&gt;
                if ( curwounds &amp;lt; maxwounds &amp;amp;&amp;amp; curwounds &amp;gt;= 1 ) { // we've lost some wounds, but not incapacitated&lt;br /&gt;
                    COLOR = YELLOW; // set a warning that we've been wounded and not fully healty&lt;br /&gt;
                }&lt;br /&gt;
                if ( curwounds &amp;lt; 1 ) { // if we're out of non-critical wounds, we're in trouble&lt;br /&gt;
                    COLOR = RED; // we're incapacitated but not dead, bleeding out here&lt;br /&gt;
                }&lt;br /&gt;
                if ( isincap == 1 &amp;amp;&amp;amp; isdead == 0 ) {&lt;br /&gt;
                    STATUS += &amp;quot; ! INCAPACITATED !&amp;quot;;&lt;br /&gt;
                    COLOR = RED; // set color to warning that we're down but not dead yet&lt;br /&gt;
                }&lt;br /&gt;
                if ( isdead == 1 ) {  // if we're dead&lt;br /&gt;
                    STATUS += &amp;quot; !!! DEAD !!!&amp;quot;; // add a notice to status&lt;br /&gt;
                    COLOR = BLACK; // set color to color of death&lt;br /&gt;
                }                &lt;br /&gt;
                llSetText(STATUS,COLOR,ALPHA); // show the new status text over the meter&lt;br /&gt;
                return; // we're done with this command, exit entire listen event&lt;br /&gt;
            } // end if command meter&lt;br /&gt;
            if ( command == &amp;quot;REGISTERATTACHMENTS&amp;quot; ) { // HUD asking for attachments attached?&lt;br /&gt;
                SETUP(); // just setup&lt;br /&gt;
            }&lt;br /&gt;
        } // end if chanattach&lt;br /&gt;
    }&lt;br /&gt;
} // end default&lt;br /&gt;
//============================================================================&lt;br /&gt;
// END&lt;br /&gt;
//============================================================================&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Allen Kerensky</name></author>	</entry>

	</feed>