Tried this out tonight and it de-scrambled the bag slots as advertised, all 135 of them. Having to populate 134 of them and then move 134 items one at a time was a bit of a chore.
I'm just curious why the manual moves was required? Is it because the LOTRO interface prevents plugins from executing multiple commands as the result of one user interface action?
The reason why I used this is that I use the SequenceBars plugin and I make use of "Set Unequip Destination" in my gear swapping sequences. I like to keep all the armour/jewellery in bag 2 where its grouped by the role (e.g. dps, tank, healer). I had it using the un-sorted ids but just thought it would be easier in the long run to maintain the sequences if sorted.
Yeah, it is a PITA, but unfortunately there isn't an easier way that I know of. The way it works is a consequence of the limitations of the Lua API:
A plugin cannot change the locations of slots within your bags. The only way to move slots around is with the "sort" button. This plugin's job is to help you arrange the items in your bags such that clicking the "sort" button will put the slots in order.
A plugin can move an item from one slot to another by using the slot numbers. Given this capability, you would think a simple algorithm would do the trick:
1. Get the user to fill his bags with junk.
2. Create a sorted list of the items.
3. Move the items into the appropriate slots such that the first item alphabetically is in slot 1, and the last in slot 135.
4. Have the user click "sort" to sort the slots.
The main problem with this approach arises in step 2: Sorting. The game's sorting algorithm is complex and mysterious. It obviously isn't alphabetical; it arranges the items into categories and subcategories, putting the categories into some unknown order. A significant research effort would have to go into duplicating this sorting algorithm in Lua. Rather than attempt this, I chose an alternative approach: Have the user click "sort" to sort the items; then detect the order of the slots. We then know the correct "sorted" order of the items, and can proceed to steps 3 and 4.
But a plugin cannot detect the order of slots within your bags, or the locations of slots on the screen. However, when you move an item from one slot to another, a plugin can detect the slot numbers of the source and destination.
So, the "chore" of moving the items from one slot to the next is necessary for the plugin to be able to detect the current order of the slots. Sorry, but blame Turbine/SSG for their lazy implementation of the sort feature and chronic neglect of the Lua API. (Edit: I shouldn't say "lazy". It is probably a performance optimization. Maybe it allows a single database access on the server to modify a "slot order" string, instead of 135 accesses to change the contents of the slots.)