Goto https://www.stucuk.netGoto https://www.atlanticaonlinewiki.comGoto


From Original War Support Wiki

Revision as of 15:41, 29 September 2016 by Stucuk (Talk | contribs)
Jump to: navigation, search

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.


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

Example code

 function ShowMinesInArea(area,side); 
 var mines,m; 
   result := 0; 
   mines := AreaToList(area, 1); 
   for m := 1 to mines[1]+0 do     //+0 for obtaining the number of variables in the array.
     if MineAtPos(mines[1][m],mines[2][m]) then 
       result := result +1; 

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.

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]].

Function ListEnvironmentArea

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

Personal tools