Group Item Giver

string item = "Object Name"; // The item you would like to give out
string group_name = "Groups Name"; // The group you would like to give the item to
default
{
    on_rez ( integer start )
    {
        llResetScript(); // Resets the script on rez
    }
    
    state_entry()
    {

    }

    touch_start(integer total_number)
    {
        integer group = llSameGroup(llDetectedKey(0)); // checks to see if the person clicking on the object has the same active group as the object, returns TRUE or FALSE
        if ( group == TRUE )
        {
            llGiveInventory(llDetectedKey(0), item); // gives the item to the person who clicked on the object
            llSay(0, "Thank You");
        }
        else if ( group == FALSE )
        {
            llSay(0, "Only members of the group " + group_name + " may receive the inclosed item. If you are a member of the group " + group_name + " please put on your gourp tag try again.");
        }
    }
}

 

Add a comment

Send to Mailing List

string CustomerListName = "*** PUT THE NAME OF THE NOTECARD WITH THE LIST OF CUSTOMERS HERE ***";
string GiveItem = "*** PUT THE NAME OF THE CONTENTS-ITEM TO GIVE THE CUSTOMERS HERE ***";
integer LineNo = 0;
key RequestID;

ReadCard()
{
     if ((llGetInventoryType(CustomerListName) == INVENTORY_NOTECARD) && (llGetInventoryType(GiveItem) != INVENTORY_NONE))
     {
          LineNo = 0;
          RequestID = llGetNotecardLine(CustomerListName, LineNo);
     } else {
          llSetText("Customer-list notecard '" + CustomerListName + "' or give-item '" + GiveItem + "' not in inventory, please check them", <1 .0, 1.0, 1.0>, 1.0);
     }
}

default
{
     changed(integer Change)
     {
          if (Change & CHANGED_INVENTORY)
               ReadCard();
     }

     dataserver(key ResponseID, string Data)
     {
          if (ResponseID == RequestID)
          {
               if (Data == EOF)
               {
                    llSetText("Finished: gave to " + (string) LineNo + " customers", <1 .0, 1.0, 1.0>, 1.0);
               } else {
                    RequestID = llGetNotecardLine(CustomerListName, ++LineNo); // Requesting the next line before processing the current one speeds things up slightly
                    llSetText("Giving to customer #" + (string) LineNo + "; " + Data, <1 .0, 1.0, 1.0>, 1.0);
                    llGiveInventory((key) Data, GiveItem);
               }
          }
     }

     state_entry()
     {
          ReadCard();
     }
}

 

Add a comment

Visitor Counter and Landmark Giver

// Simple visitor counter and lm giver script.
//
// Can also run as a simple 'add me to the waiting list' script
// too (i.e. remembers everyone who touches the object).
//
// Just finds the first landmark stored in the prim and
// gives it to non-owners on touch.
//
// For owners, if the prim is touched, presents a simple
// dialog to either list visitors or reset the visitors counts.
//
// Kimm Paulino
// Written for Vikki Hastings, Oct 2010
// Updated for waiting list, Mar 2012
 
// Configure the behaviour we want
integer gWaitingList = FALSE;      // enable waiting list only functionality
integer gLogDates = TRUE;        // Include timestamps in the log
integer gJustDates = FALSE;		 // But only dates (not timestamps)
integer gKeepFirst = FALSE;        // Keep the first visit of someone, not the last
string  gFloatingText = "";  // Set to "" to disable
vector  gFloatingTextColour = <1 .0, 1.0, 1.0>;
float   gFloatingTextAlpha = 1.0;
float   gSensorRange = 15.0;
 
integer MAX_VISITORS = 30;
list gVisitors;
list gVisitorTimes;
integer gVisitorCount;
integer gChannel;
integer gListenHandle;
 
integer getRandomChannel()
{
    // Some magic I got of the SL wiki somewhere ...
    return -llRound(llFrand( llFabs(llSin(llGetGMTclock())) * 1000000 )) - 11;
}
 
