Landmark Giver

Expired

 It tells the Owner how many Landmarks have been given away when the owner Touches the object. 
(It will not give the owner a Landmark, 'cause that would get annoying everytime you checked the tally.)

 

 

integer given;

default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
    
    state_entry()
    {
        given = 0;
        llOwnerSay("Be sure to only have one landmark in the inventory.");
        llOwnerSay("Touch at any time to see how many Landmarks have been given away!");
        llSetText("Touch for a Landmark", <0.90196, 0.72549, 0.35294>, 1.0);
    }

    touch_start(integer total_number)
    {
        if ( llDetectedKey(0) != llGetOwner() )
        {
            given = given + 1;
            llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_LANDMARK, 0));
        }
        else if ( llDetectedKey(0) == llGetOwner() )
        {
            llOwnerSay((string)given + " landmarks have been given away since this object was rezzed.");
        }
    }
}

 

 

 

Group Add Request

Expired

This script can do two things: It will make a list of all that Touch it, except the owner, and it can Instant Message owner the name of each person Touching as it happens... 


What it cannot do is add people to a group. Unfortunately, that is not yet available in LSL as of now (JAN 2007.)

A good way to use this script is to place it inside of a sign like I have at my store. Check it once or twice a day, reseting the list after getting the current names and adding them manually to group.

IMPORTANT: You must Reset the List before it gets to around 125 or the script will stop working.

 

 

integer sendIM = TRUE; //sends IM to Owner


list names;
integer total;

integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons)
{
    menu_channel = (integer)(llFrand(99999.0) * -1);
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,buttons,menu_channel);
    llSetTimerEvent(15.0);
}

default
{
    on_rez(integer r)
    {
        llResetScript();
    }
    
    state_entry()
    {
        names = [""];
        total = 0;
        llSetText("Touch to join our Group", <0.90196, 0.72549, 0.35294>, 1.0); //Floating Text, edit or remove
        llOwnerSay("Ready... list is reset to 0.");
    }

    touch_start(integer num_detected)
    {
        integer x;
        for(x;x <= num_detected- 1;x++)
        {
            if ( llDetectedKey(x) != llGetOwner() )
        {
                integer find = llListFindList(names,[llDetectedName(x)]);
                if(find < 1)
                {
                    llInstantMessage(llDetectedKey(x), "Your request has been sent. Please be patient and you will be added to the group as soon as possible."); //Message to Toucher
                    names = names+ [llDetectedName(x)];
                    total = total + 1;
                    if (sendIM)
                    {
                        llInstantMessage(llGetOwner(), " " + llDetectedName(x) + " has requested to be added."); //Message to Owner
                    }
                }
                else
                {
                    llInstantMessage(llDetectedKey(x), "You've already requested to be added."); //Message to repeat Toucher
                }
            }
            else if ( llDetectedKey(x) == llGetOwner() )
            {
                llOwnerSay((string)total + " people have Touched me so far!");
                menu(llGetOwner(),"Please Select One",["Show List","Reset", "Turn Off"]);
            }
        }  
    }
    
    timer() 
    {
        llSetTimerEvent(0.0);
        llListenRemove(menu_handler);
    }

    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel) 
        {
            if(message == "Show List")
            {
                integer len = llGetListLength( names );
                integer i;
                for( i = 0; i < len; i++ )
                {
                    integer a = i;
                    llOwnerSay((string)a + " : " + llList2String(names, i));
                }
            }
            else if(message == "Reset")
            {
                llOwnerSay("Clearing List & Reseting Script now.");
                llResetScript();
            }
            else if(message == "Turn Off")
            {
                llOwnerSay("Turning Off Now. Touch again to turn back On.");
                state off;
            }
        }
    }
}

state off
{
    on_rez(integer r)
    {
        llResetScript();
    }
    
    state_entry()
    {
        llSetText("", <0, 0, 0>, 1.0);
    }
    
    touch_start(integer total_number)
    {
        if (llGetOwner())
        {
            llOwnerSay("Turning back On now.");
            llResetScript();
        }
    }
}

 

 

 

Give Random Object

Expired

default
{
    touch_start(integer total_number)
    {
        float totalobjects = llGetInventoryNumber(INVENTORY_OBJECT);
        totalobjects = llFrand(totalobjects);
        llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT, (integer)totalobjects));
    }
}

 

Multi Give Script

Expired

Drop this script and up to 22 objects into a prim. Users Touch for dialog menu, select an item, and that item is given to user.

Objects you are giving away should be Copy/Transfer. This is great for Party Drinks, Vending Machines, and Food Items. 

Button names in menu will be first 10 characters from that item's name.

list object_list;
list object_list2;
key user = NULL_KEY;

composelist()
{
    integer currentobject = 0;
    integer totalobjects = llGetInventoryNumber(INVENTORY_OBJECT);
    
    if(totalobjects > 0 & totalobjects <= 12)
    {
        object_list = [];
        do
        {
            object_list = object_list + llGetInventoryName(INVENTORY_OBJECT, currentobject);
            currentobject++;
        }
        while (currentobject > 0 & currentobject  12 & totalobjects <= 22)
    {
        object_list = ["Next Page"];
        do
        {
            object_list = object_list + llGetInventoryName(INVENTORY_OBJECT, currentobject);
            currentobject++;
        }
        while (currentobject > 0 & currentobject <11);
        
        object_list2 = ["Last Page"];
        do
        {
            object_list2 = object_list2 + llGetInventoryName(INVENTORY_OBJECT, currentobject);
            currentobject++;
        }
        while (currentobject >= 11 & currentobject  22)
    {
        llWhisper(0, "You may only have a maximum of 22 Objects. Please remove any extra ones.");
    }
    if(totalobjects == 0)
    {
        llWhisper(0, "Please add up to 22 Objects to give away. They should be Copy/Transfer.");
    }
}


//The Menu
integer menu_handler;
integer menu_channel;
menu(key user,string title,list object_list)
{
    menu_channel = (integer)(llFrand(99999.0) * -1); //random channel
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,object_list,menu_channel);
    llSetTimerEvent(30.0); //menu channel open for 30 seconds
}

default
{
    state_entry()
    {
        composelist(); //make list from inventory objects
    }

    touch_start(integer total_number)
    {
        user = llDetectedKey(0);
        menu(user,"\n\nPlease select one below.",object_list);
    }
    
    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel) 
        {            
            if(message == "Next Page")
            {
                menu(user,"\n\nPlease select one below.",object_list2);
            }
            else if(message == "Last Page")
            {
                menu(user,"\n\nPlease select one below.",object_list);
            }
            else
            {
                llGiveInventory(user,message); //Give Object
                llSetTimerEvent(0.0);
                llListenRemove(menu_handler);
            }
        }
    }
    
    timer() //Close the Menu Listen or we'll get laggy
    {
        llSetTimerEvent(0.0); 
        llListenRemove(menu_handler);
    }
    
    changed(integer change) 
    {
        if (change & CHANGED_INVENTORY) //inventory has changed
        {
            llSleep(0.5);
            composelist(); //rebuild the list
        }
    }
}