# AreaToList

## 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);
var mines,m;
begin
result := 0;
mines := AreaToList(area, 1);
for m := 1 to mines+0 do     //+0 for obtaining the number of variables in the array.
begin
if MineAtPos(mines[m],mines[m]) then
begin
ViewMineAtPos(mines[m],mines[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],[y-coordinates]] is one hex in the area; [[x_coordinates],y-coordinates] 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)