Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer listener;
- integer sensorChannel;
- // range and arc for the sensor
- float range = 100.0;
- float arc = PI;
- list avatarsKeys;
- list avatarsNames;
- menu(key user,integer channel,string title,list buttons)
- {
- listener = llListen(channel,"","","");
- llDialog(user,title,buttons,channel);
- //remove listener if there's no activity in menu
- llSetTimerEvent(20.0);
- }
- integer randomNumber()
- {
- return (integer)(llFrand(99999.0) * -1);
- }
- default
- {
- touch_start(integer total_number)
- {
- if (llDetectedKey(0))
- {
- llSensor("","",AGENT,range,arc);
- }
- }
- sensor(integer total_number)
- {
- integer i;
- key tempId;
- avatarsKeys = [];
- avatarsNames = [];
- i = 0;
- while ((i < total_number) && (i < 12))
- {
- tempId = llDetectedKey(i);
- avatarsKeys = avatarsKeys + tempId;
- avatarsNames = avatarsNames + llKey2Name(tempId);
- i = i+1;
- }
- sensorChannel = randomNumber();
- menu( llDetectedKey(0),sensorChannel,"Select an avatar...",avatarsNames);
- }
- listen(integer channel,string name,key id,string message)
- {
- if (channel == sensorChannel)
- {
- integer pos = llListFindList(avatarsNames,[message]);
- if (pos > -1)
- {
- list InventoryList;
- integer count = llGetInventoryNumber(INVENTORY_OBJECT); // Count of all items in prim's contents
- string ItemName;
- while (count--)
- {
- ItemName = llGetInventoryName(INVENTORY_OBJECT, count);
- if (ItemName != llGetScriptName() )
- InventoryList += ItemName; // add all contents except this script, to a list
- }
- // Give all the items to the toucher, in a folder named as per this prim's name
- llGiveInventoryList(llList2String(avatarsKeys,pos), llGetObjectName(), InventoryList);
- }
- }
- }
- timer()
- {
- llListenRemove(listener);
- llSetTimerEvent(0.0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement