Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Auto give item

Perwin Rambler
Registered User
Join date: 24 Mar 2005
Posts: 152
05-04-2005 11:10
I am working on a script where I will *Shoot* an item to another avatar.

This I should be able to work out as I have scripts to compare to.

What I would like for this object to do is give it's contents, except for it's script, to the avatar it hits then I want it to de-rez or "die"

I am at work right now, slow day, but can't dig through the LSL pdf, and I am not quite sure what it is I am looking for. but does anyone out there know how to do this?

Also if the item can be given without the user having to hit accept would be a great bonus.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
05-04-2005 14:26
Well. Quick and dirty.

CODE
list inventory = []; // Initialization Only!
string folder_name = "Stuff"; // Name of Folder Contents Will Be Contained In

default
{
changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
integer count = llGetInventoryNumber(INVENTORY_ALL);
integer i = 0;
string script_name = llGetScriptName();

inventory = []; // Reinitialize inventory list.

while(i < count)
{
string name = llGetInventoryName(INVENTORY_ALL,i);
if(name != script_name)
inventory += name;
++i;
}

}
}

collision(integer total_number)
{
integer i;
for(i = 0; i < total_number; ++i)
if(llGetAgentSize(llDetectedKey(i)) != <0,0,0>)
llGiveInventoryList(llDetectedKey(i),folder_name,inventory);
llDie();
}
}

And yes, they will have to "Ok" the transaction.
_____________________
---
Legith Fairplay
SL Scripter
Join date: 14 Jul 2004
Posts: 189
05-04-2005 14:40
From: Perwin Rambler

I am at work right now, slow day, but can't dig through the LSL pdf, and I am not quite sure what it is I am looking for. but does anyone out there know how to do this?

The best LSL reference out there is the badgeometry wiki, currently hosted at http://secondlife.com/badgeo/

Much more detailed, up to date, accurate, and easier to understand than the PDF. (unless you found some pdf I don't know about)
_____________________
Butterflies and other creations at:
Legith's Island Park Lozi(44,127)
And on slexchange.com