Skip to content

add_site

Syntax

add_site(place, site_id, latitude, longitude)

Parameters

place
A valid place name.
site_id
The ID for the new site.
latitude
The latitude for the new site.
longitude
The longitude for the new site.

Description

This action adds a new site to the place parameter, assigning the site the values specified by the site_id, latitude, and longitude parameters.

The agent creating a site with this action becomes a member of the new site. If the agent is either a group agent or a meta agent, add_site will only add the site and not join it.

Sites can alternatively be defined for a given place type in the place block. For example:

place my_place {
    site = 1, 48.8566, 2.3522
    site = 2, 51.5072, 0.1276
}
A runtime error occurs if either place or site_id does not evaluate to a valid ID.

Examples

Suppose a place called Stadium exists to represent American football stadiums, and we want to add sites for the Pittsburgh Steelers' stadium and the Baltimore Ravens' stadium. The following lines would add these sites, and make the agent performing the action a member (or attendee) of the two stadiums.

# Add the actual locations for the Steelers' and Ravens' stadiums.
add_site(Stadium, 100, 40.446686, -80.015851)
add_site(Stadium, 200, 39.273498, -76.620330)

See Also