<?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%2FModule_BAM</id>
		<title>User:Allen Kerensky/Myriad Lite Preview 5/Module BAM - 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%2FModule_BAM"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Module_BAM&amp;action=history"/>
		<updated>2026-05-16T02:30:40Z</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/Module_BAM&amp;diff=27315&amp;oldid=prev</id>
		<title>Allen Kerensky: moved User:Allen Kerensky:Myriad Lite Preview 5:Module BAM to User:Allen Kerensky/Myriad Lite Preview 5/Module BAM: move into subsite</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Allen_Kerensky/Myriad_Lite_Preview_5/Module_BAM&amp;diff=27315&amp;oldid=prev"/>
				<updated>2012-02-06T22:31:45Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/wiki/User:Allen_Kerensky:Myriad_Lite_Preview_5:Module_BAM&quot; class=&quot;mw-redirect&quot; title=&quot;User:Allen Kerensky:Myriad Lite Preview 5:Module BAM&quot;&gt;User:Allen Kerensky:Myriad Lite Preview 5:Module BAM&lt;/a&gt; to &lt;a href=&quot;/wiki/User:Allen_Kerensky/Myriad_Lite_Preview_5/Module_BAM&quot; title=&quot;User:Allen Kerensky/Myriad Lite Preview 5/Module BAM&quot;&gt;User:Allen Kerensky/Myriad Lite Preview 5/Module BAM&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:31, 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/Module_BAM&amp;diff=27191&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/Module_BAM&amp;diff=27191&amp;oldid=prev"/>
				<updated>2012-02-06T16:41:49Z</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 Module: BAM =&lt;br /&gt;
&lt;br /&gt;
The Myriad Lite Module BAM script goes into the [[User:Allen_Kerensky:Myriad_Lite_Preview_5:Myriad_Lite|Myriad Lite]] HUD.&lt;br /&gt;
&lt;br /&gt;
See the [[User:Allen_Kerensky:Myriad_Lite_Preview_5:Commands|Commands]] for how to use BAM commands.&lt;br /&gt;
&lt;br /&gt;
More information such as API messages will be in a later Preview release.&lt;br /&gt;
&lt;br /&gt;
== Myriad_Lite_Module_BAM-v0.0.2-20120201.lsl ==&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
// Myriad_Lite_Module_BAM-v0.0.2-20120201.lsl&lt;br /&gt;
// Copyright (c) 2011-2012 By Baroun Tardis (OSG/SL) and Allen Kerensky (OSG/SL)&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-2012 by Allen Kerensky (OSG/SL)&lt;br /&gt;
// Baroun's Adventure Machine Copyright (c) 2008-2011 by Baroun Tardis (SL)&lt;br /&gt;
// Myriad Lite and Baroun's Adventure Machine 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;
// You must agree to the terms of this license before making any use of this software.&lt;br /&gt;
// If you do not agree to this license, simply delete these materials.&lt;br /&gt;
// There is no warranty, express or implied, for your use of these materials.&lt;br /&gt;
&lt;br /&gt;
// CONSTANTS - DO NOT CHANGE DURING RUN&lt;br /&gt;
//string VERSION = &amp;quot;0.0.2&amp;quot;; // Allen Kerensky's script version&lt;br /&gt;
//string VERSIONDATE = &amp;quot;20120201&amp;quot;; // Allen Kerensky's script yyyymmdd&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;
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;
&lt;br /&gt;
// SETUP - begin bringing the HUD online&lt;br /&gt;
SETUP() {&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;
// 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;
// GLOBAL STATUS() - update adventure data on HUD&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;
// DEFAULT STATE - load character sheet&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 character sheet load&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // ON_REZ - logged in with meter, or worn from inventory while running&lt;br /&gt;
    on_rez(integer param) {&lt;br /&gt;
        param = 0; // LSLINT&lt;br /&gt;
        RESET(); // a reset to reload character&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // ATTACH - logged in with meter or worn from inventory/ground while running&lt;br /&gt;
    attach(key id) {&lt;br /&gt;
        id = NULL_KEY; // LSLINT&lt;br /&gt;
        RESET(); // a reset to reload character&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // TOUCH_START - touch HUD for adventure update&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;
&lt;br /&gt;
    // LINK MESSAGE - commands to and from other prims in HUD&lt;br /&gt;
    link_message(integer sender,integer channel,string message, key speakerid) {&lt;br /&gt;
        sender = 0; // LSLINT&lt;br /&gt;
        channel = 0; // LSLINT&lt;br /&gt;
        if ( message == &amp;quot;BAMSTATUS&amp;quot; ) { STATUS(); return;} // show status when specifically requested&lt;br /&gt;
        if ( message == &amp;quot;BAMRESET&amp;quot; ) { RESET(); return;} // reset on command&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;
        // 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;
        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 listen&lt;br /&gt;
} // end state running&lt;br /&gt;
// END&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Allen Kerensky</name></author>	</entry>

	</feed>