Tuesday 29 March 2011

Sample Aurora NPC Scripts: Get a list of all bots in region

This one will generate a list of all the bots in the region along with locations.
This in theory could be used to parse out the bots and pass them to some kind of menu list from which you could choose a bot's actions.




// ----------------------------------------------------------------
// Example / Sample Script to show function use.
//
// Script Title: osGetAgents.lsl
// Script Author: WSM
// Threat Level: None
// Script Source: SUPPLEMENTAL http://opensimulator.org/wiki/osGetAgents
//
// Notes: See Script Source reference for more detailed information
// This sample is full opensource and available to use as you see fit and desire.
// Threat Levels only apply to OSSL & AA Functions
// See http://opensimulator.org/wiki/Threat_level
//================================================================
// C# Source Line: public LSL_List osGetAgents()
// Inworld Script Line: list osGetAgents();
//
// Example of osGetAgents
//
//default
//{
// state_entry()
// {
// llSay(0, "Touch to get a List of Avatars on this Region using osGetAgents");
// }
// touch_start(integer num)
// {
// llSay(0, "The Avatars located here are: "+ llList2CSV(osGetAgents()));
// }
//}

default
{
state_entry()
{
llSetText("Touch to get a list of bots and UUIDs", <1,0,0>, 1.0);;
}
touch_start(integer total_number)
{
list avatars = osGetAvatarList(); //creates a Strided List (3 strides)
llSay(0, "UUID, Position, AvatarName, on this Region (without the owner):\n" + llList2CSV(avatars));
}
}

No comments:

Post a Comment