Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Formatted Sensor Dialog script by Evil Fool
  2. // You may give this script away for free, but please leave creator information in.
  3. // Next owner MUST have script modify access if any of this code is used in part or whole
  4. //CONFIG
  5. integer gChann = -293190;
  6. integer gStride = 9;
  7. //END CONFIG
  8.  
  9. list names;
  10. integer gPos = 0;
  11. key tReq; //Toucher's key
  12.  
  13. dialog(key id)
  14. {
  15.     integer nTop = gPos + gStride - 1;
  16.     list buttons = llList2List(names, gPos, nTop);
  17.     string msg = llDumpList2String(buttons, "\n");
  18.     while(llGetListLength(buttons) % 3 != 0)
  19.     {
  20.         buttons = llListInsertList(buttons, [" "], gStride);
  21.     }
  22.     if (gPos >= gStride)
  23.     {
  24.         buttons += ["<<"];
  25.     }else{
  26.         buttons += [" "];
  27.     }
  28.     buttons += [" "];
  29.     if (nTop - 1 < llGetListLength(names))
  30.     {
  31.         buttons += [">>"];
  32.     }else{
  33.         buttons += [" "];
  34.     }
  35.    
  36.     llDialog(id, msg, buttons, gChann);
  37. }
  38.  
  39. default
  40. {
  41.     state_entry()
  42.     {
  43.         llListen(gChann, "", NULL_KEY, "");
  44.     }
  45.    
  46.     touch_start(integer num_times)
  47.     {
  48.         if (llDetectedKey(0) == llGetOwner())
  49.         {
  50.             tReq = llDetectedKey(0);
  51.             llOwnerSay("Scanning area...");
  52.             llSensor("", NULL_KEY, AGENT, 25.0, PI); //Senses all agents in a sphere area
  53.         }
  54.     }
  55.    
  56.     sensor(integer num_detected) //When the sensor senses something
  57.     {
  58.         names = [];
  59.         gPos = 0;
  60.         integer i;
  61.         for (i = 0; i < num_detected; i++)
  62.         {
  63.             names = names + llDetectedName(i);
  64.         }
  65.         dialog(tReq);
  66.     }
  67.    
  68.     listen(integer channel, string name, key id, string msg)
  69.     {
  70.         if (msg == ">>")
  71.         {
  72.             gPos = gPos + gStride;
  73.             dialog(id);
  74.         }else if (msg == "<<")
  75.         {
  76.             gPos = gPos - gStride;
  77.             dialog(id);
  78.         }else if (msg == " ")
  79.         {
  80.             llOwnerSay("Sorry, this is just a filler!");
  81.         }else{
  82.             llOwnerSay(msg);
  83.         }
  84.     }
  85. } // END //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement