Teaching Technology through MUVE

Following the MUVEnation project (MUVE: Multi-User Virtual Environments)

Give Inventory script Video by Shelly Waco

Posted by slandete on Thursday, May 14, 2009

This video made by Michele Ryan (SL name: Shelly Waco) shows the use of the Give Inventory script, useful to deliver materials to students in one go. Just drop the script and the contents you want to deliver in a box and the contents will appear in the inventory of whoever touches the box, nicely stored in a folder. Best part of the video: it features me!

The script can be found here:

default
{
    on_rez(integer nevermind)
    {
        llSetText(""+llGetObjectName()+".",<1,1,1>,1.0);
    }
    touch_start(integer total_number)
    {
//        llGiveInventory(llDetectedKey(0), "Getting Started");

// give all items in a prim to the owner, as folder (with the name of the prim)
// Ezhar Fairlight <efairlight@gmail.com>

// user-friendly additions by Mechanique Thirty (egypt@urnash.com)
// Script adjusted to run faster by Strife Onizuka.

        list        inventory;
        string      name;
        integer     num = llGetInventoryNumber(INVENTORY_ALL);
        string      text = llGetObjectName() + " is transferring...\n";
        integer     i;
        key         user = llDetectedKey(0);//Set to llDetectedKey(0); to allow anyone to use

        for (i = 0; i < num; ++i) {
            name = llGetInventoryName(INVENTORY_ALL, i);
            if(llGetInventoryPermMask(name, MASK_NEXT) & PERM_COPY)
                inventory += name;
            else
                llOwnerSay("Cannot give asset \""+name+"\", owner lacks copy permission");

            llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
        }

        //chew off the end off the text message.
        text = llGetObjectName();

        //we don't want to give them this script
        i = llListFindList(inventory, [llGetScriptName()]);
        inventory = llDeleteSubList(inventory, i, i);    

        if (llGetListLength(inventory) < 1) llSay(0, "Nothing to transfer."); else
        {
            llGiveInventoryList(user, text, inventory);
            llSetText(""+llGetObjectName()+".",<1,1,1>,1.0);
            llOwnerSay("Your new "+ text +" can be found in your inventory, in a folder called '"+ text +"'.");
        }
    }
}
Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

 
%d bloggers like this: