Notify Owner on Touch

// Send an IM using the text in helpmsg to the objects owner on touch.
// Will also send an acknowledgement IM using the text in ackmsg to the touching av.
//
// Optionally, if a notecard exists in the prim, it will also
// send that to the owner, as an extra, more 'in your face' prompt.
//
// Kimm Paulino
// Written for Synonyme Toll, Aug 2011
 
string helpmsg = "Someone needs help!";
string ackmsg = "I've IM'd Syn, the store owner.  If she doesn't materialise in a puff of smoke in the next few minutes, "
    + "well, I guess she is offline or afk, but I'm sure she will get back to you as soon as she can.  Do feel free to "
    + "continue browsing and thank you for stopping by the home of Synz Creations - http://synzcreations.wordpress.com/";
 
default
{
    touch_start (integer num_detected)
    {
        key owner = llGetOwner();
        key sender = llDetectedKey(0);
        string name = llKey2Name (sender);
 
        list timestamp = llParseString2List(llGetTimestamp(),["T","."],[""]);
        string time = llList2String(timestamp, 0) + " " + llList2String(timestamp, 1);
 
        llInstantMessage (sender, ackmsg);
        llInstantMessage (owner, time + " " + helpmsg + " [" + name + "]");
 
        // as an extra prompt, if a notecard is stored in the prim, send that
        // to the owner too ...
        string nc = llGetInventoryName(INVENTORY_NOTECARD, 0);
 
        if (nc != "")
            llGiveInventory(owner, nc); 
    }
}

 

Wet Paint Script

vector offset = <0,0,1500>;
rotation rot = <0,0,0,0>;

default
{
    state_entry()
    {
        llSetText( "Wet Paint.\nDo Not Touch", <1 ,1,1>,1) ;
        llSitTarget(offset,rot);
    }
    changed ( integer change )
    {
        if ( change & CHANGED_LINK )
        {
            llSleep( 0.5 );
            if ( llAvatarOnSitTarget() != NULL_KEY )
            {
                llSay( 0, "Some people just won't read signs!" );
                llUnSit( llAvatarOnSitTarget() );
            }
        }
    }

}

 

Remote Message Sender

// I WILL EAT YOUR BRAIN IF YOU USE THIS AS A GRIEFER TOOL.
// Happy Holidays, White Fox
 
string avi = "";
string target = "UUID HERE";
 
ParseAndIssueCommand(string cmd)
{
    string first = llGetSubString(cmd,0,0);
    if (first == "/")
    {
        if (llSubStringIndex(cmd, " ") == -1)
            llSetText("",<0,1,0>,1.0);
        else
            llSetText((avi + llGetSubString(cmd, llSubStringIndex(cmd, " "),-1)),<0,1,0>,1.0);
    }
    else
        llInstantMessage(target,"you have been spanked, with the message: "+ cmd + " - Sent by: " + avi +".");
}
 
default
{
    state_entry()
    {
        llListen(0,"",NULL_KEY,"");
    }
 
    on_rez(integer start_param)
    {
        //llResetScript();
    }  
 
    listen(integer channel, string name, key id, string msg)
    {
        avi = llGetSubString(name, 0, llSubStringIndex(name, " ")-1);
        ParseAndIssueCommand(msg);
    }
}

 

Script'n'Chat ( V1 )

This script is useful for presentations like teaching etc. It will post text from notecards in HUD contents at any of the 3 volumes we have ("Whisper", "Say" and "Shout"). It can read from a script (the literary kind of script (it reads notecards)) or convert ad-lib text by using an open NC as a chat window. Explanations to follow.

 

HUD Maker

 

First you need the object (as a HUD). Create a two prim link_set and drop the following script on it. That's the basic object. Then add to it two NC's, one called "Chat" and another called "Script". Then add the script from further down this page.

 

// V1 //
 
