Difference between revisions of "User:Fred Gandt/Scripts/Continued 2"

From Second Life Wiki
Jump to navigation Jump to search
(→‎Swingin' Door: Squished a bug or two and added a feature. Full breakdown of config options to follow (still debugging).)
(a couple of improvements and a major fix to the game script)
 
(58 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{LSL Header}}
{{User:Fred Gandt/Template|content=
 
{{RightToc|right;}}
 
[[Image:FG_jpg.jpg|thumb|left]]
 
== My Contributions ==
 
=== Other Pages ===
 
'''[[User:Fred_Gandt/Scripts| Free Scripts]]'''
 
'''[[User:Fred_Gandt/Scripts/Continued_1| More Free Scripts]]'''
 
=== Legal Stuff ===
 
'''[[Project:Contribution Agreement| The legal stuff about contributing to this wiki (worth reading).]]'''
 
== Tuition ==
 
'''[[User:Fred_Gandt/Tuition| Tuition scripts, notes, videos and screenshots etc.]]''' (hardly any content yet)


== Free Scripts ==
== Free Scripts ==
=== Online Status Display & Pager ===
=== Online Status Display & Pager ===


'''This will display the owners profile picture and a color coded and text texture sign that changes depending on the owners online status.'''
This will display the owners profile picture and a color coded and text texture sign that changes depending on the owners online status.


'''Just drop the script into a fresh prim.'''
Just drop the script into a fresh prim.


<lsl>key owner_id;
<syntaxhighlight lang="lsl2">// V1 //


string owner_name;
key owner_id; // Use to store the UUID of the owner to save having to keep asking.
string owner_name; // Use to store the name of the owner to save having to keep asking.


// This a UUID of a texture I created to show either the word "ONLINE" or "OFFLINE".
key ON_OFF_line = "124cfcec-6b8d-552c-42b8-6a1179884e74";
key ON_OFF_line = "124cfcec-6b8d-552c-42b8-6a1179884e74";


// This is added to the owner UUID to make an HTTP request for the owners profile image UUID.
string profile_url = "http://world.secondlife.com/resident/";
string profile_url = "http://world.secondlife.com/resident/";


key name_id;
key name_id; // This key is used to recognize the dataserver request if it is for the name of the owner.
key online_id; // This key is used to recognize the dataserver request if it is made automatically.
key touch_request_id; // This key is used to recognize the dataserver request if it is made by a user.


key online_id;
key update_id; // Used to verify that the HTTP request is for an update of the profile texture.
integer lis; // This is used to store the value of a listen and to remove it when not needed.
integer channel; // This is used to store the value of the listen channel.
key requester; // This is used to store the name of a user who asks to page the owner.


key touch_request_id;
string date; // Used to store the date (just in case you couldn't guess).
 
integer lis;
OnlineStatus(integer ol, integer tr) // This function carries two integer type pieces of info.
 
{ // integer ol is the the boolean online data. 1 for online and zero for offline.
integer channel;
  // integer tr is also boolean. It carries whether the function is being called by a user or automatically.
 
     list ol_params = []; // This is a local list creation.
key requester;
     if(ol) // If the owner is online...
 
     ol_params = [17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.375,0.0>, (90*DEG_TO_RAD), // ..list the object parameters for displaying ONLINE.
OnlineStatus(integer ol, integer tr)
{
     list ol_params = [];
     if(ol)
     ol_params = [17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.375,0.0>, (90*DEG_TO_RAD),
                 18, 5, <0.0,1.0,0.0>, 1.0,
                 18, 5, <0.0,1.0,0.0>, 1.0,
                 18, 6, <1.0,1.0,1.0>, 1.0];
                 18, 6, <1.0,1.0,1.0>, 1.0];
     else
     else // If not...
     ol_params = [17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.625,0.0>, (90*DEG_TO_RAD),
     ol_params = [17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.625,0.0>, (90*DEG_TO_RAD), // ..list the object parameters for displaying OFFLINE.
                 18, 5, <1.0,0.0,0.0>, 1.0,
                 18, 5, <1.0,0.0,0.0>, 1.0,
                 18, 6, <0.5,0.5,0.5>, 1.0];
                 18, 6, <0.5,0.5,0.5>, 1.0];
     llSetPrimitiveParams(ol_params);
     llSetPrimitiveParams(ol_params); // Set the object parameters to show whatever the list is.
     if(tr)
     if(tr) // If this was a touch request...
     {
     {
         llSetTimerEvent(30.0);
         llSetTimerEvent(30.0); // Prepare to be ignored (we need to switch the listen off if we are ignored).
         if(ol)
         if(ol) // If the owner is online...
         {
         {
             lis = llListen(channel, "", requester, "");
             lis = llListen(channel, "", requester, ""); // Open a listen for the user who made the request.
             llDialog(requester, ("\nWould you like to page " + owner_name + "?"), ["YES", "NO"], channel);
             llDialog(requester, ("\nWould you like to page " + owner_name + "?"), ["YES", "NO"], channel); // Send them a dialog.
         }
         }
         else
         else // If not...
         llInstantMessage(requester, (owner_name + " is currently offline."));
         llInstantMessage(requester, (owner_name + " is currently offline.")); // Send a message explaining that the owner is offline.
     }
     }
}
}
 
default
default // Create an area for the events to play in. This is called a "state".
{
{
     state_entry()
     state_entry() // On state entry...
     {
     {
         owner_id = llGetOwner();
         owner_id = llGetOwner(); // Get the owner UUID (key) and store it.
         name_id = llRequestAgentData(owner_id, DATA_NAME);
         name_id = llRequestAgentData(owner_id, DATA_NAME); // Make a request for the owners name.
         channel = -5647;
         channel = -5647; // Set a channel to use for the dialog.
     }
     }
     dataserver(key q, string data)
     dataserver(key q, string data) // Triggered when a reply to a data request is recieved.
     {
     {
         if(q == name_id)
         if(q == name_id) // Check the id of the request.
         {
         {
             owner_name = data;
             owner_name = data; // Store the result.
             llSetObjectName(owner_name + "'s Online Status");
             llSetObjectName(owner_name + "'s Online Status"); // Set the name of the object to the owner name + "'s Online Status".
             llHTTPRequest((profile_url + ((string)owner_id)), [], "");
             llHTTPRequest((profile_url + ((string)owner_id)), [], ""); // Request the UUID of the owners profile.
         }
         }
         else if(q == online_id)
         else if(q == online_id) // Check the id of the request.
         OnlineStatus(((integer)data), FALSE);
         OnlineStatus(((integer)data), FALSE); // Call the OnlineStatus function for an automatic return.
         else if(q == touch_request_id)
         else if(q == touch_request_id) // Check the id of the request.
         OnlineStatus(((integer)data), TRUE);
         OnlineStatus(((integer)data), TRUE); // Call the OnlineStatus function for a touch-by-user return.
     }
     }
     http_response(key q, integer status, list metadata, string body)
     http_response(key q, integer status, list metadata, string body) // Triggered when a response for an HTTP request is recieved.
     {
     {
         integer tex_key_start = (llSubStringIndex(body, "imageid") + 18);
         integer tex_key_start = (llSubStringIndex(body, "imageid") + 18); // Establish the point where the image UUID is written in the page.
         integer tex_key_end = (tex_key_start + 35);
         integer tex_key_end = (tex_key_start + 35); // Establish the point where the image UUID ends.
         key profile_image = ((key)llGetSubString(body, tex_key_start, tex_key_end));
         key profile_image = ((key)llGetSubString(body, tex_key_start, tex_key_end)); // Store the the profile image UUID found.
         llSetPrimitiveParams([9, 0, 0, <0.6,0.875,0.0>, 0.02, ZERO_VECTOR, <1.0,1.0,0.0>, ZERO_VECTOR,
        if(q != update_id) // Check the source of the request.
                              8, llEuler2Rot(<0.0,90.0,0.0>*DEG_TO_RAD),
         {
                              7, <0.85,0.01,0.6>,
            llSetPrimitiveParams([9, 0, 0, <0.6,0.875,0.0>, 0.02, ZERO_VECTOR, <1.0,1.0,0.0>, ZERO_VECTOR, // Shape the object...
                              17, -1, TEXTURE_BLANK, <1.0,1.0,0.0>, ZERO_VECTOR, 0.0,
                                  8, llEuler2Rot(<0.0,90.0,0.0>*DEG_TO_RAD),
                              18, -1, ZERO_VECTOR, 1.0]);
                                  7, <0.85,0.01,0.6>,
        llSetPrimitiveParams([17, 6, profile_image, <1.0,1.0,0.0>, ZERO_VECTOR, (90*DEG_TO_RAD),
                                  17, -1, TEXTURE_BLANK, <1.0,1.0,0.0>, ZERO_VECTOR, 0.0,
                              17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.375,0.0>, (90*DEG_TO_RAD),
                                  18, -1, ZERO_VECTOR, 1.0]); // ...and texture it with the owners profile image and...
                              19, 5, 0, 1,
            llSetPrimitiveParams([17, 6, profile_image, <1.0,1.0,0.0>, ZERO_VECTOR, (90*DEG_TO_RAD),
                              18, 6, <1.0,1.0,1.0>, 1.0,
                                  17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.375,0.0>, (90*DEG_TO_RAD), // the ON/OFFline texture.
                              18, 5, <0.0,1.0,0.0>, 1.0,
                                  19, 5, 0, 1,
                              20, 5, 1,
                                  18, 6, <1.0,1.0,1.0>, 1.0,
                              20, 6, 1]);
                                  18, 5, <0.0,1.0,0.0>, 1.0,
        llSetTimerEvent(0.1);
                                  20, 5, 1,
                                  20, 6, 1]);
            llSetTimerEvent(0.1); // Move to the timer quickly to run the first OnlineStatus check.
        }
        else
        llSetPrimitiveParams([17, 6, profile_image, <1.0,1.0,0.0>, ZERO_VECTOR, (90*DEG_TO_RAD)]); // Apply the updated profile texture.
     }
     }
     timer()
     timer() // Triggered if a timer event is set to a non zero amount.
     {
     {
         llListenRemove(lis);
        llSetTimerEvent(10.0); // Reset the timer event to trigger every 10 seconds.
         llSetTimerEvent(10.0);
         llListenRemove(lis); // Always remove any listen we have open.
         online_id = llRequestAgentData(owner_id, DATA_ONLINE);
         online_id = llRequestAgentData(owner_id, DATA_ONLINE); // So every 10 seconds we check if the owner is online.
        string t_date = llGetDate(); // Find out what the date is.
         if(t_date != date) // Check if the date has changed. If it has...
        {
            date = t_date; // ...store the date so the next check to return true will be roughly 24 hours later.
            update_id = llHTTPRequest((profile_url + ((string)owner_id)), [], ""); // Request an update of the UUID of the owners profile.
        }
     }
     }
     touch_start(integer nd)
     touch_start(integer nd) // Triggered on clicking the object that contains the script.
     {
     {
         llSetTimerEvent(0.0);
         llSetTimerEvent(0.0); // Stop the timer.
         requester = llDetectedKey(0);
         requester = llDetectedKey(0); // Store the UUID of the person who touched us.
         touch_request_id = llRequestAgentData(owner_id, DATA_ONLINE);
         touch_request_id = llRequestAgentData(owner_id, DATA_ONLINE); // Request the online status of the owner before issuing any dialogs.
     }
     } // We do this becuse if the owner went offline 9 seconds ago we wouldn't know.
     listen(integer chan, string name, key id, string msg)
     listen(integer chan, string name, key id, string msg) // Triggered when all the specified info is recieved by the script if it has a listen open.
     {
     {
         llListenRemove(lis);
         llListenRemove(lis); // Remove the listen.
         llSetTimerEvent(10.0);
         llSetTimerEvent(10.0); // Set the timer to run automatically.
         if(msg == "YES")
         if(msg == "YES") // If the toucher wants to page the owner (the owner must be online)...
         {
         { // Instant message the owner with a link that when clicked will bring up the touchers profile. This saves searching for the touchers profile.
             llInstantMessage(owner_id, ("secondlife:///app/agent/" + ((string)requester) + "/about has requested to message you."));
             llInstantMessage(owner_id, ("secondlife:///app/agent/" + ((string)requester) + "/about has requested to message you."));
             llInstantMessage(requester, owner_name + " has been paged.");
             llInstantMessage(requester, owner_name + " has been paged."); // Inform the toucher that the owner has been paged.
         }
         }
     }
     }
}</lsl>
}</syntaxhighlight>


=== Swingin' Door ===
=== What's my Build? ===
A simple but fun game for groups to play. Players take turns building their interpretation of a suggested word or phrase, then the other players make guesses in local chat until one is correct. The player who correctly guesses what is being built becomes the new builder and the game continues.


'''I have tested this roughly and there are a couple of little bumps in it. I'll heat up the steam iron...'''
* Up to 9 notecards containing lists of words or phrases can be added.
* Each time a notecard is chosen, the order in which the words will be used is randomized.
** One word or phrase per line. [[llGetNotecardLine#Caveats|Single lines should not exceed 255 bytes]].
** No empty lines.
** Add alternative spellings (''i.e.'' "colour" and "color") or meanings (''i.e.'' "truck", "lorry" and "van") together on the same line, separated by pipes (this is a pipe --> "{{!}}").
** Punctuation listed in the script will be stripped from the words and phrases.
*** Unfortunately, LSL has no [https://en.wikipedia.org/wiki/Regular_expression RegEx] and as such it is impractical to except alternatives that aren't explicitly added to the cards. An LSL parser capable of regex like deduction would be horrible, so without utilising a remote server (a possible update), the alternatives need to cover everything reasonable to expect. There is an option for the owner to  be told the word or phrase being built (after which they will be excluded from that round), and it's recommended if the script is reading from a card containing potentially contentious phrases with many possible alternatives.
** Apostrophes are also stripped.
* Menu operated from touch.


'''I will add notes and guidance soon too. Basically this is a link or unlink, rotate or don't super robust swinging door script.'''
<syntaxhighlight lang="lsl2">// V2 //


'''Although this is far more featured than you might imagine the one thing you need to know to get full use is to include a notecard in the doors something like the example below. More detailed explanation will come soon.'''
key owner;
key nc_line_id;
key num_of_nc_lines_id;
key current_builder = NULL_KEY;


<lsl>Whitelist
integer query_id;
Fred Gandt
integer num_of_ncs;
Elmer Fudd
integer private_listen_id;
Rank Xerox
integer public_listen_id;
Blacklist
integer line_index;
The Joker
integer owner_knows;
Miss Crabapple
 
M Linden</lsl><lsl>// Don't fiddle with the contents of this script unless you know what you're doing.
string notecard;
// I designed it to be dragged and dropped into a fresh prim.
string current_word;
// Touch and hold until a blue drop-down dialog shows for config options.
string word_or_phrase;
 
list notecards;
list dialog_list;
list shuffled_line_numbers;
list current_alts;
list punctuation = [ ".", ",", "!", "?", ";", ":", "-", "\"" ]; // Must not contain pipes --> |
 
integer frequency() {
    return ( integer )( llFrand( -1073741824.0 ) - 1073741824.0 );
}


list angle_list = ["210", "240", "270", "120", "150", "180", "30", "60", "90"];
removeListen( integer id ) {
    llListenRemove( id );
key LL_Brazillian_Rosewood = "a25bebc8-4739-453d-d44e-fc522cf95488";
    if ( id == private_listen_id ) {
        llSetTimerEvent( 0.0 );
list time_list = ["16", "18", "20","10", "12", "14", "4", "6", "8"];
    }
}
key Door_Opening = "99236139-075b-3057-7c6f-0f68bb2af001";
key Door_Closing = "43e46041-25fa-0a03-7be8-78297f579d53";
key Doorbell = "213aae54-6093-7fcc-118f-3039a5435986";
integer notecard_length;
integer sound_on = TRUE;
string dia_msg = "\n";
list dia_buttons = [];
list whitelist = [];
list blacklist = [];
float angle = 90.0;
integer count_NCL;
string owner_name;
float time = 6.0;
integer dia_chan;
integer dia_lis;
integer t_count;
integer global;
integer locked;
integer group;


integer local;
ownerDialog( string msg ) {
     integer channel = frequency();
integer IGAN;
     if ( msg == "" ) {
         msg = "Select a notecard, hear the current " + word_or_phrase + " or reset the game.";
integer dead;
integer open;
integer nop;
key bell_id;
integer mln;
integer ot;
string NCN;
key owner;
key NoNL;
key NCK;
key OLC;
key NL;
OperateDoor(integer o, integer lm)
{
     if(nop >= 2 && (!lm))
    llMessageLinked(LINK_ALL_OTHERS, dia_chan, owner_name, owner);
     if(sound_on)
    {
         key door_sound;
        if(o)
        door_sound = Door_Closing;
        else
        door_sound = Door_Opening;
        llPlaySound(door_sound, 1.0);
     }
     }
     vector v = (llRot2Euler(llGetLocalRot())*RAD_TO_DEG);
     private_listen_id = llListen( channel, llKey2Name( owner ), owner, "" );
     float x = llFabs(v.x);
     llDialog( owner, "\n" + msg, [ "CANCEL", llList2String( [ "START", "TELL" ], current_word != "" ), "RESET" ] + dialog_list, channel );
     float z = v.z;
     llSetTimerEvent( 20.0 );
     float d;
}
    if(x < 1.0)
 
     d = 1.0;
builderDialog( string msg ) {
    else
     llDialog( current_builder, "\n" + msg, [], frequency() );
     d = -1.0;
}
    float a = angle;
 
     if(o)
publicListen() {
    {
     public_listen_id = llListen( PUBLIC_CHANNEL, "", "", "" );
         if(x < 1.0)
}
        d = -1.0;
 
        else
getLine() {
        d = 1.0;
     nc_line_id = llGetNotecardLine( notecard, llList2Integer( shuffled_line_numbers, --line_index ) );
        a = -angle;
     if ( !line_index ) {
        llSetTimerEvent(0.0);
         ownerDialog( "We've reached the end of the last notecard; please select another to continue." );
     }
     }
    else
    llSetTimerEvent(time);
    llTargetOmega(<0.0,0.0,d>, (angle/90.0), 1.0);
    llSleep(1.5);
    llTargetOmega(ZERO_VECTOR, 0.0, 0.0);
    llSetLocalRot(llEuler2Rot(<x,0.0,(z + a)>*DEG_TO_RAD));
    open = (!open);
}
}
 
TouchMeAllOver(key id, integer t, integer te)
announce( string str ) {
{
     llSay( PUBLIC_CHANNEL, str );
     if(t && id == owner)
}
    {
 
        ot = TRUE;
string agentName( key id ) {
        global = FALSE;
    string name = llGetDisplayName( id );
        local = FALSE;
    if ( name == "" ) {
        dia_msg = "\n\"Global\" - Instruct all doors linked to this.
         name = llKey2Name( id );
        \n\"Local\" - Instruct only locally linked doors.
        \n\"Self\" - Instruct only this door.";
        dia_buttons = ["Self", "Local", "CANCEL", "Global"];
        dia_lis = llListen(dia_chan, owner_name, owner, "");
         llDialog(owner, dia_msg, dia_buttons, dia_chan);
     }
     }
     if(te)
     return name;
     {
}
        if(t_count < 10)
 
        {
mia( integer index ) {
            if(!dead)
     removeListen( public_listen_id );
            {
    key temp_builder = current_builder;
                if(!Whitelist(id))
    string temp_word = current_word;
                {
    current_builder = NULL_KEY;
                    bell_id = id;
    current_word = "";
                    OLC = llRequestAgentData(owner, DATA_ONLINE);
    announce( llList2String( [ "The current builder", agentName( temp_builder ) ], index ) + " has " +
                    return;
              llList2String( [ "left the region", "given the game away" ], index ) +
                }  
              ", so a new builder must take their place by touching me.\nThe " + word_or_phrase + " was \"" + temp_word + "\"." );
            }
}
            else
 
             {
string trim( string str ) {
                 if(id != owner)
    return llStringTrim( str, STRING_TRIM );
                 return;
}
            }
 
            OperateDoor(open, FALSE);
string dL2S( list lst ) {
         }
    return llDumpList2String( lst, " " );
         t_count = 0;
}
 
string cleanString( string str ) {
    return llToLower(
        trim(
             llDumpList2String(
                 llParseString2List(
                    dL2S(
                        llParseString2List(
                            dL2S(
                                llParseString2List( str, punctuation, [] ) // Remove the listed punctuation.
                            ), // Replace it with spaces.
                        [ "  " ], [] ) // Remove double spaces.
                    ), // Replace them with single spaces.
                 [ "'" ], [] ), // Remove apostrophes.
            "" ) // Glue everything back together.
        ) // Trim leading and trailing whitespace.
    ); // Convert all to lower case.
}
 
list trimList( list lst ) {
    integer length = llGetListLength( lst );
    while ( length ) {
         --length;
         lst = llListReplaceList( lst, [ trim( llList2String( lst, length ) ) ], length, length );
     }
     }
    return lst;
}
integer ncNoBuilder() {
    return notecard != "" && current_builder == NULL_KEY;
}
}
 
integer Whitelist(key id)
start( key id ) {
{
     current_builder = id;
     integer w = TRUE;
     getLine();
     integer index;
}
     if(id == NULL_KEY)
 
    {
default {
         whitelist = [];
     on_rez( integer param ) {
        blacklist = [];
         llResetScript();
        count_NCL = 0;
    }
        NCN = llGetInventoryName(INVENTORY_NOTECARD, 0);
    changed( integer change ) {
         if(llStringLength(NCN))
         if ( change & ( CHANGED_OWNER | CHANGED_INVENTORY ) ) {
        {
             llResetScript();
             IGAN = TRUE;
            NCK = llGetInventoryKey(NCN);
            llMessageLinked(LINK_ALL_OTHERS, dia_chan, "IGAN", NCK);
            NoNL = llGetNumberOfNotecardLines(NCN);
         }
         }
         else
    }
         {
    state_entry() {
             IGAN = FALSE;
        owner = llGetOwner();
             if(nop > 1)
         num_of_ncs = llGetInventoryNumber( INVENTORY_NOTECARD );
            llMessageLinked(LINK_ALL_OTHERS, dia_chan, "IGAN", owner);
         if ( num_of_ncs ) {
             string nc;
             while ( num_of_ncs ) {
                notecards += [ nc = llGetInventoryName( INVENTORY_NOTECARD, --num_of_ncs ) ];
                dialog_list += [ llGetSubString( nc, 0, 23 ) ];
            }
            ownerDialog( "" );
         }
         }
     }
     }
     else
     touch_start( integer nd ) {
    {
         key toucher;
         if(id != owner)
         while ( nd ) {
         {
             toucher = llDetectedKey( --nd );
            if(locked)
            if ( toucher == owner ) {
             {
                 ownerDialog( "" );
                index = llListFindList(whitelist, [llKey2Name(id)]);
            } else if ( ncNoBuilder() ) {
                if(index == -1)
                start( toucher );
                 w = FALSE;
                if(group)
                {
                    if(!w)
                    {
                        if(llSameGroup(id))
                        w = TRUE;
                    }
                }
             }
             }
            index = llListFindList(blacklist, [llKey2Name(id)]);
            if(index != -1)
            w = FALSE;
         }
         }
     }
     }
    return w;
     listen( integer chan, string name, key id, string msg ) {
}
        if ( chan && id == owner ) {
            removeListen( private_listen_id );
GetCracking()
            if ( msg != "CANCEL" ) {
{
                integer index;
    owner = llGetOwner();
                if ( msg == "RESET" ) {
    dia_chan = (-1 * llAbs(((integer)("0x" + llGetSubString(((string)owner), -9, -3)))));
                    llResetScript();
    owner_name = llKey2Name(owner);
                 } else if ( msg == "START" ) {
    nop = llGetNumberOfPrims();
                    if ( notecard == "" ) {
    mln = llGetLinkNumber();
                        ownerDialog( "You need to select a notecard to play with first." );
}
                    } else if ( current_builder ) {
                        ownerDialog( llKey2Name( current_builder ) + " has already started the game." );
default
                    } else {
{
                        start( owner );
    on_rez(integer param)
                    }
    {
                 } else if ( msg == "TELL" ) {
        GetCracking();
                    owner_knows = TRUE;
        Whitelist(NULL_KEY);
                    llOwnerSay( "The " + word_or_phrase + " is currently: \"" + current_word + "\"" );
    }
                 } else if ( ~( index = llListFindList( dialog_list, [ msg ] ) ) ) {
    state_entry()
                    num_of_nc_lines_id = llGetNumberOfNotecardLines( notecard = llList2String( notecards, index ) );
    {
                 }
        GetCracking();
        vector pos = llGetPos();
        llSetPrimitiveParams([9, 0, 0, <0.125, 0.375, 0.0>, 0.0,ZERO_VECTOR, <1.0, 1.0, 0.0>, ZERO_VECTOR,
                              17, 0, LL_Brazillian_Rosewood, <2.0, 0.1, 0.0>, <0.5, 0.025, 0.0>, 0.0,
                              17, 1, LL_Brazillian_Rosewood, <2.0, 1.0, 0.0>, <0.5, 0.0, 0.0>, 0.0,
                              17, 2, LL_Brazillian_Rosewood, <0.05, 1.0, 0.0>, <0.0125, 0.0, 0.0>, 0.0,
                              17, 3, LL_Brazillian_Rosewood, <2.0, 0.1, 0.0>, <0.5, -0.025, 0.0>, 0.0,
                              17, 4, LL_Brazillian_Rosewood, <0.05, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                              17, 5, LL_Brazillian_Rosewood, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                              19,ALL_SIDES,1,13,
                              7, <3.0, 0.2, 3.0>]);
        Whitelist(NULL_KEY);
    }
     listen(integer chan, string name, key id, string msg)
    {
        llListenRemove(dia_lis);
        if(msg != "CANCEL")
        {
            if(msg == "Global" | msg == "Local" | msg == "Self")
            {
                if(msg == "Global")
                global = TRUE;
                 else if(msg == "Local")
                local = TRUE;
                dia_msg = "\nConfigure your doors.";
                dia_buttons = ["AutoClose", "CANCEL", "Angle"];
                if(sound_on)
                dia_buttons += ["SoundOff"];
                else
                dia_buttons += ["SoundOn"];
                 if(locked)
                dia_buttons += ["UnLock"];
                else
                dia_buttons += ["Lock"];
                if(group)
                dia_buttons += ["GroupOff"];
                else
                dia_buttons += ["GroupOn"];
                if(dead)
                dia_buttons += ["UnDead"];
                else
                dia_buttons += ["DeadLock"];
                if(global)
                llMessageLinked(LINK_ALL_OTHERS, dia_chan, "ALTT", owner);
                 else if(local)
                llMessageLinked(LINK_ALL_OTHERS, dia_chan, "LTT", owner);
                dia_lis = llListen(dia_chan, owner_name, owner, "");
                 llDialog(owner, dia_msg, dia_buttons, dia_chan);
             }
             }
             else if(msg == "SoundOff")
        } else {
            sound_on = FALSE;
             if ( llGetAgentSize( current_builder ) ) {
            else if(msg == "SoundOn")
                msg = cleanString( msg );
            sound_on = TRUE;
                integer alt_index;
            else if(msg == "UnLock")
                if ( msg == current_word || ( llGetListLength( current_alts ) && ~( alt_index = llListFindList( current_alts, [ msg ] ) ) ) ) {
            locked = FALSE;
                    if ( id != owner || ( id == owner && !owner_knows ) ) {
            else if(msg == "Lock")
                        if ( id != current_builder ) {
            locked = TRUE;
                            removeListen( public_listen_id );
            else if(msg == "GroupOff")
                            if ( ~alt_index ) {
            group = FALSE;
                                current_word = current_word + "\" by saying the acceptable alternative \"" + msg;
            else if(msg == "GroupOn")
                            }
            group = TRUE;
                            builderDialog( "The " + word_or_phrase + " you're building has been correctly guessed. Well done!" );
            else if(msg == "UnDead")
                            announce( agentName( current_builder = id ) + " has correctly guessed that the " + word_or_phrase + " being built was \"" + current_word + "\"." );
            dead = FALSE;
                            getLine();
            else if(msg == "DeadLock")
                         } else {
            dead = TRUE;
                            mia( 1 );
            else if(msg == "NoAuto")
                         }
            time = 0.0;
            else if(msg == "AutoClose" | msg == "Angle")
            {
                dia_lis = llListen(dia_chan, owner_name, owner, "");
                if(ot)
                {
                    ot = FALSE;
                    if(msg == "AutoClose")
                    {
                        dia_msg = "\nSelect the length of time to wait before auto closing or turn off auto closure.";
                        if(llRound(time))
                        dia_msg += ("\nThe time this door is set at is \"" + ((string)((integer)time)) + "\" seconds now.");
                        dia_buttons = ["NoAuto", "-", "CANCEL"];
                         dia_buttons += time_list;
                    }
                    else
                    {
                        dia_msg = ("\nSelect the degree of travel for your doors.\nThis door is set at \"" + ((string)angle) + "\" now.");
                         dia_buttons = ["-", "CANCEL", "-"];
                        dia_buttons += angle_list;
                     }
                     }
                    llDialog(owner, dia_msg, dia_buttons, dia_chan);
                 }
                 }
             }
             } else {
            else if(msg != "-")
                 mia( 0 );
            {
                 float m = ((float)msg);
                if(m > 20.0)
                angle = m;
                else
                time = m;
             }
             }
         }
         }
     }
     }
     dataserver(key q, string data)
     dataserver( key id, string data ) {
    {
         if ( id == num_of_nc_lines_id ) {
         if(q == NoNL)
             integer num_of_nc_lines = ( integer )data;
        {
             line_index = num_of_nc_lines;
             notecard_length = ((integer)data);
             while ( num_of_nc_lines ) {
             NL = llGetNotecardLine(NCN, count_NCL);
                 shuffled_line_numbers += [ --num_of_nc_lines ];
        }
        else if(q == NL)
        {
            if(data != EOF)
            whitelist += [data];
             if(count_NCL < notecard_length)
            NL = llGetNotecardLine(NCN, (++count_NCL));
            else
            {
                 integer index = llListFindList(whitelist, ["blacklist"]);
                blacklist = llList2List(whitelist, index, -1);
                whitelist = llDeleteSubList(whitelist, index, -1);
             }
             }
        }
            shuffled_line_numbers = llListRandomize( shuffled_line_numbers, 1 );
        else if(q == OLC)
             if ( ncNoBuilder() ) {
        {
                 announce( "Will the first builder please start the game by touching me?" );
             if(((integer)data))
            {
                 llPlaySound(Doorbell, 1.0);
                llInstantMessage(owner, (llKey2Name(bell_id) + " is at the door"));
             }
             }
         }
         } else if ( id == nc_line_id ) {
    }
            owner_knows = FALSE;
    link_message(integer sender, integer num, string str, key id)
            current_alts = trimList( llParseString2List( data = cleanString( data ), [ "|" ], [] ) );
    {
             if ( llGetListLength( current_alts ) > 1 ) {
        if(str != "IGAN")
                 current_word = llList2String( current_alts, 0 );
        {
                 current_alts = llList2List( current_alts, 1, -1 );
             if(sender == (mln + 1) | sender == (mln - 1))
            } else {
            {
                 current_word = data;
                 if(num == dia_chan && str == owner_name && id == owner)
                 current_alts = [];
                 OperateDoor(open, TRUE);
                 else if(num == dia_chan && str == "LTT" && id == owner)
                 dia_lis = llListen(dia_chan, owner_name, owner, "");
             }
             }
             if(num == dia_chan && str == "ALTT" && id == owner)
             if ( ~llSubStringIndex( current_word, " " ) ) {
            dia_lis = llListen(dia_chan, owner_name, owner, "");
                word_or_phrase = "phrase";
        }
            } else {
        else
                word_or_phrase = "word";
        {
            if(num == dia_chan && id == owner)
            {
                if(IGAN)
                llMessageLinked(LINK_ALL_OTHERS, dia_chan, "IGAN", NCK);
             }
             }
             else
             if ( llGetAgentSize( current_builder ) ) {
            {
                 builderDialog( "Build your interpretation of the " + word_or_phrase + ":\n\n\"" + current_word + "\"." );
                 NCN = ((string)id);
                 publicListen();
                 whitelist = [];
                 announce( agentName( current_builder ) + " has been told the current " + word_or_phrase + " and should start their build now." );
                 blacklist = [];
            } else {
                count_NCL = 0;
                 mia( 0 );
                 NoNL = llGetNumberOfNotecardLines(NCN);
             }
             }
        }       
    }
    touch(integer nd)
    {
        ++t_count;
        if(t_count >= 10)
        {
            key id = llDetectedKey(0);
            TouchMeAllOver(id, TRUE, FALSE);
         }
         }
     }
     }
     touch_end(integer nd)
     timer() {
    {
         removeListen( private_listen_id );
         key id = llDetectedKey(0);
        TouchMeAllOver(id, FALSE, TRUE);
     }
     }
    timer()
}</syntaxhighlight>
    {
 
        llSetTimerEvent(0.0);
==== Example Notecards ====
        ot = FALSE;
===== Words (no alts) =====
        llListenRemove(dia_lis);
Copied from a list found at [http://www.manythings.org/vocabulary/lists/l/words.php?f=ogden-picturable manythings.org].
        OperateDoor(open, FALSE);
* Alternatives should be added per the instructions above.
<pre>angle
    }
ant
    changed(integer change)
apple
    {
arch
        if(change & CHANGED_INVENTORY)
arm
        {
army
            IGAN = FALSE;
baby
            Whitelist(NULL_KEY);
bag
        }
ball
        if(change & CHANGED_LINK)
band
        {
basin
            llSleep(2.0);
basket
            nop = llGetNumberOfPrims();
bath
            mln = llGetLinkNumber();
bed
            Whitelist(NULL_KEY);
bee
        }
bell
    }
berry
}</lsl>
bird
blade
board
boat
bone
book
boot
bottle
box
boy
brain
brake
branch
brick
bridge
brush
bucket
bulb
button
cake
camera
card
cart
carriage
cat
chain
cheese
chest
chin
church
circle
clock
cloud
coat
collar
comb
cord
cow
cup
curtain
cushion
dog
door
drain
drawer
dress
drop
ear
egg
engine
eye
face
farm
feather
finger
fish
flag
floor
fly
foot
fork
fowl
frame
garden
girl
glove
goat
gun
hair
hammer
hand
hat
head
heart
hook
horn
horse
hospital
house
island
jewel
kettle
key
knee
knife
knot
leaf
leg
library
line
lip
lock
map
match
monkey
moon
mouth
muscle
nail
neck
needle
nerve
net
nose
nut
office
orange
oven
parcel
pen
pencil
picture
pig
pin
pipe
plane
plate
plow
pocket
pot
potato
prison
pump
rail
rat
receipt
ring
rod
roof
root
sail
school
scissors
screw
seed
sheep
shelf
ship
shirt
shoe
skin
skirt
snake
sock
spade
sponge
spoon
spring
square
stamp
star
station
stem
stick
stocking
stomach
store
street
sun
table
tail
thread
throat
thumb
ticket
toe
tongue
tooth
town
train
tray
tree
trousers
umbrella
wall
watch
wheel
whip
whistle
window
wing
wire
worm</pre>
 
===== Phrases (with alts) =====
Extensively reworked from a list found at [http://www.phrases.org.uk/meanings/phrases-and-sayings-list.html phrases.org.uk].
<pre>a bird in the hand is worth two in the bush
drop in the ocean | a drop in the ocean
fly in the ointment | a fly in the ointment
no-brainer | a no-brainer
pig in a poke | a pig in a poke
a place for everything and everything in its place
sight for sore eyes | a sight for sore eyes
stone's throw | a stone's throw
turn up for the books | a turn up for the books
wolf in sheep's clothing | a wolf in sheep's clothing
a woman needs a man like a fish needs a bicycle
two peas in a pod | alike as two peas in a pod | like two peas in a pod
alive and kicking | alive and kickin'
fingers and thumbs | all fingers and thumbs
all that glitters is not gold | all that glisters is not gold
all things come to he who waits | all thing come to those who wait | all thing come to those that wait
all things must pass
an apple a day keeps the doctor away
arm and a leg | an arm and a leg | costs an arm and a leg | it costs an arm and a leg
axe to grind | an axe to grind | one has an axe to grind | i have an axe to grind | you have an axe to grind
englishman's home is his castle | an englishman's home is his castle
ill wind | an ill wind | an ill wind bloweth | an ill wind that blows
apple of my eye | the apple of my eye
bald as a coot | as bald as a coot
brown as a berry | as brown as a berry
cool as a cucumber | as cool as a cucumber
daft as a brush | as daft as a brush
dead as a dodo | as dead as a dodo
dead as a doornail | as dead as a doornail
easy as pie | as easy as pie
grease lightning | greased lightning | fast as greased lightning | as fast as greased lightning
fit as a fiddle | as fit as a fiddle
mad as a hatter | as mad as a hatter
pure as the driven snow | as pure as the driven snow
safe as houses | as safe as houses
snug as a bug in a rug | as snug as a bug in a rug
straight as a die | as straight as a die
as the crow flies
ashes to ashes | ashes to ashes, dust to dust | ashes to ashes and dust to dust | ashes to ashes, funk to funky
back-seat driver
back to square one
back to the drawing board
balance of power | the balance of power
wouldn't touch with a barge-pole | wouldn't touch it with a barge-pole | i wouldn't touch it with a barge-pole
barking up the wrong tree | you're barking up the wrong tree
beauty is in the eye of the beholder | beauty's in the eye of the beholder
beauty is skin deep | beauty is only skin deep | beauty's skin deep | beauty's only skin deep
bed of roses | a bed of roses | the bed of roses
bee in your bonnet | a bee in your bonnet
bee's knees | the bee's knees | bees knees | the bees knees
behind every great man there's a great woman
below the belt | hit below the belt | a bit below the belt
bells and whistles
belt and braces
best laid schemes of mice and men | the best laid schemes of mice and men | best laid plans of mice and men | the best laid plans of mice and men
bet your bottom dollar | you can bet your bottom dollar
between a rock and a hard place
between the devil and the deep blue sea
beware of greeks bearing gifts | beware greeks bearing gifts
big apple | the big apple
big cheese | the big cheese
big easy | the big easy
big fish in a small pond | a big fish in a small pond
birds of a feather flock together
bite the bullet | biting the bullet
bite the dust | biting the dust
bitter end | the bitter end | to the bitter end | till the bitter end | bitter ending | the bitter ending
black sheep of the family | the black sheep of the family
blast from the past | a blast from the past
blind leading the blind | the blind leading the blind
blonde bombshell | blond bombshell
blood is thicker than water
blood, sweat and tears
big for your boots | too big for your boots | big for one's boots | too big for one's boots
born with a silver spoon in one's mouth | born with a silver spoon in your mouth
break a leg
break the ice | breaking the ice
bring home the bacon | bringing home the bacon | bring the bacon home | bringing the bacon home
if it ain't broke, don't fix it | if it isn't broke don't fix it | if it ain't broken, don't fix it | if it isn't broken don't fix it
buck stops here | the buck stops here
burn the candle at both ends | burning the candle at both ends
burn the midnight oil | burning the midnight oil
bury the hatchet | burying the hatchet
bury your head in the sand | burying your head in the sand | bury one's head in the sand | burying one's head in the sand
busy bee | busy as a bee | as busy as a bee
by hook or by crook
cart before the horse | put the cart before the horse | putting the cart before the horse
let the cat out of the bag
catch 22 | catch22 | catch twenty two | catch twentytwo
weakest link | the weakest link | a chain is only as strong as its weakest link
chip off the old block | a chip off the old block
chip on your shoulder
cloak and dagger
close, but no cigar
cloud nine | on cloud nine
comes to the crunch | if it comes to the crunch | when it comes to the crunch
crack of dawn | the crack of dawn
crocodile tears
curiosity killed the cat
darkest hour is just before the dawn | the darkest hour is just before the dawn
diamond in the rough | a diamond in the rough
chalk and cheese | like chalk and cheese | different as chalk and cheese | as different as chalk and cheese
don't look a gift horse in the mouth
don't throw the baby out with the bathwater
early bird catches the worm | the early bird catches the worm
elephant in the room | an elephant in the room | the elephant in the room
ends of the earth | the ends of the earth
every cloud has a silver lining
exception that proves the rule | the exception that proves the rule | an exception that proves the rule
face the music | facing the music
feather in one's cap | a feather in one's cap | feather in your cap | a feather in your cap
off the back of a truck | fell off the back of a truck | it fell off the back of a truck
fight fire with fire | fighting fire with fire
fish out of water | a fish out of water | like a fish out of water
flogging a dead horse
foot in the door | a foot in the door | one foot in the door
four corners of the earth | the four corners of the earth
freeze the balls off a brass monkey | cold enough to freeze the balls off a brass monkey | brass monkey weather
frog in the throat | a frog in the throat
game is afoot | the game is afoot
down to brass tacks | get down to brass tacks
with a grain of salt | take with a grain of salt | take it with a grain of salt | with a pinch of salt | take with a pinch of salt | take it with a pinch of salt
great minds think alike
hand over fist | making money hand over fist | make money hand over fist | losing money hand over fist | lose money hand over fist
through the grapevine | heard it through the grapevine | i heard it through the grapevine
if you can't stand the heat, get out of the kitchen | if you can't stand the heat, stay out of the kitchen
jump the gun | jumping the gun
kick the bucket | kicked the bucket
last but not least
can't teach an old dog new tricks | cannot teach an old dog new tricks | you can't teach an old dog new tricks | you cannot teach an old dog new tricks
leopard cannot change its spots | leopard can't change its spots | a leopard cannot change its spots | a leopard can't change its spots
moth to a flame | a moth to a flame | like a moth to a flame
mighty oaks from little acorns grow
my cup runneth over
nest of vipers | a nest of vipers
in the nick of time | just in the nick of time
on the shoulders of giants | standing on the shoulders of giants
on the wagon
off the wagon
once in a blue moon
out of sight, out of mind
over the moon
pass the buck | passing the buck | passed the buck
pearls before swine | do not give what is holy to the dogs; nor cast your pearls before swine, lest they trample them under their feet, and turn and tear you in pieces
picture is worth a thousand words | a picture is worth a thousand words
piece of cake | a piece of cake
pigs might fly
red-handed | caught red-handed
red herring | a red herring
red in tooth and claw | nature is red in tooth and claw | nature's red in tooth and claw
red rag to a bull | a red rag to a bull
rolling stone gathers no moss | a rolling stone gathers no moss
teeth on edge | set your teeth on edge | sets your teeth on edge
skeleton in the closet | a skeleton in the closet
sledgehammer to crack a nut | a sledgehammer to crack a nut | using a sledgehammer to crack a nut
something old, something new, something borrowed, something blue
spill the beans
spin doctor
storm in a teacup | a storm in a teacup
straight from the horse's mouth
balance of power | the balance of power
birds and the bees | the birds and the bees | birds and bees | the birds and bees
ends of the earth | the ends of the earth | end of the earth | the end of the earth
pen is mightier than the sword | the pen is mightier than the sword
salt of the earth | the salt of the earth
upper hand | the upper hand
two heads are better than one
under the thumb | under your thumb | under one's thumb
under your hat | keep it under your hat | under one's hat | keep it under one's hat
watched pot never boils | a watched pot never boils | watched kettle never boils | a watched kettle never boils
wrong end of the stick | the wrong end of the stick</pre>}}

Latest revision as of 20:43, 4 April 2017

I get in-world very rarely these days. The knock-on effect of this, is that I am not in the best position to keep these scripts updated. Please message me in-world (forwarded to email) if you discover any bugs (that can't be simply fixed), and I'll do my best to find a solution.

My Contributions

If unsure about how to use these scripts

I have implemented a version number system to make it more obvious if a script is updated. The V# is a comment at the top of each script.

If you have any comments about the content of this page please post them HERE

All my scripts are written for compilation as MONO

More Scripts

Legal Stuff

The legal stuff about contributing to this wiki. (worth reading)

PJIRA Issue Tracker

The issues I have filed on the PJIRA

Tuition

Tuition scripts, notes, videos and screenshots etc. (hardly any content yet)

Free Scripts

Online Status Display & Pager

This will display the owners profile picture and a color coded and text texture sign that changes depending on the owners online status.

Just drop the script into a fresh prim.

// V1 //

key owner_id; // Use to store the UUID of the owner to save having to keep asking.
 
string owner_name; // Use to store the name of the owner to save having to keep asking.

// This a UUID of a texture I created to show either the word "ONLINE" or "OFFLINE".
key ON_OFF_line = "124cfcec-6b8d-552c-42b8-6a1179884e74";

// This is added to the owner UUID to make an HTTP request for the owners profile image UUID.
string profile_url = "http://world.secondlife.com/resident/";

key name_id; // This key is used to recognize the dataserver request if it is for the name of the owner.
 
key online_id; // This key is used to recognize the dataserver request if it is made automatically.
 
key touch_request_id; // This key is used to recognize the dataserver request if it is made by a user.

key update_id; // Used to verify that the HTTP request is for an update of the profile texture.
 
integer lis; // This is used to store the value of a listen and to remove it when not needed.
 
integer channel; // This is used to store the value of the listen channel.
 
key requester; // This is used to store the name of a user who asks to page the owner.

string date; // Used to store the date (just in case you couldn't guess).
 
OnlineStatus(integer ol, integer tr) // This function carries two integer type pieces of info.
{ // integer ol is the the boolean online data. 1 for online and zero for offline.
  // integer tr is also boolean. It carries whether the function is being called by a user or automatically.
    list ol_params = []; // This is a local list creation.
    if(ol) // If the owner is online...
    ol_params = [17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.375,0.0>, (90*DEG_TO_RAD), // ..list the object parameters for displaying ONLINE.
                 18, 5, <0.0,1.0,0.0>, 1.0,
                 18, 6, <1.0,1.0,1.0>, 1.0];
    else // If not...
    ol_params = [17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.625,0.0>, (90*DEG_TO_RAD), // ..list the object parameters for displaying OFFLINE.
                 18, 5, <1.0,0.0,0.0>, 1.0,
                 18, 6, <0.5,0.5,0.5>, 1.0];
    llSetPrimitiveParams(ol_params); // Set the object parameters to show whatever the list is.
    if(tr) // If this was a touch request...
    {
        llSetTimerEvent(30.0); // Prepare to be ignored (we need to switch the listen off if we are ignored).
        if(ol) // If the owner is online...
        {
            lis = llListen(channel, "", requester, ""); // Open a listen for the user who made the request.
            llDialog(requester, ("\nWould you like to page " + owner_name + "?"), ["YES", "NO"], channel); // Send them a dialog.
        }
        else // If not...
        llInstantMessage(requester, (owner_name + " is currently offline.")); // Send a message explaining that the owner is offline.
    }
}
 
default // Create an area for the events to play in. This is called a "state".
{
    state_entry() // On state entry...
    {
        owner_id = llGetOwner(); // Get the owner UUID (key) and store it.
        name_id = llRequestAgentData(owner_id, DATA_NAME); // Make a request for the owners name.
        channel = -5647; // Set a channel to use for the dialog.
    }
    dataserver(key q, string data) // Triggered when a reply to a data request is recieved.
    {
        if(q == name_id) // Check the id of the request.
        {
            owner_name = data; // Store the result.
            llSetObjectName(owner_name + "'s Online Status"); // Set the name of the object to the owner name + "'s Online Status".
            llHTTPRequest((profile_url + ((string)owner_id)), [], ""); // Request the UUID of the owners profile.
        }
        else if(q == online_id) // Check the id of the request.
        OnlineStatus(((integer)data), FALSE); // Call the OnlineStatus function for an automatic return.
        else if(q == touch_request_id) // Check the id of the request.
        OnlineStatus(((integer)data), TRUE); // Call the OnlineStatus function for a touch-by-user return.
    }
    http_response(key q, integer status, list metadata, string body) // Triggered when a response for an HTTP request is recieved.
    {
        integer tex_key_start = (llSubStringIndex(body, "imageid") + 18); // Establish the point where the image UUID is written in the page.
        integer tex_key_end = (tex_key_start + 35); // Establish the point where the image UUID ends.
        key profile_image = ((key)llGetSubString(body, tex_key_start, tex_key_end)); // Store the the profile image UUID found.
        if(q != update_id) // Check the source of the request.
        {
            llSetPrimitiveParams([9, 0, 0, <0.6,0.875,0.0>, 0.02, ZERO_VECTOR, <1.0,1.0,0.0>, ZERO_VECTOR, // Shape the object...
                                  8, llEuler2Rot(<0.0,90.0,0.0>*DEG_TO_RAD),
                                  7, <0.85,0.01,0.6>,
                                  17, -1, TEXTURE_BLANK, <1.0,1.0,0.0>, ZERO_VECTOR, 0.0,
                                  18, -1, ZERO_VECTOR, 1.0]); // ...and texture it with the owners profile image and...
            llSetPrimitiveParams([17, 6, profile_image, <1.0,1.0,0.0>, ZERO_VECTOR, (90*DEG_TO_RAD),
                                  17, 5, ON_OFF_line, <1.4,0.25,0.0>, <0.0,0.375,0.0>, (90*DEG_TO_RAD), // the ON/OFFline texture.
                                  19, 5, 0, 1,
                                  18, 6, <1.0,1.0,1.0>, 1.0,
                                  18, 5, <0.0,1.0,0.0>, 1.0,
                                  20, 5, 1,
                                  20, 6, 1]);
            llSetTimerEvent(0.1); // Move to the timer quickly to run the first OnlineStatus check.
        }
        else
        llSetPrimitiveParams([17, 6, profile_image, <1.0,1.0,0.0>, ZERO_VECTOR, (90*DEG_TO_RAD)]); // Apply the updated profile texture.
    }
    timer() // Triggered if a timer event is set to a non zero amount.
    {
        llSetTimerEvent(10.0); // Reset the timer event to trigger every 10 seconds.
        llListenRemove(lis); // Always remove any listen we have open.
        online_id = llRequestAgentData(owner_id, DATA_ONLINE); // So every 10 seconds we check if the owner is online.
        string t_date = llGetDate(); // Find out what the date is.
        if(t_date != date) // Check if the date has changed. If it has...
        {
            date = t_date; // ...store the date so the next check to return true will be roughly 24 hours later.
            update_id = llHTTPRequest((profile_url + ((string)owner_id)), [], ""); // Request an update of the UUID of the owners profile.
        }
    }
    touch_start(integer nd) // Triggered on clicking the object that contains the script.
    {
        llSetTimerEvent(0.0); // Stop the timer.
        requester = llDetectedKey(0); // Store the UUID of the person who touched us.
        touch_request_id = llRequestAgentData(owner_id, DATA_ONLINE); // Request the online status of the owner before issuing any dialogs.
    } // We do this becuse if the owner went offline 9 seconds ago we wouldn't know.
    listen(integer chan, string name, key id, string msg) // Triggered when all the specified info is recieved by the script if it has a listen open.
    {
        llListenRemove(lis); // Remove the listen.
        llSetTimerEvent(10.0); // Set the timer to run automatically.
        if(msg == "YES") // If the toucher wants to page the owner (the owner must be online)...
        { // Instant message the owner with a link that when clicked will bring up the touchers profile. This saves searching for the touchers profile.
            llInstantMessage(owner_id, ("secondlife:///app/agent/" + ((string)requester) + "/about has requested to message you."));
            llInstantMessage(requester, owner_name + " has been paged."); // Inform the toucher that the owner has been paged.
        }
    }
}

What's my Build?

A simple but fun game for groups to play. Players take turns building their interpretation of a suggested word or phrase, then the other players make guesses in local chat until one is correct. The player who correctly guesses what is being built becomes the new builder and the game continues.

  • Up to 9 notecards containing lists of words or phrases can be added.
  • Each time a notecard is chosen, the order in which the words will be used is randomized.
    • One word or phrase per line. Single lines should not exceed 255 bytes.
    • No empty lines.
    • Add alternative spellings (i.e. "colour" and "color") or meanings (i.e. "truck", "lorry" and "van") together on the same line, separated by pipes (this is a pipe --> "|").
    • Punctuation listed in the script will be stripped from the words and phrases.
      • Unfortunately, LSL has no RegEx and as such it is impractical to except alternatives that aren't explicitly added to the cards. An LSL parser capable of regex like deduction would be horrible, so without utilising a remote server (a possible update), the alternatives need to cover everything reasonable to expect. There is an option for the owner to be told the word or phrase being built (after which they will be excluded from that round), and it's recommended if the script is reading from a card containing potentially contentious phrases with many possible alternatives.
    • Apostrophes are also stripped.
  • Menu operated from touch.
// V2 //

key owner;
key nc_line_id;
key num_of_nc_lines_id;
key current_builder = NULL_KEY;

integer query_id;
integer num_of_ncs;
integer private_listen_id;
integer public_listen_id;
integer line_index;
integer owner_knows;

string notecard;
string current_word;
string word_or_phrase;

list notecards;
list dialog_list;
list shuffled_line_numbers;
list current_alts;
list punctuation = [ ".", ",", "!", "?", ";", ":", "-", "\"" ]; // Must not contain pipes --> |

integer frequency() {
    return ( integer )( llFrand( -1073741824.0 ) - 1073741824.0 );
}

removeListen( integer id ) {
    llListenRemove( id );
    if ( id == private_listen_id ) {
        llSetTimerEvent( 0.0 );
    }
}

ownerDialog( string msg ) {
    integer channel = frequency();
    if ( msg == "" ) {
        msg = "Select a notecard, hear the current " + word_or_phrase + " or reset the game.";
    }
    private_listen_id = llListen( channel, llKey2Name( owner ), owner, "" );
    llDialog( owner, "\n" + msg, [ "CANCEL", llList2String( [ "START", "TELL" ], current_word != "" ), "RESET" ] + dialog_list, channel );
    llSetTimerEvent( 20.0 );
}

builderDialog( string msg ) {
    llDialog( current_builder, "\n" + msg, [], frequency() );
}

publicListen() {
    public_listen_id = llListen( PUBLIC_CHANNEL, "", "", "" );
}

getLine() {
    nc_line_id = llGetNotecardLine( notecard, llList2Integer( shuffled_line_numbers, --line_index ) );
    if ( !line_index ) {
        ownerDialog( "We've reached the end of the last notecard; please select another to continue." );
    }
}

announce( string str ) {
    llSay( PUBLIC_CHANNEL, str );
}

string agentName( key id ) {
    string name = llGetDisplayName( id );
    if ( name == "" ) {
        name = llKey2Name( id );
    }
    return name;
}

mia( integer index ) {
    removeListen( public_listen_id );
    key temp_builder = current_builder;
    string temp_word = current_word;
    current_builder = NULL_KEY;
    current_word = "";
    announce( llList2String( [ "The current builder", agentName( temp_builder ) ], index ) + " has " +
              llList2String( [ "left the region", "given the game away" ], index ) +
              ", so a new builder must take their place by touching me.\nThe " + word_or_phrase + " was \"" + temp_word + "\"." );
}

string trim( string str ) {
    return llStringTrim( str, STRING_TRIM );
}

string dL2S( list lst ) {
    return llDumpList2String( lst, " " );
}

string cleanString( string str ) {
    return llToLower(
        trim(
            llDumpList2String(
                llParseString2List(
                    dL2S(
                        llParseString2List(
                            dL2S(
                                llParseString2List( str, punctuation, [] ) // Remove the listed punctuation.
                            ), // Replace it with spaces.
                        [ "  " ], [] ) // Remove double spaces.
                    ), // Replace them with single spaces.
                [ "'" ], [] ), // Remove apostrophes.
            "" ) // Glue everything back together.
        ) // Trim leading and trailing whitespace.
    ); // Convert all to lower case.
}

list trimList( list lst ) {
    integer length = llGetListLength( lst );
    while ( length ) {
        --length;
        lst = llListReplaceList( lst, [ trim( llList2String( lst, length ) ) ], length, length );
    }
    return lst;
}

integer ncNoBuilder() {
    return notecard != "" && current_builder == NULL_KEY;
}

start( key id ) {
    current_builder = id;
    getLine();
}

default {
    on_rez( integer param ) {
        llResetScript();
    }
    changed( integer change ) {
        if ( change & ( CHANGED_OWNER | CHANGED_INVENTORY ) ) {
            llResetScript();
        }
    }
    state_entry() {
        owner = llGetOwner();
        num_of_ncs = llGetInventoryNumber( INVENTORY_NOTECARD );
        if ( num_of_ncs ) {
            string nc;
            while ( num_of_ncs ) {
                notecards += [ nc = llGetInventoryName( INVENTORY_NOTECARD, --num_of_ncs ) ];
                dialog_list += [ llGetSubString( nc, 0, 23 ) ];
            }
            ownerDialog( "" );
        }
    }
    touch_start( integer nd ) {
        key toucher;
        while ( nd ) {
            toucher = llDetectedKey( --nd );
            if ( toucher == owner ) {
                ownerDialog( "" );
            } else if ( ncNoBuilder() ) {
                start( toucher );
            }
        }
    }
    listen( integer chan, string name, key id, string msg ) {
        if ( chan && id == owner ) {
            removeListen( private_listen_id );
            if ( msg != "CANCEL" ) {
                integer index;
                if ( msg == "RESET" ) {
                    llResetScript();
                } else if ( msg == "START" ) {
                    if ( notecard == "" ) {
                        ownerDialog( "You need to select a notecard to play with first." );
                    } else if ( current_builder ) {
                        ownerDialog( llKey2Name( current_builder ) + " has already started the game." );
                    } else {
                        start( owner );
                    }
                } else if ( msg == "TELL" ) {
                    owner_knows = TRUE;
                    llOwnerSay( "The " + word_or_phrase + " is currently: \"" + current_word + "\"" );
                } else if ( ~( index = llListFindList( dialog_list, [ msg ] ) ) ) {
                    num_of_nc_lines_id = llGetNumberOfNotecardLines( notecard = llList2String( notecards, index ) );
                }
            }
        } else {
            if ( llGetAgentSize( current_builder ) ) {
                msg = cleanString( msg );
                integer alt_index;
                if ( msg == current_word || ( llGetListLength( current_alts ) && ~( alt_index = llListFindList( current_alts, [ msg ] ) ) ) ) {
                    if ( id != owner || ( id == owner && !owner_knows ) ) {
                        if ( id != current_builder ) {
                            removeListen( public_listen_id );
                            if ( ~alt_index ) {
                                current_word = current_word + "\" by saying the acceptable alternative \"" + msg;
                            }
                            builderDialog( "The " + word_or_phrase + " you're building has been correctly guessed. Well done!" );
                            announce( agentName( current_builder = id ) + " has correctly guessed that the " + word_or_phrase + " being built was \"" + current_word + "\"." );
                            getLine();
                        } else {
                            mia( 1 );
                        }
                    }
                }
            } else {
                mia( 0 );
            }
        }
    }
    dataserver( key id, string data ) {
        if ( id == num_of_nc_lines_id ) {
            integer num_of_nc_lines = ( integer )data;
            line_index = num_of_nc_lines;
            while ( num_of_nc_lines ) {
                shuffled_line_numbers += [ --num_of_nc_lines ];
            }
            shuffled_line_numbers = llListRandomize( shuffled_line_numbers, 1 );
            if ( ncNoBuilder() ) {
                announce( "Will the first builder please start the game by touching me?" );
            }
        } else if ( id == nc_line_id ) {
            owner_knows = FALSE;
            current_alts = trimList( llParseString2List( data = cleanString( data ), [ "|" ], [] ) );
            if ( llGetListLength( current_alts ) > 1 ) {
                current_word = llList2String( current_alts, 0 );
                current_alts = llList2List( current_alts, 1, -1 );
            } else {
                current_word = data;
                current_alts = [];
            }
            if ( ~llSubStringIndex( current_word, " " ) ) {
                word_or_phrase = "phrase";
            } else {
                word_or_phrase = "word";
            }
            if ( llGetAgentSize( current_builder ) ) {
                builderDialog( "Build your interpretation of the " + word_or_phrase + ":\n\n\"" + current_word + "\"." );
                publicListen();
                announce( agentName( current_builder ) + " has been told the current " + word_or_phrase + " and should start their build now." );
            } else {
                mia( 0 );
            }
        }
    }
    timer() {
        removeListen( private_listen_id );
    }
}

Example Notecards

Words (no alts)

Copied from a list found at manythings.org.

  • Alternatives should be added per the instructions above.
angle
ant
apple
arch
arm
army
baby
bag
ball
band
basin
basket
bath
bed
bee
bell
berry
bird
blade
board
boat
bone
book
boot
bottle
box
boy
brain
brake
branch
brick
bridge
brush
bucket
bulb
button
cake
camera
card
cart
carriage
cat
chain
cheese
chest
chin
church
circle
clock
cloud
coat
collar
comb
cord
cow
cup
curtain
cushion
dog
door
drain
drawer
dress
drop
ear
egg
engine
eye
face
farm
feather
finger
fish
flag
floor
fly
foot
fork
fowl
frame
garden
girl
glove
goat
gun
hair
hammer
hand
hat
head
heart
hook
horn
horse
hospital
house
island
jewel
kettle
key
knee
knife
knot
leaf
leg
library
line
lip
lock
map
match
monkey
moon
mouth
muscle
nail
neck
needle
nerve
net
nose
nut
office
orange
oven
parcel
pen
pencil
picture
pig
pin
pipe
plane
plate
plow
pocket
pot
potato
prison
pump
rail
rat
receipt
ring
rod
roof
root
sail
school
scissors
screw
seed
sheep
shelf
ship
shirt
shoe
skin
skirt
snake
sock
spade
sponge
spoon
spring
square
stamp
star
station
stem
stick
stocking
stomach
store
street
sun
table
tail
thread
throat
thumb
ticket
toe
tongue
tooth
town
train
tray
tree
trousers
umbrella
wall
watch
wheel
whip
whistle
window
wing
wire
worm
Phrases (with alts)

Extensively reworked from a list found at phrases.org.uk.

a bird in the hand is worth two in the bush
drop in the ocean | a drop in the ocean
fly in the ointment | a fly in the ointment
no-brainer | a no-brainer
pig in a poke | a pig in a poke
a place for everything and everything in its place
sight for sore eyes | a sight for sore eyes
stone's throw | a stone's throw
turn up for the books | a turn up for the books
wolf in sheep's clothing | a wolf in sheep's clothing
a woman needs a man like a fish needs a bicycle
two peas in a pod | alike as two peas in a pod | like two peas in a pod
alive and kicking | alive and kickin'
fingers and thumbs | all fingers and thumbs
all that glitters is not gold | all that glisters is not gold
all things come to he who waits | all thing come to those who wait | all thing come to those that wait
all things must pass
an apple a day keeps the doctor away
arm and a leg | an arm and a leg | costs an arm and a leg | it costs an arm and a leg
axe to grind | an axe to grind | one has an axe to grind | i have an axe to grind | you have an axe to grind
englishman's home is his castle | an englishman's home is his castle
ill wind | an ill wind | an ill wind bloweth | an ill wind that blows
apple of my eye | the apple of my eye
bald as a coot | as bald as a coot
brown as a berry | as brown as a berry
cool as a cucumber | as cool as a cucumber
daft as a brush | as daft as a brush
dead as a dodo | as dead as a dodo
dead as a doornail | as dead as a doornail
easy as pie | as easy as pie
grease lightning | greased lightning | fast as greased lightning | as fast as greased lightning
fit as a fiddle | as fit as a fiddle
mad as a hatter | as mad as a hatter
pure as the driven snow | as pure as the driven snow
safe as houses | as safe as houses
snug as a bug in a rug | as snug as a bug in a rug
straight as a die | as straight as a die
as the crow flies
ashes to ashes | ashes to ashes, dust to dust | ashes to ashes and dust to dust | ashes to ashes, funk to funky
back-seat driver
back to square one
back to the drawing board
balance of power | the balance of power
wouldn't touch with a barge-pole | wouldn't touch it with a barge-pole | i wouldn't touch it with a barge-pole
barking up the wrong tree | you're barking up the wrong tree
beauty is in the eye of the beholder | beauty's in the eye of the beholder
beauty is skin deep | beauty is only skin deep | beauty's skin deep | beauty's only skin deep
bed of roses | a bed of roses | the bed of roses
bee in your bonnet | a bee in your bonnet
bee's knees | the bee's knees | bees knees | the bees knees
behind every great man there's a great woman
below the belt | hit below the belt | a bit below the belt
bells and whistles
belt and braces
best laid schemes of mice and men | the best laid schemes of mice and men | best laid plans of mice and men | the best laid plans of mice and men
bet your bottom dollar | you can bet your bottom dollar
between a rock and a hard place
between the devil and the deep blue sea
beware of greeks bearing gifts | beware greeks bearing gifts
big apple | the big apple
big cheese | the big cheese
big easy | the big easy
big fish in a small pond | a big fish in a small pond
birds of a feather flock together
bite the bullet | biting the bullet
bite the dust | biting the dust
bitter end | the bitter end | to the bitter end | till the bitter end | bitter ending | the bitter ending
black sheep of the family | the black sheep of the family
blast from the past | a blast from the past
blind leading the blind | the blind leading the blind
blonde bombshell | blond bombshell
blood is thicker than water
blood, sweat and tears
big for your boots | too big for your boots | big for one's boots | too big for one's boots
born with a silver spoon in one's mouth | born with a silver spoon in your mouth
break a leg
break the ice | breaking the ice
bring home the bacon | bringing home the bacon | bring the bacon home | bringing the bacon home
if it ain't broke, don't fix it | if it isn't broke don't fix it | if it ain't broken, don't fix it | if it isn't broken don't fix it
buck stops here | the buck stops here
burn the candle at both ends | burning the candle at both ends
burn the midnight oil | burning the midnight oil
bury the hatchet | burying the hatchet
bury your head in the sand | burying your head in the sand | bury one's head in the sand | burying one's head in the sand
busy bee | busy as a bee | as busy as a bee
by hook or by crook
cart before the horse | put the cart before the horse | putting the cart before the horse
let the cat out of the bag
catch 22 | catch22 | catch twenty two | catch twentytwo
weakest link | the weakest link | a chain is only as strong as its weakest link
chip off the old block | a chip off the old block
chip on your shoulder
cloak and dagger
close, but no cigar
cloud nine | on cloud nine
comes to the crunch | if it comes to the crunch | when it comes to the crunch
crack of dawn | the crack of dawn
crocodile tears
curiosity killed the cat
darkest hour is just before the dawn | the darkest hour is just before the dawn
diamond in the rough | a diamond in the rough
chalk and cheese | like chalk and cheese | different as chalk and cheese | as different as chalk and cheese
don't look a gift horse in the mouth
don't throw the baby out with the bathwater
early bird catches the worm | the early bird catches the worm
elephant in the room | an elephant in the room | the elephant in the room
ends of the earth | the ends of the earth
every cloud has a silver lining
exception that proves the rule | the exception that proves the rule | an exception that proves the rule
face the music | facing the music
feather in one's cap | a feather in one's cap | feather in your cap | a feather in your cap
off the back of a truck | fell off the back of a truck | it fell off the back of a truck
fight fire with fire | fighting fire with fire
fish out of water | a fish out of water | like a fish out of water
flogging a dead horse
foot in the door | a foot in the door | one foot in the door
four corners of the earth | the four corners of the earth
freeze the balls off a brass monkey | cold enough to freeze the balls off a brass monkey | brass monkey weather
frog in the throat | a frog in the throat
game is afoot | the game is afoot
down to brass tacks | get down to brass tacks
with a grain of salt | take with a grain of salt | take it with a grain of salt | with a pinch of salt | take with a pinch of salt | take it with a pinch of salt
great minds think alike
hand over fist | making money hand over fist | make money hand over fist | losing money hand over fist | lose money hand over fist
through the grapevine | heard it through the grapevine | i heard it through the grapevine
if you can't stand the heat, get out of the kitchen | if you can't stand the heat, stay out of the kitchen
jump the gun | jumping the gun
kick the bucket | kicked the bucket
last but not least
can't teach an old dog new tricks | cannot teach an old dog new tricks | you can't teach an old dog new tricks | you cannot teach an old dog new tricks
leopard cannot change its spots | leopard can't change its spots | a leopard cannot change its spots | a leopard can't change its spots
moth to a flame | a moth to a flame | like a moth to a flame
mighty oaks from little acorns grow
my cup runneth over
nest of vipers | a nest of vipers
in the nick of time | just in the nick of time
on the shoulders of giants | standing on the shoulders of giants
on the wagon
off the wagon
once in a blue moon
out of sight, out of mind
over the moon
pass the buck | passing the buck | passed the buck
pearls before swine | do not give what is holy to the dogs; nor cast your pearls before swine, lest they trample them under their feet, and turn and tear you in pieces
picture is worth a thousand words | a picture is worth a thousand words
piece of cake | a piece of cake
pigs might fly
red-handed | caught red-handed
red herring | a red herring
red in tooth and claw | nature is red in tooth and claw | nature's red in tooth and claw
red rag to a bull | a red rag to a bull
rolling stone gathers no moss | a rolling stone gathers no moss
teeth on edge | set your teeth on edge | sets your teeth on edge
skeleton in the closet | a skeleton in the closet
sledgehammer to crack a nut | a sledgehammer to crack a nut | using a sledgehammer to crack a nut
something old, something new, something borrowed, something blue
spill the beans
spin doctor
storm in a teacup | a storm in a teacup
straight from the horse's mouth
balance of power | the balance of power
birds and the bees | the birds and the bees | birds and bees | the birds and bees
ends of the earth | the ends of the earth | end of the earth | the end of the earth
pen is mightier than the sword | the pen is mightier than the sword
salt of the earth | the salt of the earth
upper hand | the upper hand
two heads are better than one
under the thumb | under your thumb | under one's thumb
under your hat | keep it under your hat | under one's hat | keep it under one's hat
watched pot never boils | a watched pot never boils | watched kettle never boils | a watched kettle never boils
wrong end of the stick | the wrong end of the stick

More Scripts...

If you have any comments about the content of this page please post them HERE