Remoteadmin:admin get agents

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(PHP)
(PHP)
Line 163: Line 163:
 
==Code==
 
==Code==
 
=== PHP ===
 
=== PHP ===
 +
'''Note: the example below appears to fail on every second call because PHP's stream functions do not close the stream after use, and for some reason OpenSimulator 0.7.5 is not either.  This requires more investigation, but using CURL should work as I believe it does close the stream -- [[User:Justincc|Justincc]] 00:53, 3 April 2013 (UTC)''
 
<source lang="php">
 
<source lang="php">
 
$request = xmlrpc_encode_request("admin_get_agents", array("password" => "plop", "region_name" => "test one", "include_children" => "false"));
 
$request = xmlrpc_encode_request("admin_get_agents", array("password" => "plop", "region_name" => "test one", "include_children" => "false"));

Revision as of 16:53, 2 April 2013

admin_get_agents get information about agents in a given region

Contents

Enabling admin_get_agents

If not all functions are enabled, use admin_get_agents to enable the function in the [RemoteAdmin] section

enabled_methods = admin_get_agents,...

Parameters

Required Parameters

These parameters are required

parameter Description Values
region_name Name of the region to look for agents (or region_id below)
region_id UUID of the region to look for agents (or region_name above)

Optional Parameters

These parameters are optional and do not need to be set

parameter Description Values
include_children If true, then return information about child agents as well as root agents.

Returned Parameters

These parameters are returned by Remote Admin

Root

parameter Description Values
success true
regions Regions for which information is returned. See regions

Regions

parameter Description Values
name Name of region
id UUID of region
agents Agents found in the region requested. See agents

Agents

parameter Description Values
name Name of agent
type Type of agent Npc or User
id UUID of agent
current_parcel_id UUID of parcel the agent is currently over
pos_x X position of the agent
pos_y Y position of the agent
pos_z Z position of the agent
vel_x X velocity of the agent
vel_y Y velocity of the agent
vel_z Z velocity of the agent
lookat_x X gaze direction of the agent
lookat_y X gaze direction of the agent
lookat_z X gaze direction of the agent
is_sat_on_ground true if the agent is sat on the ground
is_sat_on_object true if the agent is sat on an object
is_flying true if the agent is flying

Error messages

No error messages

Notes

  • This was introduced in git master commit 3072f25 (OpenSimulator 0.7.6 development).

Examples

Output

(
    [regions] => Array
        (
            [0] => Array
                (
                    [agents] => Array
                        (
                            [0] => Array
                                (
                                    [lookat_y] => 0.04238708
                                    [lookat_z] => 0
                                    [is_sat_on_ground] => False
                                    [type] => User
                                    [current_parcel_uuid] => fc2f2820-7181-4a9f-8cba-f73d3e14f72e
                                    [name] => John Joe
                                    [uuid] => bb293b8c-4986-4ab4-844a-5d22639f2d75
                                    [vel_y] => 0
                                    [vel_z] => 0
                                    [is_flying] => False
                                    [is_sat_on_object] => False
                                    [pos_x] => 134.6547
                                    [pos_y] => 122.7092
                                    [pos_z] => 25.27129
                                    [vel_x] => 0
                                    [lookat_x] => 0.9991013
                                )

                        )

                    [uuid] => 11111111-bf88-45ac-aace-35bd76426c81
                    [name] => test one
                )

        )

    [success] => 1
)

Code

PHP

'Note: the example below appears to fail on every second call because PHP's stream functions do not close the stream after use, and for some reason OpenSimulator 0.7.5 is not either. This requires more investigation, but using CURL should work as I believe it does close the stream -- Justincc 00:53, 3 April 2013 (UTC)

$request = xmlrpc_encode_request("admin_get_agents", array("password" => "plop", "region_name" => "test one", "include_children" => "false"));
 
$context = stream_context_create(array('http' => array(
    'method' => "POST",
    'header' => "Content-Type: text/xml\r\nConnection: close\r\n",
    'content' => $request
)));
 
$fp = fopen("http://localhost:5000", 'rb', false, $context);
$file = stream_get_contents($fp);
fclose($fp);
 
$response = xmlrpc_decode($file);
if ($response && xmlrpc_is_fault($response)) {
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
    print_r($response);
}
?>

RemoteAdmin RemoteAdmin:Commands

Personal tools
General
About This Wiki