title: How to create an animate-on-touch attachment with permission system in LSL?
body: <p>I would like to create an object that, when clicked by a specific person and only that person, it will animate the wearer of the object. When clicked a second time, the animation stops. I already have a script which animates on touch but now I need to implement some kind of permission system. I have effectively no scripting experience so I just find scripts others made or haphazardly tinker. In this case, I am not finding solutions.</p>
  
  <p>Here's the script I currently have:</p>
  
  <pre><code>integer playing;
  
  default
  {
      state_entry()
      {
          playing = FALSE;
      }
      touch_start(integer start_param)
      {
          if(playing == FALSE)
          {
              llRequestPermissions(llDetectedKey(0),PERMISSION_TRIGGER_ANIMATION);
          }
          else if(playing == TRUE)
          {
              llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
              playing = FALSE;
          }
      }
      run_time_permissions(integer perm)                                  
      {
          if (perm &amp; PERMISSION_TRIGGER_ANIMATION)
          {
              playing = TRUE;
              llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
          }
      }    
  }
  </code></pre>
  
  <p>If I implement a permission system, how would I do that? Where in the code should I put it? Also, if I wanted the object to say or whisper something when clicked by the permitted person, how can I do that? I am also open to being directed to alternative scripts that get closer to what I want, if available and preferably modifiable.</p>
  
  <p>Thanks in advance for any assistance.</p>