listVisitors ()
{
    llOwnerSay("----------------");
    llOwnerSay("Total number of visits: " + (string)gVisitorCount);
    if (gVisitorCount > 0)
    {
        llOwnerSay("Most recent visitors:");
        integer i;
        integer len = llGetListLength(gVisitors);
        for (i=0; i  MAX_VISITORS)
    {
        // Remove first entry in the list
        gVisitors = llDeleteSubList (gVisitors, 0, 0);
        gVisitorTimes = llDeleteSubList (gVisitorTimes, 0, 0);
    }
}
 
default
{
    on_rez (integer start_param)
    {
        llResetScript();
    }
 
    state_entry()
    {
        resetVisitors();
        gChannel = getRandomChannel();
 
        llSetText (gFloatingText, gFloatingTextColour, gFloatingTextAlpha); 
 
        if (!gWaitingList)
        {
            // Range, angle, rate
            // So 5m range, 180 deg, every 5 secs
            llSensorRepeat ("", NULL_KEY, AGENT, gSensorRange, PI, 5.0);
        }
    }
 
    sensor(integer total_number)
    {
        integer i;
        //llSay (0, "Found " + (string)total_number);
        for (i=0 ; i

 

Add a comment

LM, Notecard, Group, URL giver

// Simple lm giver script
//
// Just finds the first landmark stored in the prim and
// gives it on touch.
//
// Also, if configured, will give out a URL or a link to a group.
//
// If a notecard is present in the inventory, it can give that too.
//
// If any of these things are not present, then they will not be
// presented as an option.
//
// Kimm Paulino
// Written for Vikki Hastings, Jan 2011
 
// Configure the behaviour we want
string  gFloatingText = "Click for Landmark";  // Set to "" to disable
vector  gFloatingTextColour = <1 .0, 1.0, 1.0>;
float   gFloatingTextAlpha = 1.0;
 
string gLm1;
string gLm2;
string gNC;
string gUrl="https://wiki.secondlife.com/wiki/User:Kimm_Paulino/Scripts";                    // HTTP URL to give out
string gGroup="OBJECT";        // UUID only for the group or OBJECT if it is to take the prims group
integer gChannel;
 
integer getRandomChannel ()
{
    // Based on http://tali.appspot.com/html/scripting/snippets.html
    // Always leaves 17th bit set (so never a number less than 65535)
    // Always leaves sign bit unset (so is always positive)
    integer pos_int = (((integer)llFrand(16384)) << 17) | 65536 | ((integer)llFrand(65535));
    return -pos_int;
}
 
give_landmark (key av)
{
    if (gLm1 != "")
    {
        llGiveInventory(av, gLm1); 
    }
    if (gLm2 != "")
    {
        llGiveInventory(av, gLm2);
    }
}
 
give_notecard (key av)
{
    if (gNC != "")
    {
        llGiveInventory(av, gNC); 
    }    
}
 
give_link (key av)
{
    if (gUrl != "")
    {
        llLoadURL (av, "Giving Link", gUrl);
    }
}
 
give_group (key av)
{
    if (gGroup != "")
    {
        llWhisper (0, "Click on the following link to join the group\nsecondlife:///app/group/" + gGroup + "/about");
    }
}
 
default
{
    on_rez (integer start_param)
    {
        llResetScript();
    }
 
    state_entry()
    {
        if (gGroup == "OBJECT")
        {
            // Use the group from the prim
            gGroup = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0);
        }
 
        // See if there are landmarks to give out
        gLm1 = llGetInventoryName(INVENTORY_LANDMARK, 0);
        gLm2 = llGetInventoryName(INVENTORY_LANDMARK, 1);
        gNC = llGetInventoryName (INVENTORY_NOTECARD, 0);
 
        llSetText (gFloatingText, gFloatingTextColour, gFloatingTextAlpha);
 
        gChannel = getRandomChannel();
 
        llListen (gChannel, "", "", "");
    }
 
    touch_start(integer total_number)
    {
        list buttons=[];
        if (gLm1 != "")
        {
            buttons += ["Landmark"];
        }
        if (gUrl != "")
        {
            buttons += ["Link"];
        }
        if (gGroup != "")
        {
            buttons += ["Group"];
        }
        if (gNC != "")
        {
            buttons += ["Notecard"];
        }
        integer i;
        for (i=0; i

 

Add a comment

Simple Voting Script

//  Voting script, only allows one vote per avi
//  by JB Kraft
 
 
string thankYouMessage = "Thanks for voting";
string floatText = "Vote for me!";
 
 
//  _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//  _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
integer numberOfVotes;
list listOfVoterNames;
 
update_floattext()
{
//  set white and opaque floattext
    llSetText(floatText + "\n"
        + (string)numberOfVotes + " votes", <1 .0, 1.0, 1.0>, (float)TRUE);
}
 
integer added_vote(key id)
{
//  cut list if memory shortage
    if(llGetFreeMemory() <5000)
        listOfVoterNames = llList2List(listOfVoterNames, -50, -1);
 
    string avatarLegacyName = llKey2Name(id);
 
//  TRUE if found, else FALSE
//  watch out, this is bit-wise NOT (~) not minus (-)
    integer thisAvatarHasVotedAlready = ~llListFindList(listOfVoterNames, [avatarLegacyName]);
 
    if (thisAvatarHasVotedAlready)
        return FALSE;
//  else
//  {
        listOfVoterNames += [avatarLegacyName];
        numberOfVotes = llGetListLength(listOfVoterNames);
 
        update_floattext();
 
        return TRUE;
//  }
}
 
default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
 
    state_entry()
    {
        update_floattext();
    }
 
    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);
 
 
        if( added_vote(id)  && thankYouMessage != "" )
            llInstantMessage(id, thankYouMessage);
    }
}

 

Add a comment