Thread Tools Display Modes
07/18/19, 05:59 AM   #1
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
[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.
 
07/18/19, 07:06 AM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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
 
07/18/19, 08:20 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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
 
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...
 
07/18/19, 11:47 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Oh okay. I only knew there are missing zonIds. I thought the zoneIndex entries are contiguous. Good to know they aren't.
 
07/18/19, 01:05 PM   #6
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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()
 
10/10/19, 09:41 AM   #7
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 171
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.
 
10/11/19, 06:35 AM   #8
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Thank you, already usign it in my addons/libs now.

Thread can be closed, request is fullfilled!
 

ESOUI » Developer Discussions » Wish List » [implemented] 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