Skip to content

getx

Syntax

getx()
getx(place_name)

Parameters

place_name
The name of a place that the agent can visit.

Returns

With no argument, this returns the x-coordinate of the agent itself.

If place_name is provided, then the x-coordinate of the agent's site for this place is returned.

Description

This action returns the horizontal (x) coordinate of the agent itself if no argument is provided. Otherwise it returns the horizontal coordinate of the agent's site for the given place name. For example, getx(Workplace) returns the horizontal coordinate of the agent's specific Workplace site.

The given coordinate is the distance in meters from the western edge of the simulation area, as defined by the locations declared in the simulation block for the program.

If the current agent is not a member of the given place, then an error will occur. For example, it is an error to call getx(School) if the current agent does not attend a school.

Examples

The following example retrieves the x-coordinate of the current agent's household.

getx(Household)

See Also