Quantcast [open] Constants or functions to return maximum zoneId and zoneIndex - ESOUI
Thread Tools Display Modes
07/18/19, 05:59 AM   #1
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,288
[open] 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.
  Reply With Quote
07/18/19, 07:06 AM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
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
  Reply With Quote
07/18/19, 08:20 AM   #3
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,288
Just for reference:
Someone already asked for the max_zone_id constant before, in this thread (my forum search did not find it though ): https://www.esoui.com/forums/showthread.php?t=8480

Request was:
MAX_ZONE_ID
  Reply With Quote
07/18/19, 10:48 AM   #4
Drakanwulf
 
Drakanwulf's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2017
Posts: 50
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...
__________________
Drakanwulf, the dire wolf that hunts dragons!
  Reply With Quote
07/18/19, 11:47 AM   #5
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,288
Oh okay. I only knew there are missing zonIds. I thought the zoneIndex entries are contiguous. Good to know they aren't.
  Reply With Quote
07/18/19, 01:05 PM   #6
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
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()
  Reply With Quote

ESOUI » Developer Discussions » Wish List » [open] Constants or functions to return maximum zoneId and zoneIndex

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off