get_nearest_zone_with_flags - ryzom/ryzomcore GitHub Wiki


title: Get Nearest Zone With Flags description: published: true date: 2023-03-12T21:51:03.452Z tags: editor: markdown dateCreated: 2023-03-12T21:49:10.558Z

getNearestZoneWithFlags and getNearestZoneWithFlagsStrict

The getNearestZoneWithFlags and getNearestZoneWithFlagsStrict native AI script functions are used to retrieve the nearest zone from a specified point that matches certain criteria. The difference between the two functions is that getNearestZoneWithFlags takes into account the free space of the zones, while getNearestZoneWithFlagsStrict does not.

Syntax

(Zone: s)getNearestZoneWithFlags(X: f, Y: f, OneOf: s, Mandatory: s) // getNearestZoneWithFlags_ffss_s
(Zone: s)getNearestZoneWithFlags(X: f, Y: f, OneOf: s, Mandatory: s, ExceptProperties: s) // getNearestZoneWithFlags_ffsss_s
(Zone: s)getNearestZoneWithFlagsStrict(X: f, Y: f, OneOf: s, Mandatory: s) // getNearestZoneWithFlagsStrict_ffss_s
(Zone: s)getNearestZoneWithFlagsStrict(X: f, Y: f, OneOf: s, Mandatory: s , ExceptProperties: s] // getNearestZoneWithFlagsStrict_ffsss_s

Arguments

  • X (float): The X position of the point to find the nearest zone from.
  • Y (float): The Y position of the point to find the nearest zone from.
  • OneOf (string): A "|" separated list of zone flags. At least one of these flags must be present in the matching zone.
  • Mandatory (string): A "|" separated list of zone flags. All of these flags must be present in the matching zone.
  • ExceptProperties (string, optional): A "|" separated list of zone flags. The matching zone cannot have any of these flags.

Return value

  • Zone (string): The name of the nearest zone that matches the specified criteria.

Example

($zone)getNearestZoneWithFlags(x, y, "food|rest", "invasion|outpost");

This example retrieves the nearest zone from the point (X,Y) that has at least one of the "food" or "rest" flags and both the "invasion" and "outpost" flags.

($zone)getNearestZoneWithFlagsStrict(x, y, "food|rest", "invasion|outpost", "stayaway");

This example retrieves the nearest zone from the point (X,Y) that has at least one of the "food" or "rest" flags and both the "invasion" and "outpost" flags, but the matching zone cannot have the "stayaway" flag.

⚠️ **GitHub.com Fallback** ⚠️