User:Allen Kerensky/Myriad Lite Preview 5/Narrator

From OpenSimulator

< User:Allen Kerensky | Myriad Lite Preview 5
Revision as of 11:05, 6 February 2012 by Allen Kerensky (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Myriad Lite Narrator

The Narrator can provide background setting details for roleplay areas in your region.

The best narrators are those which describe things that players would know in-character from being in that region, but that are not obvious from looking around.

For example, you can link areas together using directional descriptions such as "to the north, you see <building name they would not know just walking by>

Narrators are also virtual sign posts, providing a common street and location naming scheme for your region when modern-style street signs are not present.

Setup

  1. Create a 10.0m x 10.0m x 0.5m prim from a cube.
  2. Set it 2% transparent so you can see it with CTRL-ALT-T
  3. Set the texture to DEFAULT TRANS
  4. Drop in the Myriad Lite Narrator script
  5. Customize the script variables in the "CUSTOMIZE THIS" section
  6. (optional) Wear a Myriad Lite HUD
  7. Step into the prim to see the narration description
  8. Step out of the prim, and back in to verify that the narrator does not spam a second message to you

RPEVENT_FLAG

If you set RPEVENT_FLAG false, then Narrators can be used in your region without a Myriad Lite HUD, to provide region information to all visitors.

If you want to encourage your region visitors to also use the Myriad Lite HUD and be part of the full game system, leave RPEVENT_FLAG true to only show narration to players with an active HUD.

FIXME - need to add a prompt when RPEVENT_FLAG true to encourage HUDless visitors to get a HUD. Currently ignores them.

Myriad_Lite_Narrator-v0.0.8-20120202.lsl

// Myriad_Lite_Narrator-v0.0.8-20120202.lsl
// Copyright (c) 2012 By Allen Kerensky (OSG/SL)
// The Myriad RPG System was designed, written, and illustrated by Ashok Desai
// Myriad RPG licensed under the Creative Commons Attribution 2.0 UK: England and Wales
// http://creativecommons.org/licenses/by/2.0/uk/
// Myriad Lite software Copyright (c) 2011-2012 by Allen Kerensky (OSG/SL)
// Baroun's Adventure Machine Copyright (c) 2008-2011 by Baroun Tardis (SL)
// Myriad Lite and Baroun's Adventure Machine licensed under the
// Creative Commons Attribution-Share Alike-Non-Commercial 3.0 Unported
// http://creativecommons.org/licenses/by-nc-sa/3.0/
// You must agree to the terms of this license before making any use of this software.
// If you do not agree to this license, simply delete these materials.
// There is no warranty, express or implied, for your use of these materials.

// GLOBALS - CUSTOMIZE THESE IN SETUP() FUNCTION
string MESSAGE; // the description
integer BECOME_PHANTOM; // become phantom, such as an area detect, or stay non-phantom such as when used in floor prim?
integer IGNORE_OBJECTS; // do not send narration to objects (like bullets!) which blunder in
integer RPEVENT_FLAG; // send as Myriad Lite RP event, or as play Say into local chat? HINT - make secrets just for HUD users and public tour stuff for everyone

// GLOBAL RUNTIME variables which change as the script runs
list agents; // list of UUIDs active in sim
key agent_key; // key of who we're narrating to
integer dynachan; // temporary place to calculate the player dynamic channel

// MYRIAD LITE MESSAGE REFERENCE
// CHANPLAYER - OUT - RPEVENT|narrationtext

default {
    state_entry() {
        MESSAGE = "(ENCOUNTER AREA SHORT NAME) Longer description of two to three sentences explaining what anyone in this location could see or deduce. Good descriptions include going around the cardinal directions, such as: To the north you see, to the east you see, to the west you see, etc. Also, including some roleplaying clues, setting history, or backstory here can help bring your region to life.";
        BECOME_PHANTOM = TRUE; // become phantom, such as an area detect, or stay non-phantom such as when used in floor prim?
        IGNORE_OBJECTS = TRUE; // do not send narration to objects (like bullets!) which blunder in
        RPEVENT_FLAG = TRUE; // send as Myriad Lite RP event, or as play Say into local chat? HINT - make secrets just for HUD users and         
        agents = []; // start with an empty list of who we've shown the narration to
        if ( BECOME_PHANTOM == TRUE ) { //if we're not in a floor prim
            llVolumeDetect(TRUE); // set us up to detect collisions with the prim volume
        } else {
            llVolumeDetect(FALSE); // only detect collisions when run into, rather than through
        }
    }
    
    on_rez(integer params) {
        params = 0; // LSLINT
        llResetScript(); // on rez, reset the script from the top
    }
    
    collision_start(integer detected) {        
        while ( detected-- ) {
            agent_key = llDetectedKey(detected); // who hit us?
            if ( IGNORE_OBJECTS == TRUE && llGetOwnerKey(agent_key) != agent_key ) return; // ignoring objects
            if ( llListFindList(agents,[agent_key]) == -1 ) { // does this key already appear in agents list?
                if ( llGetFreeMemory() <= 256 ) { // is memory low?
                    agents = []; // free some memory by emptying agents list
                }
                agents = [agent_key] + agents; // add this agent
                if ( RPEVENT_FLAG == TRUE ) { // say as Myriad Lite RP event, or plain local chat say?
                    dynachan = (integer)("0x"+llGetSubString(agent_key,0,6)); // calculate avatar's dynamic HUD channel
                    llSay(dynachan,"RPEVENT|"+MESSAGE); // send them the narration as an RP event
                } else {
                    llSay(PUBLIC_CHANNEL,MESSAGE); // say to anyone, HUD or not
                }
            }
        }
    }
}

General
About This Wiki