Previous topic

Modules

Next topic

agentdomain

This Page

agent

class pyogp.lib.base.agent.Home(params)

contains the parameters describing an agent’s home location as returned in login_response[‘home’]

initialize the Home object by parsing the data passed in

class pyogp.lib.base.agent.Agent(settings=None, firstname='', lastname='', password='', agent_id=None, events_handler=None, handle_signals=True)

The Agent class is a container for agent specific data.

Example, of login via the agent class: Initialize the login class

>>> client = Agent()
>>> client.login('https://login.agni.lindenlab.com/cgi-bin/login.cgi', 'firstname', 'lastname', 'secret', start_location = 'last')

Sample implementations: examples/sample_agent_login.py Tests: tests/login.txt, tests/test_agent.py

initialize this agent

Name()
returns a concatenated firstname + ‘ ‘ + lastname
enable_callbacks()
enable the Agents() callback handlers for packet received events
fly(flying=True)
Start or stop flying
give_money(target_id, amount, description='', transaction_type=5001, flags=0)
Give money to another agent
instant_message(ToAgentID=None, _Message=None, _ID=None)
sends an instant message to another avatar, wrapping Agent().send_ImprovedInstantMessage() with some handy defaults
login(loginuri, firstname=None, lastname=None, password=None, login_params=None, start_location=None, handler=None, connect_region=True)
login to a login endpoint using the Login() class
logout()
logs an agent out of the current region. calls Region()._kill_coroutines() for all child regions, and Region().logout() for the host region
onAgentDataUpdate(packet)
callback handler for received AgentDataUpdate messages which populates various Agent() attributes
onAgentGroupDataUpdate(packet)
callback handler for received AgentGroupDataUpdate messages which updates stored group instances in the group_manager
onAgentMovementComplete(packet)
callback handler for received AgentMovementComplete messages which populates various Agent() and Region() attributes
onAlertMessage(packet)
callback handler for received AlertMessage messages. logs and raises an event
onChatFromSimulator(packet)
callback handler for received ChatFromSimulator messages which parses and fires a ChatReceived event.
onEnableSimulator(packet)
callback handler for received EnableSimulator messages. stores the region data for later connections
onEstablishAgentCommunication(message)
callback handler for received EstablishAgentCommunication messages. try to enable the event queue for a neighboring region based on the data received
onHealthMessage(packet)
callback handler for received HealthMessage messages which populates Agent().health
onImprovedInstantMessage(packet)
callback handler for received ImprovedInstantMessage messages. much is passed in this message, and handling the data is only partially implemented
onTeleportFinish(packet)
Handle the end of a successful teleport
request_agent_names(agent_ids, callback)
Request agent names. When all names are known, callback will be called with a list of tuples (agent_id, first_name, last_name). If all names are known, callback will be called immediately.
request_balance(callback)
Request the current agent balance.
say(_Message, Type=1, Channel=0)

queues a packet to send open chat via ChatFromViewer

Channel: 0 is open chat Type: 0 = Whisper

1 = Say 2 = Shout
sendDynamicsUpdate()
Called when an ObjectUpdate is received for the agent; raises an app event.
send_AgentDataUpdateRequest()
queues a packet requesting an agent data update
send_ImprovedInstantMessage(AgentID=None, SessionID=None, FromGroup=None, ToAgentID=None, ParentEstateID=None, RegionID=None, Position=None, Offline=None, Dialog=None, _ID=None, Timestamp=None, FromAgentName=None, _Message=None, BinaryBucket=None)
sends an instant message packet to ToAgentID. this is a multi-purpose message for inventory offer handling, im, group chat, and more
send_MapNameRequest(region_name, callback)
sends a MapNameRequest message to the host simulator
send_RetrieveInstantMessages()
asks simulator for instant messages stored while agent was offline
send_UUIDNameRequest(agent_ids, callback)
sends a UUIDNameRequest message to the host simulator
sigint_handler(signal_sent, frame)
catches terminal signals (Ctrl-C) to kill running client instances
simple_callback(blockname)
Generic callback creator for single-block packets.
sit_on_ground()
Sit on the ground at the agent’s current location
stand()
Stand up from sitting
teleport(region_name=None, region_handle=None, region_id=None, position=(128.0, 128.0, 128.0), look_at=(128.0, 128.0, 128.0))
Initiate a teleport to the specified location. When passing a region name it may be necessary to request the destination region handle from the current sim before the teleport can start.