Advertisement
Gayngel

Untitled

Jan 5th, 2015
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. integer listener;
  2.  
  3. integer sensorChannel;
  4.  
  5.  
  6.  
  7. // range and arc for the sensor
  8.  
  9. float range = 100.0;
  10.  
  11. float arc = PI;
  12.  
  13.  
  14.  
  15. list avatarsKeys;
  16.  
  17. list avatarsNames;
  18.  
  19.  
  20.  
  21. menu(key user,integer channel,string title,list buttons)
  22.  
  23. {
  24.  
  25. listener = llListen(channel,"","","");
  26.  
  27. llDialog(user,title,buttons,channel);
  28.  
  29. //remove listener if there's no activity in menu
  30.  
  31. llSetTimerEvent(20.0);
  32.  
  33. }
  34.  
  35.  
  36.  
  37. integer randomNumber()
  38.  
  39. {
  40.  
  41. return (integer)(llFrand(99999.0) * -1);
  42.  
  43. }
  44.  
  45.  
  46.  
  47. default
  48.  
  49. {
  50.  
  51. touch_start(integer total_number)
  52.  
  53. {
  54.  
  55. if (llDetectedKey(0))
  56.  
  57. {
  58.  
  59. llSensor("","",AGENT,range,arc);
  60.  
  61.  
  62.  
  63. }
  64.  
  65.  
  66.  
  67. }
  68.  
  69. sensor(integer total_number)
  70.  
  71. {
  72.  
  73. integer i;
  74.  
  75. key tempId;
  76.  
  77. avatarsKeys = [];
  78.  
  79. avatarsNames = [];
  80.  
  81. i = 0;
  82.  
  83. while ((i < total_number) && (i < 12))
  84.  
  85. {
  86.  
  87. tempId = llDetectedKey(i);
  88.  
  89. avatarsKeys = avatarsKeys + tempId;
  90.  
  91. avatarsNames = avatarsNames + llKey2Name(tempId);
  92.  
  93. i = i+1;
  94.  
  95. }
  96.  
  97.  
  98.  
  99. sensorChannel = randomNumber();
  100.  
  101.  
  102.  
  103. menu( llDetectedKey(0),sensorChannel,"Select an avatar...",avatarsNames);
  104.  
  105.  
  106.  
  107.  
  108. }
  109.  
  110.  
  111.  
  112. listen(integer channel,string name,key id,string message)
  113.  
  114. {
  115.  
  116. if (channel == sensorChannel)
  117. {
  118.  
  119. integer pos = llListFindList(avatarsNames,[message]);
  120.  
  121. if (pos > -1)
  122.  
  123. {
  124.  
  125. list InventoryList;
  126. integer count = llGetInventoryNumber(INVENTORY_OBJECT); // Count of all items in prim's contents
  127. string ItemName;
  128. while (count--)
  129. {
  130. ItemName = llGetInventoryName(INVENTORY_OBJECT, count);
  131. if (ItemName != llGetScriptName() )
  132. InventoryList += ItemName; // add all contents except this script, to a list
  133. }
  134. // Give all the items to the toucher, in a folder named as per this prim's name
  135. llGiveInventoryList(llList2String(avatarsKeys,pos), llGetObjectName(), InventoryList);
  136.  
  137. }
  138.  
  139. }
  140.  
  141. }
  142.  
  143. timer()
  144.  
  145. {
  146.  
  147. llListenRemove(listener);
  148.  
  149. llSetTimerEvent(0.0);
  150.  
  151. }
  152.  
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement