GetUserStaticsHigh
Returns the last user static ID issued by AddUserStatic (Python: CreateUserStatic), or -1 if none has been issued since start or since the last ClearUserStatics.
This is the upper bound for iterating user statics with GetUserStatic, the same way High is for an array. It is not the number of statics: RemoveUserStatic leaves holes in the numbering and does not lower this value, so check the result of GetUserStatic for every ID.
Also returns -1 if UO data is not loaded.
Возвращает последний ID пользовательского статика, выданный AddUserStatic (Python: CreateUserStatic), или -1, если с момента запуска или последнего ClearUserStatics ни одного не выдавалось.
Это верхняя граница для перебора пользовательских статиков через GetUserStatic — так же, как High для массива. Это не количество статиков: RemoveUserStatic оставляет в нумерации «дыры» и это значение не уменьшает, поэтому результат GetUserStatic нужно проверять для каждого ID.
Также возвращает -1, если данные UO не загружены.
function GetUserStaticsHigh: Integer;
def GetUserStaticsHigh() -> int: ...
var
i, Count: Integer;
Item: TStaticItem;
World: Byte;
begin
Count := 0;
for i := 0 to GetUserStaticsHigh do
if GetUserStatic(i, Item, World) then
Inc(Count);
AddToSystemJournal('User statics: ' + IntToStr(Count));
end.
count = sum(1 for sid in range(GetUserStaticsHigh() + 1) if GetUserStatic(sid)[0])
AddToSystemJournal(f'User statics: {count}')
GetUserStatic, AddUserStatic, RemoveUserStatic, ClearUserStatics