<?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-Preview6.lsl</id>
		<title>User:Allen Kerensky/Myriad Lite/Myriad Lite Healing-Preview6.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-Preview6.lsl"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite/Myriad_Lite_Healing-Preview6.lsl&amp;action=history"/>
		<updated>2026-06-13T18:39:36Z</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-Preview6.lsl&amp;diff=30430&amp;oldid=prev</id>
		<title>Allen Kerensky: Myriad_Lite_Healing-Preview6.lsl</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite/Myriad_Lite_Healing-Preview6.lsl&amp;diff=30430&amp;oldid=prev"/>
				<updated>2012-08-16T00:23:39Z</updated>
		
		<summary type="html">&lt;p&gt;Myriad_Lite_Healing-Preview6.lsl&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Myriad_Lite_Healing-Preview6.lsl =&lt;br /&gt;
 &amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
// Myriad_Lite_Healing-Preview6.lsl&lt;br /&gt;
// Copyright (c) 2012 Allen Kerensky (OSG/SL) All Rights Reserved.&lt;br /&gt;
// This work is dual-licensed under&lt;br /&gt;
// Creative Commons Attribution (CC BY) 3.0 Unported&lt;br /&gt;
// http://creativecommons.org/licenses/by/3.0/&lt;br /&gt;
// - or -&lt;br /&gt;
// Modified BSD License (3-clause)&lt;br /&gt;
// Redistribution and use in source and binary forms, with or without&lt;br /&gt;
// modification, are permitted provided that the following conditions are met:&lt;br /&gt;
// * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
//   this list of conditions and the following disclaimer.&lt;br /&gt;
// * Redistributions in binary form must reproduce the above copyright notice,&lt;br /&gt;
//   this list of conditions and the following disclaimer in the documentation&lt;br /&gt;
//   and/or other materials provided with the distribution.&lt;br /&gt;
// * Neither the name of Myriad Lite nor the names of its contributors may be&lt;br /&gt;
//   used to endorse or promote products derived from this software without&lt;br /&gt;
//   specific prior written permission.&lt;br /&gt;
//&lt;br /&gt;
// THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR&lt;br /&gt;
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES&lt;br /&gt;
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN&lt;br /&gt;
// NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,&lt;br /&gt;
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT&lt;br /&gt;
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,&lt;br /&gt;
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY&lt;br /&gt;
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT&lt;br /&gt;
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF&lt;br /&gt;
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
//&lt;br /&gt;
// The Myriad RPG System was designed, written, and illustrated by Ashok Desai&lt;br /&gt;
// Myriad RPG System licensed under:&lt;br /&gt;
// Creative Commons Attribution (CC BY) 2.0 UK: England and Wales&lt;br /&gt;
// http://creativecommons.org/licenses/by/2.0/uk/&lt;br /&gt;
&lt;br /&gt;
string  VERSION = &amp;quot;0.0.2&amp;quot;; // version number&lt;br /&gt;
string  VERDATE = &amp;quot;20120130&amp;quot;; // version date&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;
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;
integer HEALALL = TRUE;         // heal all? if FALSE...&lt;br /&gt;
integer HEALAMOUNT = 0;         // heal how many critical/wound boxes?&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// GLOBAL SETUP()&lt;br /&gt;
//============================================================================&lt;br /&gt;
SETUP() {&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;
                    llRegionSay(CHANMYRIAD,llKey2Name(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;
                    llRegionSay(CHANMYRIAD,llKey2Name(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;
                    llRegionSay(CHANMYRIAD,llKey2Name(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;
                    llRegionSay(CHANMYRIAD,llKey2Name(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>