See also: ...
See also: ...

GetFieldId

Usage:

GetFieldId(coords)

Example:

coords = "460,355"
echo GetFieldId(coords)

This function converts coordinates into a field id.

The field id is a number between 0-63999. Each number directly corresponds to a square on the 800x800 grid map. The game server uses field ids to reference all the squares on the map... 0,0 has field id of 0.... 1,0 has field id of 1... 799,0 has field id of 799... 1,1 is field id 800... and so on. Many of the advanced scripting functions require you to convert your coordinates into fieldIds to use them.

This example finds the coordinates of a field id:

FieldIdToCoords

Usage:

FieldIdToCoords(fieldId)

Example:

fid = 284460
echo FieldIdToCoords(fid)

This function converts a field id into coordinates.

This example finds the coordinates of a field id:

MapDistance

Usage:

MapDistance(x1,y1,x2,y2)

Example:

MapDistance(123,456,111,222)

This function finds the distance between two sets of coordinates on the map.

This example finds the distance between your own city and target coordinates, rounded to 2 decimal places:

FormatDistance

Usage:

FormatDistance(fieldId1,fieldId2)

Example:

FormatDistance(12345,23456)

This function finds the distance between two field ids and displays it in a nice readable format.

Basic example:

This example finds the distance between your own city and a target coordinates:

GetLevel

Usage:

GetLevel(fieldId)

Example:

GetLevel(city.fieldId)

This function returns the level of whatever is located at a certain field id.

MapFunctions (last edited 2014-12-26 21:29:21 by Inanna)