lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO Stand-Alone Plugins > Bags, Bank & Inventory


Post A Reply
Author Comments Comment Options
Unread 03-25-2012, 06:16 AM  
LMOF
The Wary

Forum posts: 0
File comments: 4
Uploads: 0
issue

Hello, well i am still having the problem of sorting, always give me this "You are too busy to do that right now.", and i am not doing nothing at all and then i can't sort it anymore.

Suggestions?
LMOF is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-24-2012, 05:25 PM  
Habna
The Wary
 
Habna's Avatar
Interface Author - Click to view interfaces

Forum posts: 0
File comments: 247
Uploads: 3
Quote:
It would work because then the items are unique and so the bug in the sort routine wouldn't fail as it would never encounter two items of same name and same quantity.
I'm not sure if it's 100% functional because it was functioning with me before your changes anyway I did the changes in case :P Thx Levva!

Last edited by Habna : 03-24-2012 at 07:54 PM.
Habna is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-24-2012, 04:16 PM  
Levva
The Wary

Forum posts: 0
File comments: 7
Uploads: 0
Quote:
Changing the names worked, sorting works flawlessly now. Thx for advice!
It would work because then the items are unique and so the bug in the sort routine wouldn't fail as it would never encounter two items of same name and same quantity.
Levva is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-24-2012, 01:47 PM  
Feladr
The Wary

Forum posts: 0
File comments: 12
Uploads: 0
Changing the names worked, sorting works flawlessly now. Thx for advice!
Feladr is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-24-2012, 05:45 AM  
Levva
The Wary

Forum posts: 0
File comments: 7
Uploads: 0
The problem with your sort routine is that table.sort is not a stable function. ie: "elements considered equal by the given order may have their relative positions changed by the sort." (from the LUA manual)

Your sort function you pass to table.sort also isn't stable as it doesn't fully deal with the identical situation and thus you will always get two identically named and identically quantity items possible flipping and thus meaning the sort fails or carries on indefinitely.

To fix this you need to make the sort stable. ie: you need to include an extra check for something that will ALWAYS be unique for that item being sorted. Actually you have ALREADY provided the means to achieve this you just haven't used it in your sort.

So the simplest way to make your sort stable is to do the following...

In sort.lua you have already given then items a unique .id value. This value is attached to the object when the table is initialised this is ideal as you never actually change this during the sort so you can guarantee that this value will ALWAYS be unique during the sort.

Thus to fix your sort routine you need only add an extra check to
Code:
	table.sort(VirtPack, function (a,b)	
		if a.Weight == b.Weight then
			if a.Name == b.Name then
				return (a.Quantity < b.Quantity)
			else  
				return strip(a.Name) < strip(b.Name)
			end
		else  
			return (a.Weight < b.Weight) 
		end
		end)
adding a check such as

Code:
	table.sort(VirtPack, function (a,b)	
		if a.Weight == b.Weight then
			if a.Name == b.Name then
				if a.Quantity == b.Quantity then
					return (a.id < b.id)
				else
					return (a.Quantity < b.Quantity)
				end
			else  
				return strip(a.Name) < strip(b.Name)
			end
		else  
			return (a.Weight < b.Weight) 
		end
		end)
ie: if name is same AND quantity is same then use ID to force a unique sort thus turning the sort code from an unstable sort algorithm into a stable one.

Hope this helps understand where the issue you have been having lies.
Levva is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-23-2012, 08:08 PM  
Habna
The Wary
 
Habna's Avatar
Interface Author - Click to view interfaces

Forum posts: 0
File comments: 247
Uploads: 3
Quote:
Yes, they do, I left the default name. I'll rename them on the next reforge and tell you if it changed anything.
Thx
Habna is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-23-2012, 05:21 PM  
Feladr
The Wary

Forum posts: 0
File comments: 12
Uploads: 0
Yes, they do, I left the default name. I'll rename them on the next reforge and tell you if it changed anything.
Feladr is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-23-2012, 04:53 PM  
Habna
The Wary
 
Habna's Avatar
Interface Author - Click to view interfaces

Forum posts: 0
File comments: 247
Uploads: 3
Hummm...The kind of issue i was experiencing was item with the same name, but only 2. Look like you have 4 legendary weapon. Do they have all the same name?

Last edited by Habna : 03-23-2012 at 04:53 PM.
Habna is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-23-2012, 03:11 PM  
Feladr
The Wary

Forum posts: 0
File comments: 12
Uploads: 0
Update to sorting bug: when it jams and I move the Legendary Item manually, the sorting continues.
Feladr is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-23-2012, 12:28 PM  
Levva
The Wary

Forum posts: 0
File comments: 7
Uploads: 0
Cursor nil bug in v1.4.53c3

Occassionally but fairly frequently getting an error in moveWidget.lua line 12

Attempt to index field cursor a nil value.

This error occurs if I click on the vertical left bar that has "HugeBag" text. Most often it happens if you click to re-open the bag immediately after it is closed.

It also looks like the mouse icon appears just AFTER the click, so I am guessing that the code does a hover over to instantiate the wHugeBag object but I'm managing to click before the object has been created hence it is nil.

Perhaps an additional check in moveWidget routines is required to check if wHugeBag.cursor is nil?
Levva is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-23-2012, 10:46 AM  
Feladr
The Wary

Forum posts: 0
File comments: 12
Uploads: 0
These are the screenshots you requested, I hope they help This time it sorted quite much of the items but sometimes it only sorts 2 or 3 items before it jams, then the only way to fix it is to reload the plugin. I noticed that the bug has something to do with legendary items, when I didn't have them in the backpack or when they didn't have to be moved while sorting, there was no problems at all.
Feladr is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-23-2012, 08:52 AM  
Feladr
The Wary

Forum posts: 0
File comments: 12
Uploads: 0
I don't know when I will be able to play but I'll try to send you the pics as soon as I can.
Feladr is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-22-2012, 07:33 PM  
Habna
The Wary
 
Habna's Avatar
Interface Author - Click to view interfaces

Forum posts: 0
File comments: 247
Uploads: 3
I had this issue before, but not anymore. My test was on 2 stack of "Tough Carapace" and 2 Third age hunter weapon. Can you provide a picture of your bag before and after the first sort. You can send the pic by mail if you don't want to post it on the forum.

Last edited by Habna : 03-22-2012 at 07:34 PM.
Habna is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-22-2012, 04:09 PM  
Feladr
The Wary

Forum posts: 0
File comments: 12
Uploads: 0
In the newest version sorting doesn't work properly, same as it was before *.52 version was released.
Feladr is offline Report comment to moderator   Reply With Quote Reply With Quote
Unread 03-22-2012, 02:38 PM  
mglinka99
The Wary

Forum posts: 0
File comments: 30
Uploads: 0
With 1.4.53c3 i get the same error as before
mglinka99 is offline Report comment to moderator   Reply With Quote Reply With Quote
Post A Reply

 
Category Jump:
Search this Category:
 

All times are GMT -5. The time now is 03:24 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui