<?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%2FMyriad_Lite_Healing-v0.0.2-20120903.lsl</id>
		<title>User:Allen Kerensky/Myriad Lite/Myriad Lite Healing-v0.0.2-20120903.lsl - 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%2FMyriad_Lite_Healing-v0.0.2-20120903.lsl"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite/Myriad_Lite_Healing-v0.0.2-20120903.lsl&amp;action=history"/>
		<updated>2026-06-13T18:15:32Z</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/Myriad_Lite_Healing-v0.0.2-20120903.lsl&amp;diff=30598&amp;oldid=prev</id>
		<title>Allen Kerensky: Myriad_Lite_Healing-v0.0.2-20120903.lsl</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite/Myriad_Lite_Healing-v0.0.2-20120903.lsl&amp;diff=30598&amp;oldid=prev"/>
				<updated>2012-09-03T18:24:14Z</updated>
		
		<summary type="html">&lt;p&gt;Myriad_Lite_Healing-v0.0.2-20120903.lsl&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Myriad_Lite_Healing-v0.0.2-20120903.lsl =&lt;br /&gt;
 &amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
//============================================================================&lt;br /&gt;
// Myriad Lite Healing v0.0.2 20120903&lt;br /&gt;
// Copyright (c) 2011 By Allen Kerensky (OSG/SL)&lt;br /&gt;
// The Myriad RPG System was designed, written, and illustrated by Ashok Desai&lt;br /&gt;
// Myriad is published under a:&lt;br /&gt;
// Creative Commons License (Attribution 2.0 UK: England and Wales)&lt;br /&gt;
// Myriad Lite Healing is published under a:&lt;br /&gt;
// Creative Commons License Attribution-NonCommercial-ShareAlike 3.0 Unported&lt;br /&gt;
//============================================================================&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// MESSAGE FORMAT REFERENCE&lt;br /&gt;
//============================================================================&lt;br /&gt;
// CHANMYRIAD OUT - RPEVENT|str eventmessage&lt;br /&gt;
// CHANPLAYER OUT - HEALALL&lt;br /&gt;
// CHANPLAYER OUT - HEALPARTIAL|str HEALAMOUNT&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// GLOBAL CONSTANTS&lt;br /&gt;
//============================================================================&lt;br /&gt;
string  VERSION = &amp;quot;0.0.2&amp;quot;; // version number&lt;br /&gt;
string  VERDATE = &amp;quot;20120903&amp;quot;; // version date&lt;br /&gt;
float   TOUCH_RANGE = 3.0;      // meters - how close do you have to be for touch-to-heal to work&lt;br /&gt;
integer RESPAWN_FLAG = TRUE;    // once heal is used, respawn it after a certain time?&lt;br /&gt;
float   RESPAWN_TIME = 30.0;    // how long until heal respawns?&lt;br /&gt;
integer CHANMYRIAD = -999;      // channel for Myriad RP events&lt;br /&gt;
string  DIV = &amp;quot;|&amp;quot;;              // Myriad message field divider&lt;br /&gt;
&lt;br /&gt;
// CONFIGURATION - CONFIGURE IN SETUP FUNCTION&lt;br /&gt;
integer HEALALL;         // heal all? if FALSE...&lt;br /&gt;
integer HEALAMOUNT;         // heal how many critical/wound boxes?&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// RPEVENT&lt;br /&gt;
//============================================================================&lt;br /&gt;
RPEVENT(key id,string rpmsg) {&lt;br /&gt;
    llRegionSay(CHANMYRIAD,&amp;quot;RPEVENT|&amp;quot;+llKey2Name(id)+&amp;quot; &amp;quot;+rpmsg);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// GLOBAL SETUP()&lt;br /&gt;
//============================================================================&lt;br /&gt;
SETUP() {&lt;br /&gt;
    HEALALL = FALSE; // heal all damage on touch?&lt;br /&gt;
    HEALAMOUNT = 1; // how much to heal?&lt;br /&gt;
    llSetObjectDesc(VERSION+&amp;quot;-&amp;quot;+VERDATE);&lt;br /&gt;
    llSetLinkColor(LINK_SET,&amp;lt;1,0,0&amp;gt;,ALL_SIDES); // set all prims to red on all sides&lt;br /&gt;
    llTargetOmega(&amp;lt;0,0,1&amp;gt;,0.25,1.0); // set the object slowly spinning around the Z (vertical) axis&lt;br /&gt;
    if ( HEALALL == TRUE ) { // what label do we set?&lt;br /&gt;
        llSetText(&amp;quot;Full Healing&amp;quot;,&amp;lt;1,0,0&amp;gt;,1.0); // Set a red FULL heal hovertext&lt;br /&gt;
    } else { // this is only a partial heal&lt;br /&gt;
        llSetText(&amp;quot;Partial Healing&amp;quot;,&amp;lt;1,0,0&amp;gt;,1.0); // set a read PARTIAL heal hovertext&lt;br /&gt;
    }&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(); // if reset, go to setup&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // ON_REZ EVENT&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    on_rez(integer start_param) {&lt;br /&gt;
        start_param = 0; // LSLint&lt;br /&gt;
        SETUP(); // if rezzed from inventory, go to setup&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // COLLISION_START EVENT - if player runs into the heal object, try healing them&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    collision_start(integer collisions) {&lt;br /&gt;
        while (collisions--) { // count down through each collision in this event&lt;br /&gt;
            if ( RESPAWN_FLAG == FALSE ) { // this heal has already been used recently&lt;br /&gt;
                return; // so just return since we're not going to heal anyone at the moment&lt;br /&gt;
            }&lt;br /&gt;
            key who = llDetectedKey(collisions); // what hit the heal object?&lt;br /&gt;
            // we check the owner of the colliding object to see if its an avatar, or someone's bullet, etc&lt;br /&gt;
            key whoowner = llList2Key(llGetObjectDetails(who,[OBJECT_OWNER]),0);&lt;br /&gt;
            if ( who == whoowner) { // this is an avatar that owns itself&lt;br /&gt;
                // calculate the CHANPLAYER dynamic channel for who is being healed&lt;br /&gt;
                integer chanplayer = (integer)(&amp;quot;0x&amp;quot;+llGetSubString((string)who,0,6));&lt;br /&gt;
                if ( HEALALL == TRUE ) { // are we healing all damage?&lt;br /&gt;
                    RPEVENT(who,&amp;quot;is fully healed!&amp;quot;);&lt;br /&gt;
                    llWhisper(chanplayer,&amp;quot;HEALALL&amp;quot;); // tell that player's HUD to heal ALL damage&lt;br /&gt;
                } else {&lt;br /&gt;
                    RPEVENT(who,&amp;quot;is partially healed!&amp;quot;);&lt;br /&gt;
                    llWhisper(chanplayer,&amp;quot;HEALPARTIAL&amp;quot;+DIV+(string)HEALAMOUNT); // tell player HUD to heal some damage&lt;br /&gt;
                }&lt;br /&gt;
                llSetLinkColor(LINK_SET,&amp;lt;.5,.5,.5&amp;gt;,ALL_SIDES); // make the heal item grey and used looking&lt;br /&gt;
                llSetTimerEvent(RESPAWN_TIME); // set a timer to respawn this heal item after a while&lt;br /&gt;
                RESPAWN_FLAG=FALSE; // set a flag so the heal can't be reused until it respawns&lt;br /&gt;
                return; // collision is done, let's exit after healing first avatar found in collisions&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // TOUCH_START EVENT - when player clicks heal, see if they are close enough&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    touch_start(integer touches) {        &lt;br /&gt;
        while (touches--) { // count down through all touches in this touch-start event&lt;br /&gt;
            if ( RESPAWN_FLAG == FALSE ) { // this heal has been used recently and has not respawned&lt;br /&gt;
                return; // so exit early since we're not healing anyone right now&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            key who2 = llDetectedKey(touches); // who clicked us, we don't check for avatar since objects can't click&lt;br /&gt;
            // find the current location of what clicked us&lt;br /&gt;
            vector whopos = llList2Vector(llGetObjectDetails(who2,[OBJECT_POS]),0);&lt;br /&gt;
&lt;br /&gt;
            if ( llVecDist(whopos,llGetPos()) &amp;lt;= TOUCH_RANGE ) { // check distance between heal item and whoever clicked&lt;br /&gt;
                // calculate CHANPLAYER dynamic player channel to send healing message to&lt;br /&gt;
                integer chanplayer2 = (integer)(&amp;quot;0x&amp;quot; + llGetSubString((string)who2,0,6));&lt;br /&gt;
                if ( HEALALL == TRUE ) { // are we healing all damage?&lt;br /&gt;
                    RPEVENT(who2,&amp;quot;is fully healed!&amp;quot;); // tell region someone is healing&lt;br /&gt;
                    llWhisper(chanplayer2,&amp;quot;HEALFULL&amp;quot;); // heal all damage&lt;br /&gt;
                } else {&lt;br /&gt;
                    RPEVENT(who2,&amp;quot;is partially healed!&amp;quot;); // tell region someone is healing&lt;br /&gt;
                    llWhisper(chanplayer2,&amp;quot;HEALPARTIAL&amp;quot;+DIV+(string)HEALAMOUNT); // heal some damage&lt;br /&gt;
                }&lt;br /&gt;
                llSetLinkColor(LINK_SET,&amp;lt;.5,.5,.5&amp;gt;,ALL_SIDES); // make the heal item grey and unused looking&lt;br /&gt;
                llSetTimerEvent(RESPAWN_TIME); // set a timer to respawn this heal item after a while&lt;br /&gt;
                RESPAWN_FLAG=FALSE; // set a flag so the heal can't be reused until it respawns&lt;br /&gt;
                return; // touch is done, let's exit after healing first avatar found in clicks&lt;br /&gt;
            }&lt;br /&gt;
        } // end while&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // TIMER EVENT&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    timer() {&lt;br /&gt;
        llSetLinkColor(LINK_SET,&amp;lt;1,0,0&amp;gt;,ALL_SIDES); // set color to red again to show this can be used&lt;br /&gt;
        RESPAWN_FLAG=TRUE; // set a flag to all the next heal attempt to work&lt;br /&gt;
        llSetTimerEvent(0.0); // stop the timers until the next heal event starts a new one&lt;br /&gt;
    }&lt;br /&gt;
} // end default&lt;br /&gt;
//============================================================================&lt;br /&gt;
// END&lt;br /&gt;
//============================================================================&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Allen Kerensky</name></author>	</entry>

	</feed>