View Single Post
  #10  
Unread 12-12-2011, 08:02 PM
Stever1388 Stever1388 is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Nov 2010
Posts: 33
Whether there are other problems with the loading of plugins beyond the problems seen from BevyBars, Baruk, TonicBars, etc, I don't know since I haven't tested it that much, but I'm pretty sure the problem with the bars plugins (and Travel when the Glan Vraig map is used) is that the plugins are loaded before the actual backpack is accessible (or loaded). You can test this by with this code:

Code:
import "Turbine";

player = Turbine.Gameplay.LocalPlayer.GetInstance();
backpack = player:GetBackpack();
backpack.ItemAdded = function(sender, args)
	Turbine.Shell.WriteLine("Item added to Backpack.");
end
You will see when you finish logging in that there's a bunch of "Item added to Backpack" in your Standard chat channel, showing that the items are added after the plugin is loaded. Whenever a plugin attempts to create a Shortcut using the Data and Type fields from an item that is no longer in your backpack, an error is thrown. There seem to be a few very rare exceptions to this though, the one I know of is store bought Champion Fervour potions that I used up but still show up (greyed out though like it should) in BevyBars. Health potions, food, battle/warding scrolls, etc will all be removed from your bars if you run out of them and unload/reload your plugin, which can be a pain since you then need to set up those bars again. I know BevyBars uses the PCall function to check whether the QuickSlot:SetShortcut() method will throw an error. Then when the plugin saves it saves those slots as clear.

The best way I can see around this problem is that when a quickslot's shortcut returns an error, the quickslot is flagged, possibly changing the way the quickslot looks to the user (that way they know something should go there but they are currently out of it). Then when whenever a ItemAdded event is fired, go through all the quickslots that are flagged and see if any are updated. That way when loading through the LOTRO Plugin Manager, the quickslots will initially be empty but as the backpack is loaded in the slots should be fixed. This would also have the added benefit that whenever you run out of health pots you don't have to worry about getting more before you reload the plugin.
Reply With Quote