Don't click here unless you want to be banned.

LSL Wiki : LibraryComandToAgent

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are ia360925.us.archive.org

Comand to Agent


*This script is a very useful tab that I have used frequently for my items in-game. Its great for comanding items to other people, which can be useful at times.*

NOTE- This can also be used with nonphys objects, and follows anyone that you comand it to within a 96 meter radius

//////////// Comand to Agent ////////////
///Created by Joker Opus, June 21 2006.///
//If I made any mistakes, please correct them, do not ruin the script//

default
{
         state_entry()
         {
             llListen(1,"",llGetOwner(),""); //This obviously shows that it listens to the owner on channel 1
         }
         on_rez(integer start_param)
         {  
             llResetScript(); // This allows it to listen to the next owner. because if it doesnt reset, it will continue to listen to the maker.
         }
         listen(integer channel, string name, key id, string msg)
         {
            
            if (msg == name)
             {
              llSensorRepeat(name, NULL_KEY, AGENT,96, PI_BY_TWO, 0.001) // This is what calls the sensor, and it will make it scan for the agent
             }
             else if (msg == id)
             {      
             //Incase the target is called as a key
              llSensorRepeat(name, NULL_KEY, AGENT,96, PI_BY_TWO, 0.001) 
 
              llSetPos(llDetectedName(0)); 
              }
              else if (msg == "stop")
              {
              llSensorRemove(); //If you want to stop the target following
              }
         }
         sensor(integer total_number)
         {
             llSetPos(llDetectedName(0)); 
             llSetPos(llDetectedKey(0)); //Incase the agent calls a key
         }
         no_sensor()
         {
             llInstantMessage(llGetOwner, "Could not find an agent in that range.");
         }

}

I DID make this outside of SL, so..
Please correct the issues i made in this script
There are 4 comments on this page. [Display comments/form]