<?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%2FResiliences_Server</id>
		<title>User:Allen Kerensky/Myriad Lite Preview 5/Resiliences 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%2FResiliences_Server"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Resiliences_Server&amp;action=history"/>
		<updated>2026-04-25T09:19:35Z</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/Resiliences_Server&amp;diff=27397&amp;oldid=prev</id>
		<title>Allen Kerensky: moved User:Allen Kerensky:Myriad Lite Preview 5:Resiliences Server to User:Allen Kerensky/Myriad Lite Preview 5/Resiliences 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/Resiliences_Server&amp;diff=27397&amp;oldid=prev"/>
				<updated>2012-02-06T22:59:17Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/wiki/User:Allen_Kerensky:Myriad_Lite_Preview_5:Resiliences_Server&quot; class=&quot;mw-redirect&quot; title=&quot;User:Allen Kerensky:Myriad Lite Preview 5:Resiliences Server&quot;&gt;User:Allen Kerensky:Myriad Lite Preview 5:Resiliences Server&lt;/a&gt; to &lt;a href=&quot;/wiki/User:Allen_Kerensky/Myriad_Lite_Preview_5/Resiliences_Server&quot; title=&quot;User:Allen Kerensky/Myriad Lite Preview 5/Resiliences Server&quot;&gt;User:Allen Kerensky/Myriad Lite Preview 5/Resiliences 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:59, 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/Resiliences_Server&amp;diff=27227&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/Resiliences_Server&amp;diff=27227&amp;oldid=prev"/>
				<updated>2012-02-06T18:59:35Z</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 Resiliences Server =&lt;br /&gt;
&lt;br /&gt;
== Myriad_Lite_Resiliences_Server-v0.0.0-2011105.lsl ==&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
// Myriad_Lite_Resilience_Server-v0.0.0-20111005.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.0&amp;quot;; // Allen Kerensky's script version&lt;br /&gt;
string VERSIONDATE = &amp;quot;20111005&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_Resiliences-v0.0.0-20111005.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 RESILIENCES;  // names of resiliences&lt;br /&gt;
list BASE_STATS; // stat this resilience is based on, indexed by name order&lt;br /&gt;
list TYPES; // critical or noncritical, indexed by name order&lt;br /&gt;
list ACTIONS; // actions when crit stat goes zero, indexed by name order&lt;br /&gt;
list DESCRIPTIONS; // description. 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;Resilience server &amp;quot;+VERSION+&amp;quot; &amp;quot;+VERSIONDATE+&amp;quot; loading Resiliences. 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_RESILIENCES(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(RESILIENCES); // how many total items to send?&lt;br /&gt;
    integer count; // which item are we processing now?&lt;br /&gt;
    string out = &amp;quot;RESILIENCES|&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(RESILIENCES,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 resilience 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;RESILIENCES|&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_RESILIENCE(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 resilience = llList2String(tokens,1); // the name of the item to get&lt;br /&gt;
    integer listpos = llListFindList(RESILIENCES,[resilience]); // get the position of that item in the list&lt;br /&gt;
    string reply = &amp;quot;RESILIENCE&amp;quot;; // start output item data NO PLURAL here - we're sending 1 resilience&lt;br /&gt;
    if ( listpos != -1 ) { // was item name in the list?&lt;br /&gt;
        reply += &amp;quot;|RESILIENCE=&amp;quot;+llList2String(RESILIENCES,listpos); // add resilience name to output&lt;br /&gt;
        reply += &amp;quot;|BASE_STAT=&amp;quot;+llList2String(BASE_STATS,listpos); // add resilience base stat to output&lt;br /&gt;
        reply += &amp;quot;|TYPE=&amp;quot;+llList2String(TYPES,listpos); // add resilience type to output&lt;br /&gt;
        reply += &amp;quot;|ACTION=&amp;quot;+llList2String(ACTIONS,listpos); // add resilience action to output&lt;br /&gt;
        reply += &amp;quot;|DESCRIPTION=&amp;quot;+llList2String(DESCRIPTIONS,listpos); // add resilience description 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;RESILIENCE|ERROR=Requested Resilience(&amp;quot;+resilience+&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_RESILIENCE() {&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;&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;
                RESILIENCES     = RESILIENCES + [llStringTrim(llList2String(fields,0),STRING_TRIM)]; // add resilience name field to list&lt;br /&gt;
                BASE_STATS      = BASE_STATS + [llStringTrim(llList2String(fields,1),STRING_TRIM)]; // add resilience base stat field to list&lt;br /&gt;
                TYPES           = TYPES + [llStringTrim(llList2String(fields,2),STRING_TRIM)]; // add resilience type field to list&lt;br /&gt;
                ACTIONS         = ACTIONS + [llStringTrim(llList2String(fields,3),STRING_TRIM)]; // add resilience actions field to list&lt;br /&gt;
                DESCRIPTIONS    = DESCRIPTIONS + [llStringTrim(llList2String(fields,4),STRING_TRIM)]; // add resilience description field to 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;Resiliences Loaded. Server ready. Free Memory: &amp;quot;+(string)llGetFreeMemory()); // done, ready to serve            &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_RESILIENCES&amp;quot; ) { // is this a list all resiliences request?&lt;br /&gt;
            LIST_RESILIENCES(id); // call it&lt;br /&gt;
            return; // return early instead of processing more&lt;br /&gt;
        }&lt;br /&gt;
        if ( command == &amp;quot;GET_RESILIENCE&amp;quot; ) { // GET_RESILIENCE|string resiliencename&lt;br /&gt;
            GET_RESILIENCE(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_RESILIENCE&amp;quot; ) {&lt;br /&gt;
            SET_RESILIENCE(); // 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>