View Single Post
12/03/14, 05:02 PM   #10
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by SnowmanDK View Post
Follow up question:
How do you know what return value is equal to what?
I can't seem to find any tables showing that.
As I can see 9 = ITEMTYPE_TOOL
If I do a
Lua Code:
  1. GetItemType(item.bag, item.slot)
then I just get an integer.
You are correct there are several item types that are not used.
You can look on the wiki site under constants here: http://wiki.esoui.com/Constants_in_100008_API
and search for ITEMTYPE it will take you to a list that shows each item types values.

I don't remember for sure if that is a complete list, but you can create an up to date list by using the following code to grab all of the values of item types
Lua Code:
  1. -- Initialize ItemTypes
  2.     local itemTypeTable = {}
  3.     for key, value in zo_insecurePairs(_G) do
  4.        if (key):find("ITEMTYPE_")  and type(value) == "number" then
  5.           itemTypeTable [key] = value   -- sorts by itemType name
  6. -- or reverse the key & value to sort them by number
  7.           itemTypeTable [value ] = key-- sorts by itemType number
  8.        end
  9.     end

Props to Garkin for showing me this trick it has come in handy MANY times when I wanted to find all possible values of certain types of constants, or even to look for functions with certain words in them to see if a function existed for something I was trying to do (in case it was not listed on the wiki).
  Reply With Quote