Thread Tools Display Modes
02/23/17, 05:03 PM   #1
tomtomhotep
 
tomtomhotep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 21
GetItemUniqueId

Anyone notice that GetItemUniqueId(bag, slot) doesn't work anymore?


I crafted a lvl 26 axe and shield, and the game gave them both the same UniqueID. I double-checked this by mousing over the 2 items in my inventory and using /zgoo mouse, and the UniqueID fields had the same value.

(i.e. it's not the function GetItemUniqueId() that's malfunctioning, but the game)

Are all items created after the Homestead patch being assigned the same UniqueID of 453642.25000019?

...

(I "/zgoo mouse" 'd an item I made BEFORE the Homestead patch, and it had a different UniqueID.)

...

And I just crafted a CP70 Robe, and it got the same UniqueID of 453642.25000019.

...

Just bought 2 "simple bait", and they both had UniqueID of 453642.25000019.


@ZOS_ChipHilseberg?

Last edited by tomtomhotep : 02/23/17 at 07:47 PM.
  Reply With Quote
02/23/17, 08:33 PM   #2
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
It still seems to be working for me in Item Saver. Is Id64ToString(GetItemUniqueId(bagId, slotIndex)) screwy for you?
  Reply With Quote
02/23/17, 09:52 PM   #3
tomtomhotep
 
tomtomhotep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 21
Originally Posted by Randactyl View Post
It still seems to be working for me in Item Saver. Is Id64ToString(GetItemUniqueId(bagId, slotIndex)) screwy for you?
No. I've never used Id64ToString(). It generates a hash. I just use the number itself. I have no need to "hash" it. Once you use that function to generate a hash string, there is no function (that I know of) to "un-hash" it back to the original number.

From globalapi.lua:
Lua Code:
  1. -- id64s are stored as lua Number type, and sometimes generate the same hash key for very similar numbers.
  2. -- Use this function to get unique hash key for a given id64.
  3. function zo_getSafeId64Key(id)
  4.      return Id64ToString(id)
  5. end
  Reply With Quote
02/23/17, 10:33 PM   #4
tomtomhotep
 
tomtomhotep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 21
Here are 3 of my inventory Items that I crafted today:

iron axe



beech shield



silverweave robe

  Reply With Quote
02/24/17, 12:49 AM   #5
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,577
You cannot use the value directly. The function returns an id64 type which is not a regular number and cannot be represented correctly in Lua and thus has to be converted to a string if you want to save or compare it.
  Reply With Quote
02/24/17, 05:46 AM   #6
tomtomhotep
 
tomtomhotep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 21
Originally Posted by sirinsidiator View Post
You cannot use the value directly. The function returns an id64 type which is not a regular number and cannot be represented correctly in Lua and thus has to be converted to a string if you want to save or compare it.
Then what is the API function AreId64sEqual() for?
  Reply With Quote
02/24/17, 07:11 AM   #7
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,577
Originally Posted by tomtomhotep View Post
Then what is the API function AreId64sEqual() for?
Forgot about that one. With it you can compare two id64 during a session, but as there is no way to correctly save it to save data except for converting it with Id64ToString, its use is limited.
But regardless of that, the values you see in zgoo are not the actual values of the id64, because zgoo is not capable of displaying id64 correctly.
  Reply With Quote
02/24/17, 11:37 AM   #8
tomtomhotep
 
tomtomhotep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 21
Ok.

But, just for the record, I have been using
Lua Code:
  1. savedvars.items[i].uniqueid = tostring(GetItemUniqueId(bag, slot))
and
Lua Code:
  1. if (AreId64sEqual(tonumber(savedvars.items[i].uniqueid), GetItemUniqueId(bag, slot))) then ...<stuff>... end

For months, and it was working flawlessly until the last incremental patch.

But I have already taken your advice and fixed my addon (not released, still in alpha-testing).

So thank you very much for your replies, Sirinsidiator. btw, I love your addons!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » GetItemUniqueId

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