Does anyone have an example of how I can obtain the itemId for a given item?
This should do the trick Edit
/script _, _, itemLink = string.find("[Wirt's Third Leg]", "(item:%d+:%d+:%d+:%d+)"); message(itemLink);
Where "[Wirt's Third Leg]" is, you would link an item (shift+left click) it into the script. Haven't tested it but should work.
- With the 2.0 api the following will give you the full itemstring:
- /script _, _, itemLink = string.find("[Wirt's Third Leg]", "(item:%d+:%d+:%d+:%d+:%d+:%d+:%d+:%d+)"); message(itemLink);
- The next question is, does anyone have a similar script that will convert an itemstring into a link? ZZqA 05:01, 20 December 2006 (EST)
Forum Comments about items Edit
Place holder for some info before it gets lost.
Slouken's Comment from the forums
- Any item you have not seen this session (in inventory, on another character, in the auction house, on the trade channel, etc.) is potentially an invalid link.
- If GetItemInfo() returns non-nil, you can use the item in a tooltip, but you still can't necessarily link the item to someone else. [Or you will get booted from the game by the server.]
Iriel's (Flickering) Comments
- The 'rules' for GUARANTEED safe use [of item links] is:
- 1) If you've seen the item link since you logged in THIS PLAY SESSION via one of the standard API item link calls (inventory, inspect, container, tradeskill, quest, etc) or in link-supporting chat channel from the server, then it is safe to use for all purposes.
- 2) If GetItemInfo returns a non-nil value for the item link at any point then you are safe to use the item locally (tooltip), but you should not send it on a channel unless rule 1 is also true.
- Q1. What makes a link invalid.
- A1: A link is invalid if your server has not seen the item through a normal interaction since it was last restarted.
- Q2. What part of accessing that link boots you.[quote]
- A2: You are booted if you request an item from the server which it has not seen since it restarted (By definition, any item link the server sends you AS an item link has been seen by the server). Such a request occurs if you:
- i) attempt to send the item link across a chat channel as a link, or
- ii) access a tooltip for the item when its information is not already in your client's cache (NOTE: The GetItemInfo function can be used to test the local cache)
itemLink information? Edit
i'm trying to find out how to get an item's stat enchantments from an itemlink. e.g. item:123:41:0:0 would return +N of some stats.
anyone know how?
- See ItemLink for an example of regex to extract the enchant subpart, and EnchantString to find the enchanting spell and go from there
How do you use this exactly? Edit
So if I receive an item through chat what should I pass to GetItemInfo()?
- Simply pass the complete string. If you are trying to do this in the chat channel, remember to quote the link, so that it is recognized as a string. For instance: GetItemInfo("[Golden Pearl]") Where [Golden Pearl] is the shift-clicked item link.--Luke1410 09:26, 23 April 2007 (EDT)
How would I get extended item information? Edit
For my addon, I had looked for "Ability_Mount_" in the texture string, which worked for some but not all mounts (if testers are to be trusted). Instead, I've seen that Riding skill is 762, so I'd like to scheck if an item requires that skill to put it into the Mounts list.
GetItemInfo, though, doesn't seem to know about this. How can I find a requiredSkill from an itemID (or Link, or String)?
ClemSnide 08:27, 23 April 2007 (EDT)