# AreaToList

### From Original War Support Wiki

## **AreaToList**(*Area*:interger, i:integer)

This command returns an area as a list of coordinates.

*Area* must be the identifier for an area (area's name.)

i must be either 0 or 1. If it's 0, then the function returns a list with all coordinates in the area. If it's 1 then the function returns a list with the coodinates of the remotely controlled charges in the area.
If not specified, it is considered as 0.

**Usage**

mylist :=AreaToList(area); mylist :=AreaToList(area, 0);

**Example code**

function ShowMinesInArea(area,side);varmines,m;beginresult:= 0; mines :=AreaToList(area, 1);form := 1tomines[1]+0do//+0 for obtaining the number of variables in the array.beginif MineAtPos(mines[1][m],mines[2][m])thenbeginViewMineAtPos(mines[1][m],mines[2][m],side);result:=result+1;end;end; end;

This function creates a list with the x- and y-coordinates of an area. The list generally looks like this [[x-coordinates],[y-coordinates]]. Coordinates belonging together can be found in the same place in the two interior lists, that is [[x_coordinates][1],[y-coordinates][1]] is one hex in the area; [[x_coordinates][2],y-coordinates[2]] is another. In general [[x-coordinates[n],[y-coordinates][n]] where 'n' is a numbers equal to or less than the amount of values in the list.

The function can also just return the coordinates of the remotely controlled charges in the area.

**Example**

We have an area "spawn_area" which consists of the hexes [5,6] , [5,7] and [6,6]. "area_list" is a local or global variable. SAIL:

area_list =AreaToList(spawn_area,0);

Now area_list = [[5,5,6],[6,7,6]].

CF.

Function ListEnvironmentArea

--Sali 15:54, 25 September 2016 (UTC)