Item Type -> Item Id

elmstfreddie

The Finglonger
Reaction score
203
I have a variable that is an item type variable, and I'm wondering how I'm supposed to get the integer id of this variable. The function GetItemTypeId takes an item, but I want to get the id of an item type, not an item.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
I had the same issue, once.
JASS:
function ItemType2I takes itemtype whichType returns integer
    local integer index = 0 
    loop
        exitwhen (index > 9)
        if (whichType == ConvertItemType(index)) then
            return index
        endif
        set index = index + 1
    endloop
    return 99 //Unknown itemtype
endfunction


Did you mean this?
 

elmstfreddie

The Finglonger
Reaction score
203
Sorry no I mean like an itemtype variable. What's the point of an itemtype variable anyways if it's always referred to as an integer? Or does the itemtype variable just an integer anyways?
 

Omni

Ultra Cool Member
Reaction score
37
Arent item-types the type of item an item is,
such as, artifact, power up etc
 

elmstfreddie

The Finglonger
Reaction score
203
I don't know actually :p
I guess that is what it is eh.


So wait, a GUI Item Type would be an integer variable in JASS?
 

SFilip

Gone but not forgotten
Reaction score
634
> GUI Item Type would be an integer variable in JASS?
Yes.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Lets say you have an item, called "PANDA", which item type is ITEM_TYPE_PERMANENT.

"local itemtype whichType = GetItemType(PANDA)"
"local integer itemType = ItemType2I(whichType)"

Variable "itemType" would then have a value of 0, because

"ITEM_TYPE_PERMANENT = ConvertItemType(0)"


GUI -> JASS
item -> item
item-type -> integer
item-class -> itemtype


But maybe, that's not what you want. If that is the case, could you please elaborate?
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
Lets say you have an item, called "PANDA", which item type is ITEM_TYPE_PERMANENT.

"local itemtype whichType = GetItemTypeId(PANDA)"
"local integer itemType = ItemType2I(whichType)"

Variable "itemType" would then have a value of 0, because
...


I'd like to point out that that doesn't work. GetItemTypeId() returns an integer ('I000', or whatever), not an itemtype (which I believe is a handle).
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top