Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. list choices = ["Accept"];
  2. string msg = "You have been infected! Become a Zombie?";
  3.  
  4. integer channel_dialog;
  5. integer dlgHandle = -1;
  6.  
  7. list avatarList = [];
  8. list keyList = [];
  9. key keyvar;
  10. integer index;
  11.  
  12.  
  13. reset()
  14. {
  15. llSetTimerEvent(0.0);
  16. llListenRemove(dlgHandle);
  17. dlgHandle = -1;
  18. }
  19.  
  20. default
  21. {
  22. touch_start(integer total_number)
  23. {
  24. llOwnerSay("Scanning...");
  25. avatarList = [];
  26. // Look for any avatars within 10m.
  27. llSensor("", NULL_KEY, AGENT, 96.0, PI);
  28. }
  29. sensor(integer num_detected)
  30. {
  31. integer i;
  32. while((i < num_detected) && (i < 9))
  33. {
  34. if (llDetectedKey(i) != llGetOwner())
  35. {
  36. avatarList += [llDetectedName(i)];
  37. keyList += [llDetectedKey(i)];
  38. }
  39. ++i;
  40. }
  41. if (llGetListLength(avatarList) > 0)
  42. {
  43. state select;
  44. }
  45. }
  46. }
  47.  
  48. state select
  49. {
  50. state_entry()
  51. {
  52. channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
  53.  
  54. // Set up a listener to detect button clicks.
  55. dlgHandle = llListen(channel_dialog, "", llGetOwner(), "");
  56.  
  57. // Start a new timer.
  58. llSetTimerEvent(30.0);
  59.  
  60. // Add a 'Cancel' button.
  61. avatarList += ["Cancel"];
  62.  
  63. // Display the dialog.
  64. llDialog(llGetOwner(), "Please select an avatar.", avatarList, channel_dialog);
  65. }
  66.  
  67. listen(integer channel, string name, key id, string message)
  68. {
  69. if ((channel == channel_dialog) && (llListFindList(avatarList, [message]) != -1))
  70. {
  71. if (message != "Cancel")
  72. {
  73. index = llListFindList(avatarList,[message]);
  74. keyvar=llList2Key(keyList,index);
  75. llSay(0,(string)index);
  76. llSay(0,(string)keyvar);
  77. llSay(0,llList2String(avatarList,index));
  78.  
  79. llListenRemove(dlgHandle);
  80. dlgHandle = llListen(channel_dialog, "", keyvar, "");
  81.  
  82. llDialog(keyvar, msg, choices, channel_dialog);
  83. llSay(0,"T3");
  84. if(id != llGetOwner())
  85. {
  86. llSay(0,"T2"); //is not reached
  87. if( id == keyvar)
  88. {
  89. llSay(0,"T1");
  90. if(message=="Accept")
  91. {
  92. llSay(0,"ACCEPTEDDDDDOMFGF");
  93. llSay(0,"T");
  94. }
  95. }
  96. }
  97.  
  98. }
  99. else
  100. {
  101. reset();
  102. state default;
  103. }
  104. }
  105. }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement