<?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%2FEquipment_Server</id>
		<title>User:Allen Kerensky/Myriad Lite Preview 5/Equipment Server - 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%2FEquipment_Server"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Equipment_Server&amp;action=history"/>
		<updated>2026-05-15T09:57:57Z</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/Equipment_Server&amp;diff=27379&amp;oldid=prev</id>
		<title>Allen Kerensky: moved User:Allen Kerensky:Myriad Lite Preview 5:Equipment Server to User:Allen Kerensky/Myriad Lite Preview 5/Equipment Server: move into subsite</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Equipment_Server&amp;diff=27379&amp;oldid=prev"/>
				<updated>2012-02-06T22:55:47Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/wiki/User:Allen_Kerensky:Myriad_Lite_Preview_5:Equipment_Server&quot; class=&quot;mw-redirect&quot; title=&quot;User:Allen Kerensky:Myriad Lite Preview 5:Equipment Server&quot;&gt;User:Allen Kerensky:Myriad Lite Preview 5:Equipment Server&lt;/a&gt; to &lt;a href=&quot;/wiki/User:Allen_Kerensky/Myriad_Lite_Preview_5/Equipment_Server&quot; title=&quot;User:Allen Kerensky/Myriad Lite Preview 5/Equipment Server&quot;&gt;User:Allen Kerensky/Myriad Lite Preview 5/Equipment Server&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:55, 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/Equipment_Server&amp;diff=27214&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/Equipment_Server&amp;diff=27214&amp;oldid=prev"/>
				<updated>2012-02-06T18:23:40Z</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 Equipment Server =&lt;br /&gt;
&lt;br /&gt;
== Myriad_Lite_Equipment_Server-v0.0.1-201201024.lsl ==&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
// Myriad_Lite_Equipment_Server-v0.0.1-20120124.lsl&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;
// Myriad Lite 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;
&lt;br /&gt;
// CONSTANTS - DO NOT CHANGE DURING RUN&lt;br /&gt;
string VERSION = &amp;quot;0.0.1&amp;quot;; // Allen Kerensky's script version&lt;br /&gt;
string VERSIONDATE = &amp;quot;20120124&amp;quot;; // Allen Kerensky's script yyyymmdd&lt;br /&gt;
integer CHAN_MYRIAD = -999; // regionwide channel for Myriad events&lt;br /&gt;
string CARD = &amp;quot;Myriad_Lite_Equipment-v0.0.0-20120122.csv&amp;quot;; // notecard data table&lt;br /&gt;
&lt;br /&gt;
// RUNTIME GLOBALS - CAN CHANGE DURING RUN&lt;br /&gt;
integer HAND_MYRIAD; // llListenRemove handle for Myriad regional channel&lt;br /&gt;
&lt;br /&gt;
list EQNAMES; // names of equipment loaded&lt;br /&gt;
list EQTYPES; // types of equipment loaded, indexed by name order&lt;br /&gt;
list EQCOSTS; // costs of equipment loaded, indexed by name order&lt;br /&gt;
list EQINFOS; // info for equipment loaded, indexed by name order&lt;br /&gt;
list EQRANGES; // range of item loaded, indexed by name order&lt;br /&gt;
list EQDAMAGES; // damage of item loaded, indexed by name order&lt;br /&gt;
list EQPERIODS; // time period of item loaded, indexed by name order&lt;br /&gt;
list EQBONUSES; // bonus using item loaded, indexed by name order&lt;br /&gt;
list EQRATINGS; // rating of item loaded, indexed, by name order&lt;br /&gt;
list EQACTIVATIONS; // activation rule for item loaded, indexed by name order&lt;br /&gt;
list EQEFFECTS; // special effects for item loaded, indexed by name order&lt;br /&gt;
&lt;br /&gt;
integer LINE = 0; // reading line number&lt;br /&gt;
key QUERY = NULL_KEY; // track notecard queries&lt;br /&gt;
&lt;br /&gt;
// DEBUG - show debug messages&lt;br /&gt;
DEBUG(string dmessage) {&lt;br /&gt;
    llOwnerSay(&amp;quot;DEBUG: &amp;quot;+dmessage);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// SETUP - begin&lt;br /&gt;
SETUP() {&lt;br /&gt;
    if ( HAND_MYRIAD != 0 ) llListenRemove(HAND_MYRIAD); // is there already a listener? clear it    &lt;br /&gt;
    HAND_MYRIAD = llListen(CHAN_MYRIAD,&amp;quot;&amp;quot;,NULL_KEY,&amp;quot;&amp;quot;); // start region channel listener&lt;br /&gt;
    DEBUG(&amp;quot;Equipment Server &amp;quot;+VERSION+&amp;quot; &amp;quot;+VERSIONDATE+&amp;quot; loading Equipment. Please wait...&amp;quot;); // tell player we're waiting for data server&lt;br /&gt;
    QUERY = llGetNotecardLine(CARD,LINE++); // ask for line from notecard and advance to next line&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// RESET - reload&lt;br /&gt;
RESET() {&lt;br /&gt;
    llResetScript(); // now reset&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
LIST_EQUIPMENT(key id) {&lt;br /&gt;
    integer replyto = (integer)(&amp;quot;0x&amp;quot;+llGetSubString((string)id,0,6)); // calculate requestor-specific chat channel to reply to&lt;br /&gt;
    // we have to work around llRegionSay max string length 1023 characters&lt;br /&gt;
    integer items = llGetListLength(EQNAMES); // how many total items to send?&lt;br /&gt;
    integer count; // which item are we processing now?&lt;br /&gt;
    string out = &amp;quot;EQUIPMENT|&amp;quot;; // start an output list&lt;br /&gt;
    integer firstflag = TRUE; // is this first item in new list?&lt;br /&gt;
    while (count &amp;lt; items ) { // do we still have items in list to send?&lt;br /&gt;
        string name = llList2String(EQNAMES,count); // get the name of current item&lt;br /&gt;
        if (  llStringLength(out+&amp;quot;,&amp;quot;+name) &amp;lt;= 1016) { // is our output list under the string length limit?&lt;br /&gt;
            if ( firstflag == TRUE ) { // first item in list does not need a comma prefix&lt;br /&gt;
                out += name; // add this item as first in the output list&lt;br /&gt;
                firstflag = FALSE; // turn off first flag since next item won't be&lt;br /&gt;
            } else { // not first item in list, prefix with comma&lt;br /&gt;
                out += &amp;quot;,&amp;quot;+name; // add a comma and this boon to existing list&lt;br /&gt;
            }&lt;br /&gt;
        } else { // output string &amp;gt; 1016 chars long&lt;br /&gt;
            llRegionSay(replyto,out); // send current output string&lt;br /&gt;
            out = &amp;quot;EQUIPMENT|&amp;quot;+name; // start a new one and add current item to that&lt;br /&gt;
        }&lt;br /&gt;
        count++; // done putting this item in a list, set counter to next&lt;br /&gt;
    }   &lt;br /&gt;
    llRegionSay(replyto,out); // say last line of output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
GET_EQUIPMENT(key id,string msg) {&lt;br /&gt;
    integer replyto = (integer)(&amp;quot;0x&amp;quot;+llGetSubString((string)id,0,6)); // calculate requestor-specific chat channel to reply to&lt;br /&gt;
    list tokens = llParseString2List(msg,[&amp;quot;|&amp;quot;],[]); // split msg into list around pipe symbols&lt;br /&gt;
    string equipment = llList2String(tokens,1); // the name of the item to get&lt;br /&gt;
    integer listpos = llListFindList(EQNAMES,[equipment]); // get the position of that item in the list&lt;br /&gt;
    string reply = &amp;quot;EQUIPMENT&amp;quot;; // start output item data NO PLURAL here - we're sending 1 boon&lt;br /&gt;
    if ( listpos != -1 ) { // was item name in the list?&lt;br /&gt;
        reply += &amp;quot;|NAME=&amp;quot;+llList2String(EQNAMES,listpos); // add name field to output&lt;br /&gt;
        reply += &amp;quot;|TYPE=&amp;quot;+llList2String(EQTYPES,listpos); // add type field to output&lt;br /&gt;
        reply += &amp;quot;|COST=&amp;quot;+llList2String(EQCOSTS,listpos); // add cost field to output&lt;br /&gt;
        reply += &amp;quot;|INFO=&amp;quot;+llList2String(EQINFOS,listpos); // add info field to output&lt;br /&gt;
        reply += &amp;quot;|RANGE=&amp;quot;+llList2String(EQRANGES,listpos); // add range field to output&lt;br /&gt;
        reply += &amp;quot;|DAMAGE=&amp;quot;+llList2String(EQDAMAGES,listpos); // add damage field to output&lt;br /&gt;
        reply += &amp;quot;|PERIOD=&amp;quot;+llList2String(EQPERIODS,listpos); // add period field to output&lt;br /&gt;
        reply += &amp;quot;|BONUS=&amp;quot;+llList2String(EQBONUSES,listpos); // add bonus field to output&lt;br /&gt;
        reply += &amp;quot;|RATING=&amp;quot;+llList2String(EQRATINGS,listpos); // add rating field to output&lt;br /&gt;
        reply += &amp;quot;|ACTIVATION=&amp;quot;+llList2String(EQACTIVATIONS,listpos); // add activation rule field to output&lt;br /&gt;
        reply += &amp;quot;|EFFECTS=&amp;quot;+llList2String(EQEFFECTS,listpos); // add effect field to output&lt;br /&gt;
        llRegionSay(replyto,reply); // send it to requestor FIXME what if output greater than 1016 chars?&lt;br /&gt;
    } else {&lt;br /&gt;
        llRegionSay(replyto,&amp;quot;EFFECTS|ERROR=Requested equipment (&amp;quot;+equipment+&amp;quot;) not found&amp;quot;); // item requested does not exist, return an error&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
SET_EQUIPMENT() {&lt;br /&gt;
    // FIXME - do we need this?   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// DEFAULT STATE&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    // STATE ENTRY - called on Reset&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        SETUP(); // show credits and start notecard data load&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // on_rez - when rezzed to ground or from inventory as attachment during login&lt;br /&gt;
    on_rez(integer params) {&lt;br /&gt;
        params = 0; // LSLINT&lt;br /&gt;
        RESET(); // force to go through state entry&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // attach - when attached or detached from inventory or during login&lt;br /&gt;
    attach(key id) {&lt;br /&gt;
        id = NULL_KEY; // LSLINT&lt;br /&gt;
        RESET(); // force to go through state entry&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // dataserver called for each line of notecard requested&lt;br /&gt;
    dataserver(key queryid,string data) {&lt;br /&gt;
        if ( queryid == QUERY ) { // dataserver gave us line we asked for?&lt;br /&gt;
            if ( data != EOF ) { // we're not at end of notecard file?&lt;br /&gt;
                if ( llGetSubString(data,0,0) == &amp;quot;#&amp;quot; ) { // does this line start with comment mark?&lt;br /&gt;
                    QUERY = llGetNotecardLine(CARD,LINE++); // ignore comment and ask for the next line&lt;br /&gt;
                    return; // return early since we skipping comments&lt;br /&gt;
                }&lt;br /&gt;
                // Parse non-comment lines in keyword = value[,value,...] format&lt;br /&gt;
                list fields = llParseString2List(data,[&amp;quot;,&amp;quot;],[]); // break line of text into = delimited fields&lt;br /&gt;
                integer n = llGetListLength(fields); // how many fields in this entry?&lt;br /&gt;
                integer i; // temporary counter&lt;br /&gt;
                // NOTE: this mess is because items have some constant fields (name, type, cost, info) and optional fields by item type&lt;br /&gt;
                // so we create an entire empty entry, then populate it attribute by attribute from whatever we load&lt;br /&gt;
                // then we save it to the in-memory lists which are indexed by name&lt;br /&gt;
                // ugly - but it avoids multiple equipment servers, one per type&lt;br /&gt;
                string name = &amp;quot;&amp;quot;; // initialize temp item name&lt;br /&gt;
                string type = &amp;quot;&amp;quot;; // initialize temp item type&lt;br /&gt;
                string range = &amp;quot;&amp;quot;; // initialize temp item range&lt;br /&gt;
                string damage = &amp;quot;&amp;quot;; // initialize temp item damage&lt;br /&gt;
                integer cost = 0; // initialize temp item cost&lt;br /&gt;
                string info = &amp;quot;&amp;quot;; // initialize temp item info&lt;br /&gt;
                string period = &amp;quot;&amp;quot;; // initialize temp item period&lt;br /&gt;
                string bonus = &amp;quot;&amp;quot;; // initialize tem item bonus&lt;br /&gt;
                string rating = &amp;quot;&amp;quot;; // initialize temp item rating&lt;br /&gt;
                string activation = &amp;quot;&amp;quot;; // initialize temp item activations&lt;br /&gt;
                string effects = &amp;quot;&amp;quot;; // initialize temp item effects&lt;br /&gt;
                for (i=0; i&amp;lt;n; i++ ) { // count through teach field&lt;br /&gt;
                    string attribvalpair = llStringTrim(llList2String(fields,i),STRING_TRIM); // field zero is the &amp;quot;command&amp;quot;&lt;br /&gt;
                    string attrib = llStringTrim(llList2String(llParseString2List(attribvalpair,[&amp;quot;=&amp;quot;],[]),0),STRING_TRIM); // attribute name&lt;br /&gt;
                    string value = llStringTrim(llList2String(llParseString2List(attribvalpair,[&amp;quot;=&amp;quot;],[]),1),STRING_TRIM); // value of attribute&lt;br /&gt;
                    if ( attrib == &amp;quot;NAME&amp;quot; ) name = value; // if its a name, save value to temp name&lt;br /&gt;
                    if ( attrib == &amp;quot;TYPE&amp;quot; ) type = value; // if its a type, save value to temp type&lt;br /&gt;
                    if ( attrib == &amp;quot;COST&amp;quot; ) cost = (integer)value; // if its a cost, save value to type cost&lt;br /&gt;
                    if ( attrib == &amp;quot;INFO&amp;quot; ) info = value; // if its an info, save value to temp info&lt;br /&gt;
                    if ( attrib == &amp;quot;RANGE&amp;quot; ) range = value; // if its a range, save value to temp range&lt;br /&gt;
                    if ( attrib == &amp;quot;DAMAGE&amp;quot; ) damage = value; // if its a damage, save value to temp damage&lt;br /&gt;
                    if ( attrib == &amp;quot;PERIOD&amp;quot; ) period = value; // if its a period, save value to temp period&lt;br /&gt;
                    if ( attrib == &amp;quot;BONUS&amp;quot; ) bonus = value; // if its a bonus, save value to temp bonus&lt;br /&gt;
                    if ( attrib == &amp;quot;RATING&amp;quot; ) rating = value; // if its a rating, save value to temp rating&lt;br /&gt;
                    if ( attrib == &amp;quot;ACTIVATION&amp;quot; ) activation = value; // if its an activation rule, save value to temp activation&lt;br /&gt;
                    if ( attrib == &amp;quot;EFFECTS&amp;quot; ) effects = value; // if its a special effect ability list, save value to temp effects&lt;br /&gt;
                }&lt;br /&gt;
                // save values to memory lists&lt;br /&gt;
                EQNAMES = EQNAMES + [name]; // add name to end of names list&lt;br /&gt;
                EQTYPES = EQTYPES + [type]; // add type to end of types list&lt;br /&gt;
                EQCOSTS = EQCOSTS + [cost]; // add cost to end of costs list&lt;br /&gt;
                EQINFOS = EQINFOS + [info]; // add info to end of infos list&lt;br /&gt;
                EQRANGES = EQRANGES + [range]; // add range to end of ranges list&lt;br /&gt;
                EQDAMAGES = EQDAMAGES + [damage]; // add damage to end of damages list&lt;br /&gt;
                EQPERIODS = EQPERIODS + [period]; // add period to end of periods list&lt;br /&gt;
                EQBONUSES = EQBONUSES + [bonus]; // add bonus to end of the bonuses list&lt;br /&gt;
                EQRATINGS = EQRATINGS + [rating]; // add rating to end of the ratings list&lt;br /&gt;
                EQACTIVATIONS = EQACTIVATIONS + [activation]; // add activation to end of the activations list&lt;br /&gt;
                EQEFFECTS = EQEFFECTS + [effects]; // add effects to end of effects list&lt;br /&gt;
                QUERY = llGetNotecardLine(CARD,LINE++); // finished with known keywords, get next line&lt;br /&gt;
            } else { // end of notecard&lt;br /&gt;
                DEBUG(&amp;quot;Equipment Loaded. Equipment server ready. Free Memory: &amp;quot;+(string)llGetFreeMemory());&lt;br /&gt;
            } // end if data not equal eof&lt;br /&gt;
        } // end if query id equal&lt;br /&gt;
    } // end if data server event&lt;br /&gt;
    &lt;br /&gt;
    listen(integer channel,string name,key id,string msg) {&lt;br /&gt;
        channel = 0; // LSLINT&lt;br /&gt;
        name = &amp;quot;&amp;quot;; // LSLINT&lt;br /&gt;
        list tokens = llParseString2List(msg,[&amp;quot;|&amp;quot;],[ ]); // split msg into list around pipe symbols&lt;br /&gt;
        string command = llList2String(tokens,0); // first field is some sort of command&lt;br /&gt;
        if ( command == &amp;quot;LIST_EQUIPMENT&amp;quot; ) { // is this a list all boon names request&lt;br /&gt;
            LIST_EQUIPMENT(id); // call it&lt;br /&gt;
            return; // return early instead of processing more&lt;br /&gt;
        }&lt;br /&gt;
        if ( command == &amp;quot;GET_EQUIPMENT&amp;quot; ) { // GET_EQUIPMENT|string equipmentname&lt;br /&gt;
            GET_EQUIPMENT(id,msg); // call it&lt;br /&gt;
            return; // return early instead of processing more&lt;br /&gt;
        }&lt;br /&gt;
        if ( command == &amp;quot;SET_EQUIPMENT&amp;quot; ) { // is this a set equipment request&lt;br /&gt;
            SET_EQUIPMENT(); // call it&lt;br /&gt;
            return; // return early in case we add more later&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
} // end default state&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Allen Kerensky</name></author>	</entry>

	</feed>