Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

scripting help needed

Isaiah Latrell
Registered User
Join date: 31 Mar 2006
Posts: 9
05-05-2006 18:13
Does anyone know where i can purchased a script that will give you objects at random when is touched ?
Leonard Churchill
Just a Horse
Join date: 19 Oct 2005
Posts: 59
05-06-2006 08:56
If you'd like some ingame tutoring, let me know ingame or via ForumMail. This would be a simple project to teach you the magic of scripting.
_____________________
"Give me a fish and I eat for a day. Teach me to fish and I eat for a lifetime." - Chinese Proverb

Always check the Wiki and/or Script Library
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-06-2006 09:57
Or, if you don't care to have tutoring to accomplish such a simple goal, here's a little script to do that. It only gives objects-- but that can be changed by changing the inventoryType variable, as is explained.

CODE

//Give a random object in the inventory on touch
// Keknehv Psaltery, 5/6/05

//You can change this OBJECT to SOUND , TEXTURE , LANDMARK , CLOTHING ,
// NOTECARD , ANIMATION , BODYPART , or GESTURE
// e.g. "integer inventoryType = INVENTORY_ANIMATION;"
integer inventoryType = INVENTORY_OBJECT;

default
{
touch_start(integer num)
{
integer objectNumber = (integer)llFrand( llGetInventoryNumber( inventoryType ) );
llGiveInventory( llDetectedKey(0),
llGetInventoryName(inventoryType,objectNumber) );
}
}