View Single Post
  #11  
Unread 05-10-2012, 03:19 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 341
Quote:
Originally Posted by RandomAugury
Can anyone help with the following questions?
(1) How can I find information on ItemInfo. I can't find this under Turbine.Gameplay which is where I expect to see it;
(2) How do you get the ItemInfo for an item? There doesn't seem to be a new method attached to the Item class to return it.
(3) I just noticed that there are Service and ServiceContainer classes - what are these for?
You have to create an instance of an ItemInfo to really see what it does. To get an instance, get an instance of any item from any source such as the backpack, shortcut, vault, equipped items, or shared storage. Then use the item:GetItemInfo() method to create an instance of ItemInfo. Now you can look through the instance's metatable for all the goodies available from ItemInfo. I don't use HereBeDragons. For exploring and debugging in Lua I use the Debug window built into MoorMap (just go to options and turn on debugging). I have a few other tools that I use but I've never published them and probably won't as their interfaces are quite rough and designed just for me to look things up quickly. Anyway, if you enter the following code and hit the Execute button it will create all of the objects and you can browse them in the window (the same sort of thing HereBeDragons does but that doesn't support interactive code or watching values).

Here's a quick sample of how to get an instance of an ItemInfo object:
Code:
localPlayer=Turbine.Gameplay.LocalPlayer:GetInstance();
backpack=localPlayer:GetBackpack();
testitem=backpack:GetItem(1);
iteminfo1=testitem:GetItemInfo();
be sure you have something in the first backpack slot for this example to work
Reply With Quote