ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Are collectibleIDs absolute or relative? (Turn drunk personality on/off) (https://www.esoui.com/forums/showthread.php?t=8912)

ThoraldGM 01/15/20 11:48 AM

Are collectibleIDs absolute or relative? (Turn drunk personality on/off)
 
Hello all. New to Lua, Papyrus (Fallout 4) background. Completed the notebook tutorial.

I'm creating a practice addon & would like to turn drunk personality on / off with buttons and slash commands. How do I find the collectibleID? Is the collectibleID global, or relative to position in table?

What if Player 1 has:
  • Assassin
  • Drunk
  • Jester
  • Zombie

But Player 2 has:
  • Assassin
  • Commander
  • Drunk
  • Jester
  • Zombie

Would the collectibleID change based on position in the table? (I'm familiar with array elements from elsewhere, but Lua's "everything is a table" is a WIP.)

Here's what I've dug up so far:

Lua Code:
  1. if not IsCollectibleActive(collectibleID) then
  2.      UseCollectible(collectibleID)

Source:
https://www.esoui.com/forums/showpos...41&postcount=7

Code:

COLLECTIBLE_CATEGORY_TYPE_PERSONALITY == 9
SI_COLLECTIBLECATEGORYTYPE9 == 1212

Sources:
https://wiki.esoui.com/Constant_Values
https://wiki.esoui.com/Constant_Values_SI*
https://www.esoui.com/downloads/info...elyEmotes.html

The LovelyEmotes addon queries all player personalities & lists them in a clickable table / window. Click on, click off. But it handles the data in a list format only, not individually targeted.

I just need the drunk personality collectibleID, and want to make sure that number doesn't change if player buys another personality.

Am I close to a solution?

sirinsidiator 01/15/20 12:35 PM

Welcome to ESOUI!
You are on the right track. Generally speaking when something is called "id" in the api, it is global and won't ever* change. On the other hand when it is called "index" it is local for the current context and may change at any point in time.
In the case of collectibles you can check the list on the wiki to find the id you are looking for and then use that in your code.

*some things like ability ids have changed between major game updates, but that happens rarely

votan 01/15/20 12:47 PM

Welcome :)

Check this to see how ZOS handles them:
https://www.esoui.com/downloads/info...ourcecode.html

Use the addon zgoo or torchbug to browse this instance:
ZO_COLLECTIBLE_DATA_MANAGER

And yes, if ZOS calls something ID it will not change (that soon). And if it is called index, it relative and can change from version to version.

ThoraldGM 01/15/20 12:58 PM

Excellent. Thank you both.

Confirmed in real-time:

Quote:

/script d(ZO_CachedStrFormat(SI_COLLECTIBLE_NAME_FORMATTER, GetCollectibleName(368)))
Returns: Drunk
I'll browse the game code too and set up my Agent Ransack for searches. Cheers!


All times are GMT -6. The time now is 03:27 AM.

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