LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   UPdate 7 - LUA Changes (https://www.lotrointerface.com/forums/showthread.php?t=1797)

Garan 05-10-2012 03:19 PM

Quote:

Originally Posted by RandomAugury (Post 7901)
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

RandomAugury 05-10-2012 07:31 PM

Thanks for the response :) It makes perfect sense.

I did look at the class definition for Item and didn't see the GetItemInfo method on Item. I could have sworn it wasn't there!

Maybe its only there when you have an instance of the object.


Augury


All times are GMT -5. The time now is 04:02 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI