04-10-2008 10:35
Well, this is a beyond simple script, but I thought I'd share anyway, as I did not see anything like it in the library.

Basically, I needed a script that would hand out a one use demo item. But I didn't want people to just "load up" with bunches of demos, rather eliminating the need to buy an item with unlimited uses. So, I wrote the following, which also demonstrates basic use of lists.

CODE

list givelist;
integer delay=3600;//timer in seconds between clearing the list of people who received a demo; here it is an hour.

default
{
state_entry()
{
llSetTimerEvent(delay);
}
touch_start(integer total_number)
{
list receiver=[llDetectedKey(0)];
// to give a different inventory item type,
// replace "INVENTORY_OBJECT" with "INVENTORY_NOTECARD", etc.
if(llListFindList(givelist, receiver)== -1)
{
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT, 0));
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_LANDMARK, 0));
llWhisper(0,"Look for 'Demo' in your inventory");
givelist=givelist+receiver;
}
else llWhisper(0,"Sorry, only one demo an hour per person");

}

timer()
{
givelist=[];
}
}



If anyone sees any gaps in this, do let me know :) Happy demoing!
_____________________


Horses, Carriages, Modern and Historical Riding apparel. Ride a demo horse, play whist, or just loiter. I'm fair used to loiterers.

http://slurl.com/secondlife/Caledon%20Eyre/48%20/183/23/