Touch start

From InWorldz Wiki
Jump to: navigation, search

Event: touch_start( integer num_detected)

Triggered when an agent (avatar) left-clicks an object.

Code Examples:

//Gives a random object from contents when someone touches the object
   touch_start( integer count){
       integer tlInv = llGetInventoryNumber( INVENTORY_OBJECT);// determine total number of items in the object Contents
       integer item = (integer)llFrand( (float) tlInv);  // pick an object by random number
       llGiveInventory( llDetectedKey(0), llGetInventoryName( INVENTORY_OBJECT, item)); // give the object to the avatar who clicked the object