Advertisement
afro707

Untitled

Apr 29th, 2023
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //start_unprocessed_text
  2. /*integer RANGE = 10; /|/ range in meters to detect objects
  3. integer TOUCH_DELAY = 1; /|/ delay in seconds between touches
  4.  
  5. default
  6. {
  7.     on_rez(integer start_param)
  8.     {
  9.         llSensorRepeat("", "", AGENT, RANGE, PI, TOUCH_DELAY);
  10.     }
  11.    
  12.     sensor(integer num_detected)
  13.     {
  14.         for (integer i = 0; i < num_detected; i++)
  15.         {
  16.             key detected_object = llDetectedKey(i);
  17.             if (llGetInventoryType(llGetInventoryName(detected_object, 0)) == INVENTORY_OBJECT && llGetObjectType(detected_object) == OBJECT_TYPE_PRIM)
  18.             {
  19.                 llSay(0, "Touching object: " + llDetectedName(i));
  20.                 llSetTouchText("Touched");
  21.                 llTouchObject(detected_object);
  22.                 llSleep(TOUCH_DELAY);
  23.             }
  24.         }
  25.     }
  26. }
  27. */
  28. //end_unprocessed_text
  29. //nfo_preprocessor_version 0
  30. //program_version Firestorm-Releasex64 6.6.8.68380 - afro707
  31. //last_compiled 04/29/2023 16:23:09
  32. //mono
  33.  
  34.  
  35.  
  36.  
  37. integer RANGE = 10;
  38. integer TOUCH_DELAY = 1;
  39.  
  40. default
  41. {
  42.     on_rez(integer start_param)
  43.     {
  44.         llSensorRepeat("", "", AGENT, RANGE, PI, TOUCH_DELAY);
  45.     }
  46.    
  47.     sensor(integer num_detected)
  48.     {
  49.         for (integer i = 0; i < num_detected; i++)
  50.         {
  51.             key detected_object = llDetectedKey(i);
  52.             if (llGetInventoryType(llGetInventoryName(detected_object, 0)) == INVENTORY_OBJECT && llGetObjectType(detected_object) == OBJECT_TYPE_PRIM)
  53.             {
  54.                 llSay(0, "Touching object: " + llDetectedName(i));
  55.                 llSetTouchText("Touched");
  56.                 llTouchObject(detected_object);
  57.                 llSleep(TOUCH_DELAY);
  58.             }
  59.         }
  60.     }
  61. }
  62.  
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement