[TUTOR] Giving all items from Contents tab (script)

September 2, 2008 at 3:26 pm | Posted in » General, » Tutorials | 1 Comment
Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Tired of giving things to people with the “Buying” method? Want to give someone a free item without them having to do the long right click -> Buy/Open?? No worry, there is an easier way to solve this with a little scripting—-Folks can get the contents of the object with only a simple left-click.


First we need the object/prim that will be the content giver, it could be any object. I will use the simple plywood cube for example.

Next we’ll give our object a name in the General tab.

Why give a name? Great question. The name of the object will be our folder name once we’ve got a copy from the contents of the object. It automatically sets it to be the folder’s name.

We shall now put the contents you want to give (e.g. a notecard, clothing, object, sound, etc’). It can be any item. But if it’s more than one, better make a folder within your inventory and put them in the folder, *then* drop them into the Contents tab.

I will put a single Pink Carpet that I want to give for free. Do not worry—-a copy of the object will still be in your inventory. Unless it’s a non-copy permission object.

Finally, we now make the script that will give the contents to whoever touches the object.

Copy & Paste these following lines to a new script—-Make a new script by clicking the “New Script..” button. (remember to delete any other lines that are in the default new script before! Or else the script won’t work).

Script by Belita Tandino:


//For integer owneronly if it equals 0, anyone can recieve contents, if it is 1, only the owner can.
integer owneronly = 0;
key owner;
list gInventoryList;
list getInventoryList()
integer    i;
integer    n = llGetInventoryNumber(INVENTORY_ALL);
list          result = [];

for( i = 0; i < n; i++ )
result += [ llGetInventoryName(INVENTORY_ALL, i) ];
return result;
owner = llGetOwner();

gInventoryList = getInventoryList();

touch_start(integer total_number)
integer i;
for (i=0;i<total_number;i++)
key target = llDetectedKey(i);

if ( (target != owner) && (owneronly == 1) )  // person clicking isn’t owner and owneronly is set;
llInstantMessage(target,”Sorry, only the owner is allowed to get my contents.”);
llGiveInventoryList(llDetectedKey(i), llGetObjectName(), gInventoryList );
changed( integer change )
if ( change == CHANGED_INVENTORY )
gInventoryList = getInventoryList();


Save the script and close it. You will get a “Compile successful, saving…”. After it being saved: “Save complete.”

Close the script window and touch your object—-Accept the offer and look in your Inventory for a folder named as the contents giver’s name.

There you have it :) Well done!


1 Comment »

RSS feed for comments on this post. TrackBack URI

  1. […] that automatically sends you a copy when you click the object, a tutorial on that can be found Here. Your storage items can be found under the Objects folder within your […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: