ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Wish List (https://www.esoui.com/forums/forumdisplay.php?f=177)
-   -   [implemented] Constants or functions to return maximum zoneId and zoneIndex (https://www.esoui.com/forums/showthread.php?t=8647)

Baertram 07/18/19 05:59 AM

[implemented] Constants or functions to return maximum zoneId and zoneIndex
 
Could we please get some constants ZONE_MAX_ID and ZONE_MAX_INDEX or functions like GetMaxZoneId() and GetMaxZoneIndex() so we can know how many zoneIds and indices there are to check for?

Currently we can only guess and hardode a loop from 1 to e.g. 2500 (increased each API patch) to check if GetZoneNameById or GetZoneNameByIndex returns a usable string or is empty. This way we "somehow know" it does not exist.

merlight 07/18/19 07:06 AM

ad § 1) would be useful indeed

ad § 2) assuming valid zone indices form contiguous sequence, you can quickly find max valid index by binary search without hardcoding some arbitrary limit

Baertram 07/18/19 08:20 AM

Just for reference:
Someone already asked for the max_zone_id constant before, in this thread (my forum search did not find it though :confused:): https://www.esoui.com/forums/showthread.php?t=8480

Request was:
MAX_ZONE_ID

Drakanwulf 07/18/19 10:48 AM

While Zone Index or Identifier tables may appear to be contiguous, they are not because, while the table index or identifier key (number) for either table is present, it's Zone name is not.

So I agree with everyone else who would like to know that there are 748 valid Zone entries in the Elsweyr release (100027) before one starts searching, because knowing beats the heck out of sequentially searching through a hypothetical table whose size has been hard-coded to 2000 entries.

I checked that by building a table via a "for loop" that inserted a "NAME IS MISSING" constant into every table entry whose index or identifier returned a nil value to the game's API function call. There were too many "NAME IS MISSING" entries to count... :p

Baertram 07/18/19 11:47 AM

Oh okay. I only knew there are missing zonIds. I thought the zoneIndex entries are contiguous. Good to know they aren't.

merlight 07/18/19 01:05 PM

I checked on PTS and GetZoneNameByIndex() returns a non-empty string for all indices 1 through 726, and empty string for 727 and up. Which is in line with how the word "index" is used in other parts of the API: you have a valid thing for thingIndex = 1, GetNumThing()

ZOS_DanBatson 10/10/19 09:41 AM

I added in GetNumZones() to the API, which should be on PTS now. This will let you iterate over the zone indices which from there you should already have everything else you need.

Baertram 10/11/19 06:35 AM

Thank you, already usign it in my addons/libs now.

Thread can be closed, request is fullfilled!


All times are GMT -6. The time now is 04:29 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI