<?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_Module_BAM-v0.0.5.lsl</id>
		<title>User:Allen Kerensky/Myriad Lite/Myriad Lite Module BAM-v0.0.5.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_Module_BAM-v0.0.5.lsl"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite/Myriad_Lite_Module_BAM-v0.0.5.lsl&amp;action=history"/>
		<updated>2026-06-13T19:53:43Z</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_Module_BAM-v0.0.5.lsl&amp;diff=30509&amp;oldid=prev</id>
		<title>Allen Kerensky: Myriad_Lite_Module_BAM-v0.0.5-20120826.lsl</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite/Myriad_Lite_Module_BAM-v0.0.5.lsl&amp;diff=30509&amp;oldid=prev"/>
				<updated>2012-08-26T20:23:29Z</updated>
		
		<summary type="html">&lt;p&gt;Myriad_Lite_Module_BAM-v0.0.5-20120826.lsl&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Myriad_Lite_Module_BAM-v0.0.5-20120826.lsl =&lt;br /&gt;
 &amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
// Myriad_Lite_Module_BAM-v0.0.5-20120826.lsl&lt;br /&gt;
// Copyright (c) 2012 by Baroun Tardis (OSG/SL) and 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;
// CONSTANTS - DO NOT CHANGE DURING RUN&lt;br /&gt;
string VERSION = &amp;quot;0.0.5&amp;quot;; // script version&lt;br /&gt;
string VERDATE = &amp;quot;20120826&amp;quot;; // script date&lt;br /&gt;
string CHAN_PREFIX = &amp;quot;0x&amp;quot;; // channel prefix for calculating dynamic channels&lt;br /&gt;
string DIV = &amp;quot;|&amp;quot;; // message field divider&lt;br /&gt;
&lt;br /&gt;
// Module to Module Messaging Constants&lt;br /&gt;
//integer MODULE_HUD = -1;&lt;br /&gt;
//integer MODULE_CHARSHEET = -2;&lt;br /&gt;
//integer MODULE_ARMOR = -3;&lt;br /&gt;
integer MODULE_BAM = -4;&lt;br /&gt;
//integer MODULE_RUMORS = -5;&lt;br /&gt;
// integer MODULE_CLOSE = -6;&lt;br /&gt;
// integer MODULE_RANGED = -7;&lt;br /&gt;
// integer MODULE_RESILIENCE = -8;&lt;br /&gt;
// integer MODULE_PROGRESS = -9;&lt;br /&gt;
// integer MODULE_WELL = -10;&lt;br /&gt;
// integer MODULE_METER = -11;&lt;br /&gt;
integer LM_SENDTOATTACHMENT = 0x80000000;&lt;br /&gt;
&lt;br /&gt;
string API_OFFERADV = &amp;quot;OfferAdv&amp;quot;; // Offer an adventure to HUD wearer&lt;br /&gt;
string API_ACCEPTADV = &amp;quot;AcceptAdv&amp;quot;; // Offer accepted player is on an adventure&lt;br /&gt;
string API_INADV_QUERY = &amp;quot;InAdv?&amp;quot;; // Ask a player HUD if the player is in an adventure - InAdv?&lt;br /&gt;
string API_INADV_RESPONSE = &amp;quot;InAdv&amp;quot;; // In Adventure Response Yes: InAdv | String AdventureName  No: InAdv | NONE&lt;br /&gt;
string API_TASKIP_QUERY = &amp;quot;TaskIP?&amp;quot;;&lt;br /&gt;
string API_TASKIP_RESPONSE = &amp;quot;TaskIP&amp;quot;; // Task In Progress Reply current task in progress: TaskIP | AdventureGoal&lt;br /&gt;
string API_TASKCP_QUERY = &amp;quot;TaskCP?&amp;quot;; // Task Complete Query&lt;br /&gt;
string API_TASKCP_RESPONSE = &amp;quot;TaskCP&amp;quot;; // Task Complete Reply&lt;br /&gt;
string API_DONETASK = &amp;quot;DoneTask&amp;quot;; // Task Done - player achieved current goal NPC sends: DoneTask | GoalText | TaskDone Text | PlayerUUID&lt;br /&gt;
string API_DONEADV = &amp;quot;DoneAdv&amp;quot;; // Done Adventure reply&lt;br /&gt;
string API_NONE = &amp;quot;NONE&amp;quot;; // a fixed string when not in adventure - uses variable to stay consistent everywhere&lt;br /&gt;
string API_ADDTASK = &amp;quot;AddTask&amp;quot;; // Add a task to the Player HUD - AddTask | TaskNumber | String Describing Task&lt;br /&gt;
string API_ADDHINT = &amp;quot;AddHint&amp;quot;; // Add a hint for a task to the Player HUD - AddHint | TaskNumber | String Hint&lt;br /&gt;
string MSG_NO_ADVENTURE = &amp;quot;Looking for adventure...&amp;quot;;&lt;br /&gt;
string MSG_CURRENT_ADVENTURE = &amp;quot;Adventure: &amp;quot;;&lt;br /&gt;
string MSG_CURRENT_GOAL = &amp;quot;Overall Goal: &amp;quot;;&lt;br /&gt;
string MSG_CURRENT_TASK = &amp;quot;Current Task: &amp;quot;;&lt;br /&gt;
string MSG_CURRENT_HINT = &amp;quot;Current Hint: &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// RUNTIME GLOBALS - CAN CHANGE DURING RUN&lt;br /&gt;
integer CHANOBJBAM; // channel of thing we're talking to&lt;br /&gt;
string  STATUSMSG; // scratch space to build status messages&lt;br /&gt;
integer STATUS_FLAG; // show status as HUD hover text&lt;br /&gt;
&lt;br /&gt;
// Adventure-Specific Configuration&lt;br /&gt;
// Task numbers are (AdvNum*100)+task, so they don't overlap between adventures&lt;br /&gt;
string  ADVNAME=&amp;quot;NONE&amp;quot;; // Adventure Name&lt;br /&gt;
string  ADVTEXT; // brief description&lt;br /&gt;
// Current Task-specific info&lt;br /&gt;
string  ADVTASKTODO; // task name of the next task handed out&lt;br /&gt;
integer ADVTASKTDNUM; // task number of the next task handed out&lt;br /&gt;
string  ADVTASKTODOHINT; // Hint text for the next task handed out&lt;br /&gt;
// Previous Task-specific info&lt;br /&gt;
list    ADVTCOMP; // completed task numbers (list of numbers)&lt;br /&gt;
integer FLAG_DEBUG; // show debugging?&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// DEBUG - show errors on debug channel with wearer name for sorting&lt;br /&gt;
//============================================================================&lt;br /&gt;
DEBUG(string debugmsg) {&lt;br /&gt;
    if ( FLAG_DEBUG == TRUE ) llSay(DEBUG_CHANNEL,&amp;quot;(&amp;quot;+llKey2Name(llGetOwner())+&amp;quot;) MOD BAM: &amp;quot;+debugmsg);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// GETVERSION&lt;br /&gt;
//============================================================================&lt;br /&gt;
GETVERSION() {&lt;br /&gt;
    SENDTOHUD(&amp;quot;VERSION=&amp;quot;+VERSION+DIV+&amp;quot;VERSIONDATE=&amp;quot;+VERDATE+DIV+llGetObjectName());&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// RESET - shut down running animations then reset the script to reload character sheet&lt;br /&gt;
RESET() {&lt;br /&gt;
    llResetScript(); // now reset&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// SENDTOHUD - send reponses to HUD as Link Messages&lt;br /&gt;
//============================================================================&lt;br /&gt;
SENDTOHUD(string str) {&lt;br /&gt;
    DEBUG(&amp;quot;SENDTOHUD(&amp;quot;+str+&amp;quot;)&amp;quot;);&lt;br /&gt;
    llMessageLinked(LINK_THIS,LM_SENDTOATTACHMENT,str,llGetOwner());    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// SETUP - begin bringing the HUD online&lt;br /&gt;
//============================================================================&lt;br /&gt;
SETUP() {&lt;br /&gt;
    FLAG_DEBUG=FALSE;&lt;br /&gt;
    llSetText(&amp;quot;&amp;quot;,&amp;lt;0,0,0&amp;gt;,0); // clear any previous hovertext&lt;br /&gt;
    if ( llGetAttached() &amp;gt;= 31 &amp;amp;&amp;amp; llGetAttached() &amp;lt;= 38 ) { // are we attached to a HUD slot?&lt;br /&gt;
        STATUS_FLAG = TRUE; // turn on HUD hovertext&lt;br /&gt;
    } else {&lt;br /&gt;
        STATUS_FLAG = FALSE; // turn off body attached hovertext&lt;br /&gt;
    }&lt;br /&gt;
    STATUS();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// STATUS() - update adventure data on HUD&lt;br /&gt;
//============================================================================&lt;br /&gt;
STATUS() {&lt;br /&gt;
    if ( ADVNAME == API_NONE ) { // is player in an adventure?&lt;br /&gt;
        STATUSMSG = MSG_NO_ADVENTURE; // nope&lt;br /&gt;
    } else { // yep, build the status&lt;br /&gt;
            STATUSMSG = MSG_CURRENT_ADVENTURE + ADVNAME + &amp;quot;\n&amp;quot; +&lt;br /&gt;
            MSG_CURRENT_GOAL + ADVTEXT + &amp;quot;\n&amp;quot; +&lt;br /&gt;
            MSG_CURRENT_TASK + ADVTASKTODO + &amp;quot;\n&amp;quot; +&lt;br /&gt;
            MSG_CURRENT_HINT + ADVTASKTODOHINT;&lt;br /&gt;
    }&lt;br /&gt;
    if ( STATUS_FLAG == FALSE ) { // if attached to body, use chat output&lt;br /&gt;
        llOwnerSay(STATUSMSG);&lt;br /&gt;
    } else { // attached to HUD slot, use hovertext&lt;br /&gt;
            llSetText(STATUSMSG,&amp;lt;1,1,1&amp;gt;,1.0);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//============================================================================&lt;br /&gt;
// DEFAULT STATE - load character sheet&lt;br /&gt;
//============================================================================&lt;br /&gt;
default {&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // LINK MESSAGE - commands to and from other prims in HUD&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    link_message(integer sender,integer sending_module,string message, key speakerid) {&lt;br /&gt;
        if ( sending_module == MODULE_BAM || sending_module == LM_SENDTOATTACHMENT ) return; // ignore our own messages&lt;br /&gt;
        DEBUG(&amp;quot;EVENT link_message(&amp;quot;+(string)sender+&amp;quot;,&amp;quot;+(string)sending_module+&amp;quot;,&amp;quot;+message+&amp;quot;,&amp;quot;+(string)speakerid+&amp;quot;)&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        // break down the commands and messages into units we can work with&lt;br /&gt;
        list fields = llParseString2List(message,[DIV],[]); // break into list of fields based on DIVider&lt;br /&gt;
        string command = llList2String(fields,0); // assume the first field is a Myriad Lite command&lt;br /&gt;
&lt;br /&gt;
        if ( command == &amp;quot;DEBUGOFF&amp;quot; ) { FLAG_DEBUG = FALSE; return; } // stop debugging&lt;br /&gt;
        if ( command == &amp;quot;DEBUGON&amp;quot; ) { FLAG_DEBUG = TRUE; return; } // start debugging&lt;br /&gt;
        if ( command == &amp;quot;RESET&amp;quot; ) { RESET(); return;} // reset on command&lt;br /&gt;
        if ( message == &amp;quot;VERSION&amp;quot; ) { GETVERSION(); return; } // dump the version and date on request&lt;br /&gt;
&lt;br /&gt;
        if ( message == &amp;quot;BAMSTATUS&amp;quot; ) { STATUS(); return;} // show status when specifically requested&lt;br /&gt;
        &lt;br /&gt;
        // calculate BAM dynamic channel of item/player talking to us&lt;br /&gt;
        CHANOBJBAM = (integer)(CHAN_PREFIX + llGetSubString((string)speakerid,-7,-1));&lt;br /&gt;
&lt;br /&gt;
        // process the rest of the fields for multi-field commands&lt;br /&gt;
        string data1   = llList2String(fields,1);&lt;br /&gt;
        string data2   = llList2String(fields,2);&lt;br /&gt;
        string data3   = llList2String(fields,3);&lt;br /&gt;
&lt;br /&gt;
        // We're asked what adventure we're in&lt;br /&gt;
        if ( command == API_INADV_QUERY ) {&lt;br /&gt;
            llSay(CHANOBJBAM,API_INADV_RESPONSE + DIV + ADVNAME); // reply with In Adventure and Adventure Name&lt;br /&gt;
            STATUS();&lt;br /&gt;
            return; // command done, return early&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // We're asked our current task in progress&lt;br /&gt;
        if ( command == API_TASKIP_QUERY ) { // what task in progress?&lt;br /&gt;
            // respond with task in progress&lt;br /&gt;
            llSay(CHANOBJBAM, API_TASKIP_RESPONSE + DIV + (string)ADVTASKTDNUM); // Reply with current task in progress and number&lt;br /&gt;
            STATUS();&lt;br /&gt;
            return; // command done, return early&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Get list of completed tasks&lt;br /&gt;
        if ( command == API_TASKCP_QUERY ) { // what tasks complete?&lt;br /&gt;
            llSay(CHANOBJBAM, API_TASKCP_RESPONSE + DIV + llList2CSV(ADVTCOMP)); // reply with current task complete list as CSV&lt;br /&gt;
            STATUS();&lt;br /&gt;
            return; // command done, return early&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // player is offered an adventure&lt;br /&gt;
        if ( command == API_OFFERADV ) { // want adventure?&lt;br /&gt;
            // FIXME need to add dialog box to accept/decline later&lt;br /&gt;
            ADVNAME=data1; // name of the adventure&lt;br /&gt;
            ADVTEXT=data2; // description of the adventure&lt;br /&gt;
            ADVTCOMP=[]; // clear the completed task list and start new one&lt;br /&gt;
            ADVTASKTODO=&amp;quot;&amp;quot;; // clear the next task name&lt;br /&gt;
            ADVTASKTDNUM=0; // clear the next task number&lt;br /&gt;
            llSay(CHANOBJBAM, API_ACCEPTADV + DIV +data1); // accept the adventure&lt;br /&gt;
            STATUS();&lt;br /&gt;
            return; // command done, return early&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // add the next task to complete&lt;br /&gt;
        if ( command == API_ADDTASK ) { // add a task&lt;br /&gt;
            ADVTASKTDNUM=(integer)data1; // next task number&lt;br /&gt;
            ADVTASKTODO=data2; // next task name&lt;br /&gt;
            llOwnerSay(ADVTASKTODO); // tell player the next task name&lt;br /&gt;
            STATUS();&lt;br /&gt;
            return; // command done, return early&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // add a hint for the next task to complete&lt;br /&gt;
        if( ( command == API_ADDHINT ) &amp;amp;&amp;amp; ( (integer)data1 == ADVTASKTDNUM) ) {&lt;br /&gt;
            ADVTASKTODOHINT=data2; // next task hint&lt;br /&gt;
            llOwnerSay(ADVTASKTODOHINT); // tell that player the next task hint&lt;br /&gt;
            STATUS();&lt;br /&gt;
            return; // command done, return early&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // is player done with this task of the adventure?&lt;br /&gt;
        if ( ( command == API_DONETASK ) &amp;amp;&amp;amp; ( (integer)data1 == ADVTASKTDNUM) ) {&lt;br /&gt;
            ADVTCOMP = [(integer)data1] + ADVTCOMP; // add this task number to completed list&lt;br /&gt;
            ADVTASKTDNUM=0; // clear out the task number we're working on since its done now&lt;br /&gt;
            ADVTASKTODO=&amp;quot;&amp;quot;; // clear out the task name&lt;br /&gt;
            ADVTASKTODOHINT=&amp;quot;&amp;quot;; // clear out the task hint&lt;br /&gt;
            llOwnerSay(data2); // tell player task is complete&lt;br /&gt;
            if ( data3 != &amp;quot;&amp;quot; ) llPlaySound(data3,0.5); // play sound if one was defined&lt;br /&gt;
            STATUS();&lt;br /&gt;
            return; // command done, return early&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // is player done with the entire adventure?&lt;br /&gt;
        if ( ( command == API_DONEADV ) &amp;amp;&amp;amp; ( data1 == ADVNAME ) ) {&lt;br /&gt;
            ADVTCOMP = []; // clear out adventure tasks - we're done&lt;br /&gt;
            ADVTASKTDNUM=0; // clear out next task number&lt;br /&gt;
            ADVTASKTODO=&amp;quot;&amp;quot;; // clear out name of next task&lt;br /&gt;
            ADVTASKTODOHINT=&amp;quot;&amp;quot;; // clear out next task hint&lt;br /&gt;
            ADVNAME=API_NONE; // set current adventure name to none&lt;br /&gt;
            ADVTEXT=&amp;quot;Looking for adventure...&amp;quot;; // set the current adventure name to&lt;br /&gt;
            llOwnerSay(data2); // tell player adventure is complete&lt;br /&gt;
            if ( data3 != &amp;quot;&amp;quot; ) llPlaySound(data3,0.5); // play sound if one was defined&lt;br /&gt;
            STATUS();&lt;br /&gt;
            return; // command done, return early&lt;br /&gt;
        }&lt;br /&gt;
    } // end link message&lt;br /&gt;
&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // STATE ENTRY - called on Reset&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        SETUP(); // show credits and start character sheet load&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    // TOUCH_START - touch HUD for adventure update&lt;br /&gt;
    //------------------------------------------------------------------------&lt;br /&gt;
    touch_start(integer total_number) {&lt;br /&gt;
        total_number = 0; // LSLINT&lt;br /&gt;
        STATUS();&lt;br /&gt;
    }&lt;br /&gt;
} // end state running&lt;br /&gt;
// END&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Allen Kerensky</name></author>	</entry>

	</feed>