<?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%2FSkills_Server</id>
		<title>User:Allen Kerensky/Myriad Lite Preview 5/Skills 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%2FSkills_Server"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Skills_Server&amp;action=history"/>
		<updated>2026-04-21T12:12:12Z</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/Skills_Server&amp;diff=27409&amp;oldid=prev</id>
		<title>Allen Kerensky: moved User:Allen Kerensky:Myriad Lite Preview 5:Skills Server to User:Allen Kerensky/Myriad Lite Preview 5/Skills 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/Skills_Server&amp;diff=27409&amp;oldid=prev"/>
				<updated>2012-02-06T23:01:11Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/wiki/User:Allen_Kerensky:Myriad_Lite_Preview_5:Skills_Server&quot; class=&quot;mw-redirect&quot; title=&quot;User:Allen Kerensky:Myriad Lite Preview 5:Skills Server&quot;&gt;User:Allen Kerensky:Myriad Lite Preview 5:Skills Server&lt;/a&gt; to &lt;a href=&quot;/wiki/User:Allen_Kerensky/Myriad_Lite_Preview_5/Skills_Server&quot; title=&quot;User:Allen Kerensky/Myriad Lite Preview 5/Skills Server&quot;&gt;User:Allen Kerensky/Myriad Lite Preview 5/Skills 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 23:01, 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/Skills_Server&amp;diff=27235&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/Skills_Server&amp;diff=27235&amp;oldid=prev"/>
				<updated>2012-02-06T19:09:33Z</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 Skills Server =&lt;br /&gt;
&lt;br /&gt;
== Myriad_Lite_Skills_Server-v0.0.0-20111006.lsl ==&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
// Myriad_Lite_Skill_Server-v0.0.0-20111006.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;20111006&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_Skills-v0.0.1-20111006.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 SKILLS; // the skill names&lt;br /&gt;
list GENRES; // the skill genre, indexed by name order&lt;br /&gt;
list DESCRIPTIONS; // the skill descriptions, 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;Skills server &amp;quot;+VERSION+&amp;quot; &amp;quot;+VERSIONDATE+&amp;quot; loading Skills. 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_SKILLS(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(SKILLS); // how many total items to send?&lt;br /&gt;
    integer count; // which item are we processing now?&lt;br /&gt;
    string out = &amp;quot;SKILLS|&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(SKILLS,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 skill 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;SKILLS|&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_SKILL(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 skill = llList2String(tokens,1); // the name of the item to get&lt;br /&gt;
    integer listpos = llListFindList(SKILLS,[skill]); // get the position of that item in the list&lt;br /&gt;
    string reply = &amp;quot;SKILL&amp;quot;; // start output item data NO PLURAL here - we're sending 1 skill&lt;br /&gt;
    if ( listpos != -1 ) { // was item name in the list?&lt;br /&gt;
        reply += &amp;quot;|NAME=&amp;quot;+llList2String(SKILLS,listpos); // add skill name to output&lt;br /&gt;
        reply += &amp;quot;|GENRE=&amp;quot;+llList2String(GENRES,listpos); // add skill genre to output&lt;br /&gt;
        reply += &amp;quot;|DESCRIPTION=&amp;quot;+llList2String(DESCRIPTIONS,listpos); // add 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;SKILL|ERROR=Requested Skill (&amp;quot;+skill+&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_SKILL() {&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;
                SKILLS      = SKILLS + [llStringTrim(llList2String(fields,0),STRING_TRIM)]; // add skill name field to list&lt;br /&gt;
                GENRES      = GENRES + [llStringTrim(llList2String(fields,1),STRING_TRIM)]; // add skill genre field to list&lt;br /&gt;
                DESCRIPTIONS    = DESCRIPTIONS + [llStringTrim(llList2String(fields,2),STRING_TRIM)]; // add skill 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;Skills 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_SKILLS&amp;quot; ) { // is this a list all SFX request?&lt;br /&gt;
            LIST_SKILLS(id); // call it&lt;br /&gt;
            return; // return early instead of processing more&lt;br /&gt;
        }&lt;br /&gt;
        if ( command == &amp;quot;GET_SKILL&amp;quot; ) { // GET_SKILL|string skillname&lt;br /&gt;
            GET_SKILL(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_SKILL&amp;quot; ) { // is this a set-skill request?&lt;br /&gt;
            SET_SKILL(); // 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>