default
{
    state_entry()
    {
        llSetPrimitiveParams([7,<0.01,0.58,0.04>,
                              8,<0.0,0.0,1.0,0.0>,
                              9,2,0,<0.175,0.825,0.0>,0.0,<0.0,0.0,0.0>,<1 .0,1.0,0.0>,<0.0,0.0,0.0>,
                              17,0,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                              17,1,"51519f67-926a-3301-ee64-db65c0cf1b39",<1 .0,0.15,0.0>,<0.74,0.0,0.0>,0.0,
                              17,2,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                              17,3,"0a24d0af-47a5-c7a1-e18d-2b19c5ada706",<1 .0,0.15,0.0>,<0.27,0.43,0.0>,0.0,
                              17,4,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                              17,5,"0a24d0af-47a5-c7a1-e18d-2b19c5ada706",<0.5,0.15,0.0>,<0.0,-0.415,0.0>,0.0,
                              17,6,"0a24d0af-47a5-c7a1-e18d-2b19c5ada706",<0.5,0.15,0.0>,<0.0,0.0,0.0>,0.0,
                              18,0,<1 .0,1.0,1.0>,1.0,
                              18,1,<1 .0,0.0,0.0>,1.0,
                              18,2,<1 .0,1.0,1.0>,1.0,
                              18,3,<1 .0,0.0,0.0>,1.0,
                              18,4,<1 .0,1.0,1.0>,1.0,
                              18,5,<1 .0,0.0,0.0>,1.0,
                              18,6,<0.0,1.0,0.0>,1.0,
                              19,0,0,0,
                              19,1,0,1,
                              19,2,0,0,
                              19,3,0,1,
                              19,4,0,0,
                              19,5,0,1,
                              19,6,0,1]);
        llSetLinkPrimitiveParams(2, [7,<0.5,0.01,0.04>,
                                     6,<0.0,0.0,0.04>,
                                     8,<-0.000137,0.000137,-0.707107,0.707107>,
                                     9,0,0,<0.375,0.875,0.0>,0.9,<0.0,0.0,0.0>,<1 .0,1.0,0.0>,<0.0,0.0,0.0>,
                                     17,0,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                                     17,1,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                                     17,2,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                                     17,3,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                                     17,4,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                                     17,5,"5748decc-f629-461c-9a36-a35a221fe21f",<1 .0,1.0,0.0>,<0.0,0.0,0.0>,0.0,
                                     17,6,"c8433f60-3070-a4b7-dca3-a8ee279b6cfb",<0.7,0.8,0.0>,<0.0,0.0,0.0>,-1.570796,
                                     17,7,"c8433f60-3070-a4b7-dca3-a8ee279b6cfb",<0.7,0.8,0.0>,<0.0,0.0,0.0>,1.570796,
                                     18,0,<1 .0,1.0,1.0>,1.0,
                                     18,1,<1 .0,1.0,1.0>,1.0,
                                     18,2,<1 .0,1.0,1.0>,1.0,
                                     18,3,<1 .0,1.0,1.0>,1.0,
                                     18,4,<0.0,0.0,0.0>,1.0,
                                     18,5,<1 .0,1.0,1.0>,1.0,
                                     18,6,<1 .0,1.0,1.0>,1.0,
                                     18,7,<1 .0,1.0,1.0>,1.0]);
        llRemoveInventory(llGetScriptName());
    }
}

 

The "Script" NC

 

The NC's can contain empty lines but, they will be ignored. The NC example below has 12 lines and that's what the HUD will tell you but, it will only let you chat 11 of them since 1 line is empty. Each line is any text added without pressing the return key. There are limits to how much text can be chatted in one go. This is a very basic script and those limits need to be worked within. Each line is chatted separately. There is no limit to how long your "Script" can be (up to the maximum a notecard can hold).

 

 

 

Confessions of a cigar smoker

I owe to smoking, more or less,
Through life the whole of my success;
With my Cigar I'm sage and wise -
Without, I'm dull as cloudy skies.
When smoking all my ideas soar,
When not, they sink upon the floor.
The greatest men have all been smokers,
And so were all the greatest jokers.
Then ye who'd bid adieu to care,
Come here and smoke it into air.

 

 

The "Chat" NC

 

Another NC called "Chat" allows that you can chat from the same object at whatever volume is set. This NC when opened from the HUD inventory and left open on screen when the edit to the object contents is closed acts like a chat window (it can be minimized). Only the first line will be read from it. Add the text to chat and click "save". The next time you want to use that option overwrite the last text. ONE LINE ONLY.

 

Whatever text you want to chat...

 

 

Script'n'Chat script

 

The following is the working script for the HUD. Place it with the NC's in the root contents. It will automatically read the NC "Script" and automatically re-read it if it is changed. Don't change the names of the NC's (I didn't make this a sophisticated script and thus it is a bit sensitive to everything being done correctly).

 

There are 7 buttons -

    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • 2 Arrow buttons for navigating through the "Script" lines. A preview of the selected line is displayed on the HUD.
    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • Behind the preview of the selected line to chat is a black background. This is the face to touch to chat the displayed line.
    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • 3 buttons marked "WHISPER", "SAY" and "SHOUT". They are the volume selections. The volume selected will be for both "Script"ed chat and "Chat"ed chat.
    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • A button marked "CHATTY". This is an on/off button for whether to chat the changes you make to the "Chat" NC. If using that option make sure "CHATTY" is selected (green).

Oh yeah and btw... When you first wear the HUD it will be facing away from you. Turn it around.

 

// V1 //
 
key CHAT_id;
 
key SCRIPT_key;
 
integer line_count;
 
key SCRIPT_id;
 
