// Inventory Give or Drop
// Created by Water Rogers for IBM/Opensource
// Purpose
// --------------------------------------------------------------
// This is a simple example of how an object can give inventory
// or how somoene without modify permissions can give the object
// inventory.
// Requirements
// --------------------------------------------------------------
// A single prim is all that is necessary for this example.
// Usage
// --------------------------------------------------------------
// Click on the object, and it will give a notecard. Drop something
// on the object (other then a script), and it will put it into
// the object's inventory.
// EVENTS
// --------------------------------------------------------------
string g_InventoryName = "Test Card"; // Name of the inventory we're giving
default
{
state_entry()
{
// This function is what allows people to drop inventory into
// an object even if they don't have modify permissions. This
// is nice if you want to create a suggestion box, for example.
llAllowInventoryDrop(TRUE);
}
touch_start(integer total_number)
{
// If anyone touches the object, they'll receive inventory from
// the object.
llGiveInventory(llDetectedKey(0), g_InventoryName);
}
changed(integer change)
{
// Changed is used to detect something that changed with the
// object. Textures, links, size, locations, inventory are all
// examples of what can be detected on change. Since we're only
// interested in what's been changed in the inventory, we'll use
// the following check. Also, since we're working with bit masks,
// we need to use bitwise opperands in conditional statements.
if(change & (CHANGED_INVENTORY | CHANGED_ALLOWED_DROP))
{
// This will whisper whenever anything in the inventory
// changes.
llWhisper(0, "Thanks!");
}
}
}