Remoteadmin:admin get agents
From OpenSimulator
(Difference between revisions)
(added missing example using RemoteAdmin PHP Class file) |
JeffKelley (Talk | contribs) m (→PHP 1: Fixed broken Google Code link, replacing with internal page) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 168: | Line 168: | ||
=== PHP 1 === | === PHP 1 === | ||
− | This example needs the RemoteAdmin PHP Class file available [ | + | This example needs the RemoteAdmin PHP Class file available [[RemoteAdmin:RemoteAdmin_Class|here]]. |
<source lang="php"> | <source lang="php"> | ||
Line 186: | Line 186: | ||
?> | ?> | ||
</source> | </source> | ||
− | |||
=== PHP 2 === | === PHP 2 === | ||
<source lang="php"> | <source lang="php"> | ||
+ | <?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")); | ||
Line 216: | Line 216: | ||
* [[Server Commands]] | * [[Server Commands]] | ||
− | [[RemoteAdmin]] | + | |
− | [[ | + | [[Category:RemoteAdmin]] |
+ | [[Category:RemoteAdmin Commands]] |
Latest revision as of 11:39, 16 March 2021
admin_get_agents get information about agents in a given region
Contents |
[edit] 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,...
[edit] Parameters
[edit] 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) |
[edit] 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. |
[edit] Returned Parameters
[edit] Returned Parameters
These parameters are returned by Remote Admin
[edit] Root
parameter | Description | Values |
---|---|---|
success | true | |
regions | Regions for which information is returned. | See regions |
[edit] Regions
parameter | Description | Values |
---|---|---|
name | Name of region | |
id | UUID of region | |
agents | Agents found in the region requested. | See agents |
[edit] 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 |
[edit] Error messages
No error messages
[edit] Notes
- This was introduced in git master commit 3072f25 (OpenSimulator 0.7.6 development).
[edit] Examples
[edit] 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 )
[edit] PHP 1
This example needs the RemoteAdmin PHP Class file available here.
<?php // Including the RemoteAdmin PHP class. include('RemoteAdmin.php'); // Instantiate the class with parameters identical to the Python example above $myRemoteAdmin = new RemoteAdmin('127.0.0.1', 9000, 'secret'); // Invoke admin_save_oar (multiple parameters) $parameters = array('password' => 'plop', 'region_name' => 'test one', 'include_children' => 'false'); $response = $myRemoteAdmin->SendCommand('admin_get_agents', $parameters); print_r($response); ?>
[edit] PHP 2
<?php $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); } ?>