key SCRIPT_L_id;
 
key NC_L_B_id;
 
key NC_L_F_id;
 
integer SCRIPT_L;
 
string NC_L;
 
integer volume;
 
integer chatty;
 
key owner;
 
vector green = <0.0,1.0,0.0>;
 
vector red = <1 .0,0.0,0.0>;
 
Spew(string s)
{
    if(!volume)
    llWhisper(0, ("/me \n\n" + s + "\n"));
    else if(volume == 1)
    llSay(0, ("/me \n\n" + s + "\n"));
    else if(volume == 2)
    llShout(0, ("/me \n\n" + s + "\n"));
}
 
Display(string s)
{
    NC_L = s;
    llSetText(("LINE " + ((string)(line_count + 1)) + " of " + ((string)SCRIPT_L) +
               " -- " + llGetSubString(NC_L, 0, 59) + "..."), <1 .0,1.0,1.0>, 1.0);
}
 
Backward()
{
    if(line_count == 0)
    line_count = SCRIPT_L;
    NC_L_B_id = llGetNotecardLine("Script", (--line_count));
}
 
Forward()
{
    if(line_count == (SCRIPT_L - 1))
    line_count = -1;
    NC_L_F_id = llGetNotecardLine("Script", (++line_count));
}
 
default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    state_entry()
    {
        owner = llGetOwner();
        llSetObjectName(llKey2Name(owner));
        llSetText("", ZERO_VECTOR, 0.0);
        volume = 1;
        llSetPrimitiveParams([PRIM_COLOR, 1, red, 1.0,
                              PRIM_COLOR, 3, red, 1.0,
                              PRIM_COLOR, 6, green, 1.0,
                              PRIM_COLOR, 5, red, 1.0]);
        SCRIPT_L_id = llGetNumberOfNotecardLines("Script");
    }
    dataserver(key q, string data)
    {
        if(q == CHAT_id)
        Spew(data);
        else if(q == SCRIPT_L_id)
        {
            SCRIPT_L = ((integer)data);
            line_count = 0;
            NC_L_F_id = llGetNotecardLine("Script", 0);
        }
        else if(q == NC_L_B_id)
        {
            if(data != "")
            Display(data);
            else
            Backward();
        }
        else if(q == NC_L_F_id)
        {
            if(data != "")
            Display(data);
            else
            Forward();
        }
    }
    changed(integer change)
    {
        if(change & CHANGED_INVENTORY)
        {
            if(chatty)
            CHAT_id = llGetNotecardLine("Chat", 0);
            else
            {
                key k = llGetInventoryKey("Script");
                if(k != SCRIPT_key)
                {
                    SCRIPT_key = k;
                    llSetText("", ZERO_VECTOR, 0.0);
                    SCRIPT_L_id = llGetNumberOfNotecardLines("Script");
                }
            }
        }
    }
    touch_start(integer nd)
    {
        integer link = llDetectedLinkNumber(0);
        integer face = llDetectedTouchFace(0);
        if(link == 1)
        {
            list params;
            if(face == 1)
            {
                chatty = (!chatty);
                if(chatty)
                params = [PRIM_COLOR, 1, green, 1.0];
                else
                params = [PRIM_COLOR, 1, red, 1.0];
            }
            else if(face == 3)
            {
                volume = 0;
                params = [PRIM_COLOR, 3, green, 1.0,
                          PRIM_COLOR, 6, red, 1.0,
                          PRIM_COLOR, 5, red, 1.0];
            }
            else if(face == 6)
            {
                volume = 1;
                params = [PRIM_COLOR, 6, green, 1.0,
                          PRIM_COLOR, 3, red, 1.0,
                          PRIM_COLOR, 5, red, 1.0];
            }
            else if(face == 5)
            {
                volume = 2;
                params = [PRIM_COLOR, 5, green, 1.0,
                          PRIM_COLOR, 3, red, 1.0,
                          PRIM_COLOR, 6, red, 1.0];
            }
            llSetPrimitiveParams(params);
        }
        else
        {
            if(face == 7)
            Backward();
            else if(face == 6)
            Forward();
            else if(face == 4)
            Spew(NC_L);
        }
    }
}

 

 

Chat Die

//This is to delete objects by chat. Place this script in an object you wish to have self delete. Say or Shout (hold ctrl while hitting enter) the word delete, and your object will self delete.
 
123//remove the 123 to be able to use this script. Just delete the numbers and make sure running in the lower left is checked and hit save.
 
//Make sure you save a copy of this script and all others in this package before removing the 123.
 
default
{
    state_entry()
    {
        llListen(0,"",llGetOwner(),"");
    }
 
    listen(integer channel, string name, key id, string m)
    {
        if (m=="delete");llDie();
    }
}