GetStaticTilesArrayEx
Search of Static tile from array TileTypes in bound, limited by Xmin, Ymin, Xmax, Ymax, founded tiles added to FoundTilesArray. Returns found amount.
NB: DWS have overloaded method version, which returns TFoundTilesArray. Length can be taken by Length(array_var) calling.
function GetStaticTilesArrayEx(Xmin : Word; Ymin : Word; Xmax : Word; Ymax : Word; WorldNum : Byte; TileTypes : array of Word; var FoundTilesArray : TFoundTilesArray) : Word;
function GetStaticTilesArrayEx(Xmin : Word; Ymin : Word; Xmax : Word; Ymax : Word; WorldNum : Byte; TileTypes : array of Word; var FoundTilesArray : TFoundTilesArray) : Word;
function GetStaticTilesArrayEx(Xmin : Word; Ymin : Word; Xmax : Word; Ymax : Word; WorldNum : Byte; TileTypes : array of Word) : TFoundTilesArray;
TFoundTile = record
Tile : Word;
X : SmallInt;
Y : SmallInt;
Z : ShortInt;
end;
TFoundTilesArray = Array[0..999] of TFoundTile;
Pascal Example:
var
TyleType : Array [0..23] of Word;
a : TFoundTilesArray;
c,b : Integer;
const
Xmin = 2245;
Xmax = 2426;
Ymin = 2353;
Ymax = 2401;
Begin
TyleType[0] := 3274;
TyleType[1] := 3275;
TyleType[2] := 3276;
///....
TyleType[23] := 3290;
b:= GetStaticTilesArray(Xmin,Ymin,Xmax,Ymax, 0, TyleType, a);
AddToSystemJournal('Tile Count : ' + IntToStr(b));
Wait(500);
for c := 0 to b-1 do
begin
AddToSystemJournal('Идём на тайл '+IntToStr(C)+'!');
NewMoveXY(a[c].X,a[c].Y, False, 1, True);
//...
end;
end.
Python Syntax:
def GetStaticTilesArray(Xmin, Ymin, Xmax, Ymax, WorldNum, TileTypes): --> list
Python Example:
ResourceTiles = set(); Stack = []
def FindResources():
TilesCache = []
global ResourceTiles
for i in [3274, 3275, 3276, 3277, 3280, 3283, 3286, 3289, 3291, 3292, 3294, 3295, 3296, 3299, 3302, 3394, 3395, 3417, 3440, 3461, 4792, 4793, 4794, 4795]:
for t, x, y, z in GetStaticTilesArray(GetX(Self()) - 50, GetY(Self()) - 50, GetX(Self()) + 50, GetY(Self()) + 50, WorldNum(), i):
TilesCache.append((t, x, y, z, 'Logs'))
for i in range(1339, 1359):
for t, x, y, z in GetStaticTilesArray(GetX(Self()) - 50, GetY(Self()) - 50, GetX(Self()) + 50, GetY(Self()) + 50, WorldNum(), i):
TilesCache.append((t, x, y, z, 'Ingots'))
for i in [240, 241, 242, 243]:
for t, x, y, z in GetLandTilesArray(GetX(Self()) - 50, GetY(Self()) - 50, GetX(Self()) + 50, GetY(Self()) + 50, WorldNum(), i):
TilesCache.append((t, x, y, z, 'Ingots'))
ResourceTiles |= set(TilesCache)