<?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_Target-Preview6.lsl</id>
		<title>User:Allen Kerensky/Myriad Lite/Myriad Lite Target-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_Target-Preview6.lsl"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite/Myriad_Lite_Target-Preview6.lsl&amp;action=history"/>
		<updated>2026-06-13T20:09:52Z</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_Target-Preview6.lsl&amp;diff=30349&amp;oldid=prev</id>
		<title>Allen Kerensky: Myriad_Lite_Target-Preview6.lsl</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite/Myriad_Lite_Target-Preview6.lsl&amp;diff=30349&amp;oldid=prev"/>
				<updated>2012-08-12T04:09:17Z</updated>
		
		<summary type="html">&lt;p&gt;Myriad_Lite_Target-Preview6.lsl&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Myriad_Lite_Target-Preview6.lsl =&lt;br /&gt;
 &amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
// Myriad_Lite_Target-v0.0.6-20120202.lsl&lt;br /&gt;
// Copyright (c) 2012 by 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;
//============================================================================&lt;br /&gt;
// MESSAGE FORMAT REFERENCE&lt;br /&gt;
//============================================================================&lt;br /&gt;
// CHANPLAYER IN - DEPRECATED - HITCHECK|int attackstat|int attackskill|int attackdice|key owner|str name&lt;br /&gt;
// CHANPLAYER IN - RANGEDHIT|int attackstat|int attackskill|int attackdice|key weaponowner|str name&lt;br /&gt;
// CHANPLAYER IN - CLOSEHIT|int attackstat|int attackskill|int attackdice|key weaponowner|str name&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// GLOBAL VARIABLES&lt;br /&gt;
//============================================================================&lt;br /&gt;
string  VERSION = &amp;quot;0.0.6&amp;quot;; // version number&lt;br /&gt;
string  VERDATE = &amp;quot;20120202&amp;quot;; // version date&lt;br /&gt;
&lt;br /&gt;
integer CHANOBJECT; // channel the target listens on for attacks&lt;br /&gt;
integer HANDOBJECT; // chat channel handle to remove channel later if needed&lt;br /&gt;
integer MINSTAT = 1; // minimum value of a statistic&lt;br /&gt;
integer MAXSTAT = 10; // maximum value of a statistic&lt;br /&gt;
integer MINSKILL = 1; // minimum value of a skill&lt;br /&gt;
integer MAXSKILL = 5; // maximum value of a skill&lt;br /&gt;
integer MINDAMAGE = 1; // minimum damage dice a weapon can inflict&lt;br /&gt;
integer MAXDAMAGE = 5; // maximum damage dice a weapon can inflict&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// GLOBAL ERROR() - report errors on debug channel&lt;br /&gt;
//============================================================================&lt;br /&gt;
ERROR(string errmsg) {&lt;br /&gt;
    llSay(DEBUG_CHANNEL,&amp;quot;ERROR: &amp;quot;+errmsg);&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;
        llSetPrimitiveParams([PRIM_PHANTOM, FALSE]); // ensure all prims are not phantom to register collisions&lt;br /&gt;
        CHANOBJECT = (integer)(&amp;quot;0x&amp;quot;+llGetSubString((string)llGetKey(),0,6)); // calculate dynamic channel to listen on&lt;br /&gt;
        HANDOBJECT = llListen(CHANOBJECT,&amp;quot;&amp;quot;,NULL_KEY,&amp;quot;&amp;quot;); // start listener for attack events&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;
        llResetScript(); // nothing drastic, just reset script and start from the top&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // LISTEN EVENT - whispers, says, shouts, regionsays&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    listen(integer channel,string speakername,key speakerid,string message) {&lt;br /&gt;
        speakername = &amp;quot;&amp;quot;; // LSLINT&lt;br /&gt;
        speakerid = NULL_KEY; // LSLINT&lt;br /&gt;
        if ( channel == CHANOBJECT ) { // is this message on the dynamic channel?        &lt;br /&gt;
            list fields = llParseString2List(message,[&amp;quot;|&amp;quot;],[]); // break message into parts split by | symbol&lt;br /&gt;
            string command = llList2String(fields,0); // field 0 is the command&lt;br /&gt;
            if ( command == &amp;quot;HITCHECK&amp;quot; || command == &amp;quot;RANGEDHIT&amp;quot; || command == &amp;quot;CLOSEHIT&amp;quot; ) { // is this an attack command?&lt;br /&gt;
                integer attackstat = llList2Integer(fields,1); // get the value of the attacker's stat&lt;br /&gt;
                integer attackskill = llList2Integer(fields,2); // get the attackers skill level&lt;br /&gt;
                integer attackdice = llList2Integer(fields,3);  // get the attackers weapon attack dice&lt;br /&gt;
                key owner = llList2Key(fields,4); // get the owner of the attacking object&lt;br /&gt;
                string item = llList2String(fields,5); // get the name of the attacking object&lt;br /&gt;
                if ( attackstat &amp;lt; MINSTAT || attackstat &amp;gt; MAXSTAT ) { // is attack stat valid?&lt;br /&gt;
                    ERROR(&amp;quot;Attack stat value out of range: &amp;quot;+(string)MINSTAT+&amp;quot;-&amp;quot;+(string)MAXSTAT); // report the invalid value&lt;br /&gt;
                    return; // exit early since we've hit a fatal error with message&lt;br /&gt;
                }&lt;br /&gt;
                if ( attackskill &amp;lt; MINSKILL || attackstat &amp;gt; MAXSKILL ) { // is attacker skill value valid?&lt;br /&gt;
                    ERROR(&amp;quot;Attack skill value out of range: &amp;quot;+(string)MINSKILL+&amp;quot;-&amp;quot;+(string)MAXSKILL); // report invalid value&lt;br /&gt;
                    return; // exit early since we've hit a fatal error with message&lt;br /&gt;
                }                &lt;br /&gt;
                if ( attackdice &amp;lt; MINDAMAGE || attackdice &amp;gt; MAXDAMAGE ) { // is attack dice of object valid?&lt;br /&gt;
                    ERROR(&amp;quot;Attack dice value out of range: &amp;quot;+(string)MINDAMAGE+&amp;quot;-&amp;quot;+(string)MAXDAMAGE); // report invalid value&lt;br /&gt;
                    return; // exit early since we've hit a fatal error with message&lt;br /&gt;
                }&lt;br /&gt;
                // its all good - report the hit&lt;br /&gt;
                llShout(PUBLIC_CHANNEL,&amp;quot;/me hit by &amp;quot;+llKey2Name(owner)+&amp;quot;'s &amp;quot;+item+&amp;quot; for &amp;quot;+(string)attackdice+&amp;quot; attack dice!&amp;quot;);&lt;br /&gt;
                return; // exit early in case we add more commands later&lt;br /&gt;
            } // end if attack command           &lt;br /&gt;
        } // end if channel object        &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>