Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking for two scripts i didnt see in the library

Stefanii Gorham
Registered User
Join date: 18 May 2005
Posts: 30
12-03-2005 11:56
I'm looking for a script that when you touch an item you get a random thing that is put inside of it. Similar to the gumball machines.

I'm also looking for a script that when you touch it changes a texture. If someone does know about this one, i want to be able to change between one and two prims of the same texture. Its for my crib. I want to change the blankets but on one I have a box, then a flat prim on top. So I'd like to change both of those to something else. If I need to adjust something in it to accomodate both the 1 and 2 prim blankets please tell me in new player terms. I'm super new at this. TY!
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
12-03-2005 13:50
Here is an example to give a random item in the inventory of the prim...
CODE

default
{
touch_start(integer num_detected)
{
integer x;
integer numInventoryItems = llGetInventoryNumber(INVENTORY_ALL); //Get # of items in the inventory
string randomInventoryName;

//Loop through the number of avatars that clicked us last...
for (x = 0; x < num_detected; x++)
{
//Get the name of a random item in the inventory
randomInventoryName = llGetInventoryName(INVENTORY_ALL, (integer)llFrand(numInventoryItems));

//Give the item to the Detected Key of the avatar that touched us
llGiveInventory(llDetectedKey(x), randomInventoryName);
}
}
}