LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   Creating Shortcuts from Items in Inventory (https://www.lotrointerface.com/forums/showthread.php?t=1711)

Stever1388 12-21-2011 01:17 PM

Thanks for your help again, I was messing around with this yesterday and still came to a problem (one ill turn deserves another I guess): The quickslots are semi-broken if you try to set an invalid shortcut using the 0x0000000000000000 for the first part of the string and then ever reacquire the item in question.

Here's some test code to try it out:

Code:

import "Turbine";
import "Turbine.Gameplay";
import "Turbine.UI";
import "Turbine.UI.Lotro";

Window=Turbine.UI.Window();
Window:SetSize(200,200);
Window:SetPosition(Turbine.UI.Display:GetWidth()/2-100,Turbine.UI.Display:GetHeight()/2-100);
Window:SetText("Test");
Window:SetVisible(true);

quickslots = Turbine.UI.Lotro.Quickslot();
quickslots:SetParent(Window);
quickslots:SetVisible(true);
quickslots:SetOpacity(1);
quickslots:SetSize( 36, 36 );
quickslots:SetPosition( 0, 0);

quickslots:SetShortcut(Turbine.UI.Lotro.Shortcut(2, "0x0000000000000000,0x700017E2")) -- this sets the shortcut to traveling rations whether you have them in your inventory or not
Turbine.Shell.WriteLine("Test Item name: "..quickslots:GetShortcut():GetItem():GetName())
Turbine.Shell.WriteLine("Test Shortcutdata: "..quickslots:GetShortcut():GetData())

function quickslots:ShortcutChanged(sender, args)
    Turbine.Shell.WriteLine("Name: "..quickslots:GetShortcut():GetItem():GetName())
    Turbine.Shell.WriteLine("Data: "..quickslots:GetShortcut():GetData())
end

If you don't have any traveling rations in your inventory, you'll see a quickslot in the middle of your screen that is grayed out and can't be used. If you do have traveling rations in your inventory, you'll see a quickslot that is normal looking, however, if you try to left or right click on it, nothing happens (the sandglass icon should briefly appear in the quickslot if it were working correctly).

To get it to work, you must REMOVE the stack of traveling rations from your inventory (into your bank or sell them), and then add them back into your inventory. If you then click on the quickslot again nothing will happen, but you'll get the chat output of the name and data string. Then clicking it again and it'll work like a normal quickslot. It seems the quickslot doesn't try to update until you click on it, and then once you do it finds the link its looking for, which is why it updates (it changes the data string to match the one found in inventory).

Any suggestions on getting the event to fire prior to clicking the quickslot? Is there a way to maybe make the quickslot think it's been clicked even if it hasn't?

So far this is a pretty good solution to the problem I've been having but the fact that you have to click the slot twice the first time you use it is a bit frustrating and not to my liking.

lunarwtr 12-21-2011 05:01 PM

I'll have to try it when I'm at my other pc as I "had" a working example of just such a thing a while back.

Off top of my head things to try would be to see if you need to set the quickslot enabled or something upon initialization. I could be getting mixed up but I think there was a bug regarding something that had to be toggled. Also, dont' use the hard coded number "2" for the first part of the shortcut.. use Turbine.UI.Lotro.ShortcutType.Item instead.. just incase the number is wrong.

lunarwtr 12-21-2011 08:19 PM

Whatever they did, it must have broken in this release. The one I have doesn't work either anymore. If I think of a work around I'll post.

Mirar 03-12-2024 11:18 AM

Anyone found a workaround for this yet?


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

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