[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;
}
default
{
state_entry()
{
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.”);
return;
}
{
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!

Advertisements

[TUTOR] How to unpack boxed items

August 9, 2008 at 1:15 pm | Posted in » General, » Tutorials | 2 Comments
Tags: , , , , , , , , , , , , , , , , , , , , , , , ,

If you have got an item that is “boxed”, then it means the real items are in the Contents tab. How do you get them?

Go to your Inventory (The icon at the bottom of the screen, next to Mini-Map).

Under Objects folder, you can see your boxed item. Select that item and simply drag it to the ground.

Now that you have rezzed your boxed item; right click from the pie menu and choose “Open”. Now copy the items to your Inventory.

Open your Inventory window and under “My Inventory” you can find your items. E.g. If it’s just an object, you can find it under Objects folder. If it’s just an animation, you can find it under Animations folder, and so on. But if it’s a whole folder, you will see it under “My Inventory” in its own folder.

Have fun!

Blog at WordPress.com.
Entries and comments feeds.