- adding osGetAgents() which returns a list of all avatars in the region

in which the script is running.

 -  found a bag of space characters under my desk, thought i'd donate them
    to the JSON OSSL function (aka clean up)
0.6.5-rc1
Dr Scofield 2009-03-26 12:08:18 +00:00
parent 3ca1481c3d
commit c8aaf538e4
3 changed files with 79 additions and 46 deletions

View File

@ -582,6 +582,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return "";
}
// Get a list of all the avatars/agents in the region
public LSL_List osGetAgents()
{
// threat level is None as we could get this information with an
// in-world script as well, just not as efficient
CheckThreatLevel(ThreatLevel.None, "osGetAgents");
LSL_List result = new LSL_List();
foreach (ScenePresence avatar in World.GetAvatars())
{
result.Add(avatar.Name);
}
return result;
}
// Adam's super super custom animation functions
public void osAvatarPlayAnimation(string avatar, string animation)
{
@ -1038,10 +1053,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// clear the key
currentKey = null;
break;
case '}':
// pop the hashtable off the stack
objectStack.Pop();
break;
case '"':// string boundary
string tokenValue = "";
@ -1080,12 +1097,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
case ':':// key : value separator
// just ignore
break;
case ' ':// spaces
// just ignore
break;
case '[': // array start
ArrayList currentArray = new ArrayList();
@ -1102,13 +1122,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
objectStack.Push(currentArray);
break;
case ',':// seperator
// just ignore
break;
case ']'://Array end
// pop the array off the stack
objectStack.Pop();
break;
case 't': // we've found a character start not in quotes, it must be a boolean true
if (objectStack.Peek().ToString() == "System.Collections.ArrayList")
@ -1124,6 +1147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//advance the counter to the letter 'e'
i = i + 3;
break;
case 'f': // we've found a character start not in quotes, it must be a boolean false
if (objectStack.Peek().ToString() == "System.Collections.ArrayList")
@ -1138,12 +1162,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//advance the counter to the letter 'e'
i = i + 4;
break;
case '\n':// carriage return
// just ignore
break;
case '\r':// carriage return
// just ignore
break;
default:
// ok here we're catching all numeric types int,double,long we might want to spit these up mr accurately
// but for now we'll just do them as strings

View File

@ -69,6 +69,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
// Avatar Info Commands
string osGetAgentIP(string agent);
LSL_List osGetAgents();
// Teleport commands
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);

View File

@ -175,6 +175,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetAgentIP(agent);
}
public LSL_List osGetAgents()
{
return m_OSSL_Functions.osGetAgents();
}
// Animation Functions
public void osAvatarPlayAnimation(string avatar, string animation)