Imani Moseley
Registered User
Join date: 23 Mar 2005
Posts: 34
|
07-22-2005 13:50
I'm looking for a touch script that will give a random object from the object's contents..... give one of say.. 4 or 5 objects, different one each time. Please please please.  Thanks
|
Surreal Farber
Cat Herder
Join date: 5 Feb 2004
Posts: 2,059
|
07-22-2005 14:23
I've been wanting one of these too.
_____________________
Surreal
Phobos 3d Design - putting the hot in psychotic since 2004
Come see our whole line of clothing, animations and accessories in Chaos (37, 198, 43)
|
Angelina Zapata
Registered User
Join date: 12 Apr 2004
Posts: 2
|
07-22-2005 14:26
that would be neataroo
|
Rayve Mendicant
Scripts for L$5 billion
Join date: 12 Mar 2005
Posts: 90
|
07-22-2005 14:30
default { state_entry() { } touch_start(integer total_number) { integer obj_count = llGetInventoryNumber(INVENTORY_OBJECT); // gets number of object's in inventory integer obj_index = (integer)llFrand(obj_count-.00000000001); // chooses a random object index llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,obj_index)); // gives object of random index to toucher } }
_____________________
_______________________ Rayve Mendicant Second Evolution "Darwin ain't got nothin' on this"
|
Imani Moseley
Registered User
Join date: 23 Mar 2005
Posts: 34
|
07-22-2005 15:35
thank you. awesome!
|
Mhaijik Guillaume
Chadeaux Vamp
Join date: 18 Jun 2004
Posts: 620
|
Very cool but ?
07-23-2005 08:09
Is there a way so that it knows who has touched it so that they can only receive one random object ?
|
Rayve Mendicant
Scripts for L$5 billion
Join date: 12 Mar 2005
Posts: 90
|
07-23-2005 09:20
yes, that would require a key_list += llDetectedKey(0), and the comparing teh toucher with the kkey_list before handing the objet over
The problem with this is the list will eventually cause the script to run out of free memory and die. You could probably fit 100 or so i there though. You can use a timer event and llGetFreeMemory() to compare the memory to 200 or so and remove a few of the names from the beginning of the list whne memory runs low.
_____________________
_______________________ Rayve Mendicant Second Evolution "Darwin ain't got nothin' on this"
|
Mhaijik Guillaume
Chadeaux Vamp
Join date: 18 Jun 2004
Posts: 620
|
Visitor counter ?
07-23-2005 11:32
So maybe look at a resetable visitor counter for ideas ?
|
Rayve Mendicant
Scripts for L$5 billion
Join date: 12 Mar 2005
Posts: 90
|
07-23-2005 11:50
Yes, the list manipulation would be similar to the visitor counter
_____________________
_______________________ Rayve Mendicant Second Evolution "Darwin ain't got nothin' on this"
|