<?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%2FSFX_Server</id>
		<title>User:Allen Kerensky/Myriad Lite Preview 5/SFX 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%2FSFX_Server"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/SFX_Server&amp;action=history"/>
		<updated>2026-05-16T03:45:49Z</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/SFX_Server&amp;diff=27403&amp;oldid=prev</id>
		<title>Allen Kerensky: moved User:Allen Kerensky:Myriad Lite Preview 5:SFX Server to User:Allen Kerensky/Myriad Lite Preview 5/SFX 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/SFX_Server&amp;diff=27403&amp;oldid=prev"/>
				<updated>2012-02-06T23:00:21Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/wiki/User:Allen_Kerensky:Myriad_Lite_Preview_5:SFX_Server&quot; class=&quot;mw-redirect&quot; title=&quot;User:Allen Kerensky:Myriad Lite Preview 5:SFX Server&quot;&gt;User:Allen Kerensky:Myriad Lite Preview 5:SFX Server&lt;/a&gt; to &lt;a href=&quot;/wiki/User:Allen_Kerensky/Myriad_Lite_Preview_5/SFX_Server&quot; title=&quot;User:Allen Kerensky/Myriad Lite Preview 5/SFX Server&quot;&gt;User:Allen Kerensky/Myriad Lite Preview 5/SFX 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:00, 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/SFX_Server&amp;diff=27230&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/SFX_Server&amp;diff=27230&amp;oldid=prev"/>
				<updated>2012-02-06T19:04:20Z</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 SFX Server =&lt;br /&gt;
&lt;br /&gt;
== Myriad_Lite_SFX_Server-v0.0.0-20111008.lsl ==&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
// Myriad_Lite_SFX_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;20111008&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_SFX-v0.0.0-20100326.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 EFFECTS; // names of the special effect abilities&lt;br /&gt;
list TYPES; // types of SFX, indexed by name order&lt;br /&gt;
list ACTIVATIONS; // activation rules for SFX, indexed by name order&lt;br /&gt;
list DESCRIPTIONS; // SFX 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;Special Effect (SFX) server &amp;quot;+VERSION+&amp;quot; &amp;quot;+VERSIONDATE+&amp;quot; loading Effects. 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_EFFECTS(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(EFFECTS); // how many total items to send?&lt;br /&gt;
    integer count; // which item are we processing now?&lt;br /&gt;
    string out = &amp;quot;EFFECTS|&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(EFFECTS,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 effect 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;EFFECTS|&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_EFFECT(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 effect = llList2String(tokens,1); // the name of the item to get&lt;br /&gt;
    integer listpos = llListFindList(EFFECTS,[effect]); // get the position of that item in the list&lt;br /&gt;
    string reply = &amp;quot;EFFECTS&amp;quot;; // start output item data NO PLURAL here - we're sending 1 effect&lt;br /&gt;
    if ( listpos != -1 ) { // was item name in the list?&lt;br /&gt;
        reply += &amp;quot;|NAME=&amp;quot;+llList2String(EFFECTS,listpos); // add effect name to output&lt;br /&gt;
        reply += &amp;quot;|TYPE=&amp;quot;+llList2String(TYPES,listpos); // add effect type to output&lt;br /&gt;
        reply += &amp;quot;|ACTIVATION=&amp;quot;+llList2String(ACTIVATIONS,listpos); // add effect activation rules to output&lt;br /&gt;
        reply += &amp;quot;|DESCRIPTION=&amp;quot;+llList2String(DESCRIPTIONS,listpos); // add effect 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;EFFECTS|ERROR=Requested effect (&amp;quot;+effect+&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_EFFECT() {&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;
                EFFECTS         = EFFECTS + [llStringTrim(llList2String(fields,0),STRING_TRIM)]; // add effect name field to list&lt;br /&gt;
                TYPES           = TYPES + [llStringTrim(llList2String(fields,1),STRING_TRIM)]; // add effect type field to list&lt;br /&gt;
                ACTIVATIONS     = ACTIVATIONS+ [llStringTrim(llList2String(fields,2),STRING_TRIM)]; // add effect activation rule field to list&lt;br /&gt;
                DESCRIPTIONS    = DESCRIPTIONS + [llStringTrim(llList2String(fields,3),STRING_TRIM)]; // add effect 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;SFX 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_EFFECTS&amp;quot; ) { // is this a list all SFX request?&lt;br /&gt;
            LIST_EFFECTS(id); // call it&lt;br /&gt;
            return; // return early instead of processing more&lt;br /&gt;
        }&lt;br /&gt;
        if ( command == &amp;quot;GET_EFFECT&amp;quot; ) { // GET_EFFECT|string effectname&lt;br /&gt;
            GET_EFFECT(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_EFFECT&amp;quot; ) { // is this a set-effect request&lt;br /&gt;
            SET_EFFECT(); // 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>