Remoteadmin:admin get agents

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(PHP)
m (PHP 1: Fixed broken Google Code link, replacing with internal page)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
'''admin_get_agents''' get information about agents in a given region
 
'''admin_get_agents''' get information about agents in a given region
  
= Enabling admin_get_agents =
+
=== Enabling admin_get_agents ===
 
If not all functions are enabled, use admin_get_agents to enable the function in the [RemoteAdmin] section
 
If not all functions are enabled, use admin_get_agents to enable the function in the [RemoteAdmin] section
 
<source lang="csharp">
 
<source lang="csharp">
Line 7: Line 7:
 
</source>
 
</source>
  
= Parameters =
+
== Parameters ==
== Required Parameters ==
+
=== Required Parameters ===
 
These parameters are required
 
These parameters are required
 
{| cellspacing="0" cellpadding="4" border="1"
 
{| cellspacing="0" cellpadding="4" border="1"
Line 25: Line 25:
 
|}
 
|}
  
== Optional Parameters ==
+
=== Optional Parameters ===
 
These parameters are optional and do not need to be set
 
These parameters are optional and do not need to be set
  
Line 40: Line 40:
  
 
== Returned Parameters ==
 
== Returned Parameters ==
 +
=== Returned Parameters ===
 
These parameters are returned by Remote Admin
 
These parameters are returned by Remote Admin
  
Line 113: Line 114:
 
|}
 
|}
  
= Error messages =
+
 
 +
=== Error messages ===
 
No error messages
 
No error messages
  
= Notes =
+
 
 +
== Notes ==
 
* This was introduced in git master commit 3072f25 (OpenSimulator 0.7.6 development).
 
* This was introduced in git master commit 3072f25 (OpenSimulator 0.7.6 development).
  
= Examples =
+
 
== Output ==
+
== Examples ==
 +
=== Output ===
 
<pre>
 
<pre>
 
(
 
(
Line 161: Line 165:
 
</pre>
 
</pre>
  
==Code==
+
 
=== PHP ===
+
=== PHP 1 ===
'''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)''
+
 
 +
This example needs the RemoteAdmin PHP Class file available [[RemoteAdmin:RemoteAdmin_Class|here]].
 +
 
 +
<source lang="php">
 +
<?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);
 +
?>
 +
</source>
 +
 
 +
=== 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 186: Line 212:
 
</source>
 
</source>
  
[[RemoteAdmin]]
+
= See Also =
[[RemoteAdmin:Commands]]
+
 
 +
* [[Server Commands]]
 +
 
 +
 
 +
[[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);
}
?>

[edit] See Also

Personal tools
General
About This Wiki