Difference between revisions of "Give random object"

From Second Life Wiki
Jump to navigation Jump to search
(New page: == Yes, the random object giver == Place this in an object with a big inventory (well, doesn't have to have LOTS in it) and touch to recieve any ole random object. //Emmas Seetan //21 ...)
 
Line 3: Line 3:
Place this in an object with a big inventory (well, doesn't have to have LOTS in it) and touch to recieve any ole random object.
Place this in an object with a big inventory (well, doesn't have to have LOTS in it) and touch to recieve any ole random object.


  //Emmas Seetan
  <lsl>//Emmas Seetan
  //21 September, 16:46
  //21 September, 16:46
   
   
Line 14: Line 14:
         llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT, (integer)totalobjects)); //Give any random  object out of the total
         llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT, (integer)totalobjects)); //Give any random  object out of the total
     }
     }
  }
  }</lsl>

Revision as of 09:04, 21 September 2008

Yes, the random object giver

Place this in an object with a big inventory (well, doesn't have to have LOTS in it) and touch to recieve any ole random object.

<lsl>//Emmas Seetan
//21 September, 16:46

default
{
    touch_start(integer total_number)
    {
        float totalobjects = llGetInventoryNumber(INVENTORY_OBJECT); //number of objects
        totalobjects = llFrand(totalobjects); //Total objects
        llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT, (integer)totalobjects)); //Give any random  object out of the total
    }
}</lsl>