Introducing ClosetCleaner (new Addon)

Language: JP EN DE FR
users online
Forum » Windower » Support » introducing closetCleaner (new addon)
introducing closetCleaner (new addon)
First Page 2 3
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2016-10-29 11:23:55
Link | Quote | Reply
 
Note: 12/9/17
This should be live now as gearswap library I think most of the bugs I originally mentioned are fixed.

just type //gs cc to run it, and it will generate the file. Make sure you set up your ccConfig.xml file (it will download a sample one initially)



Ok first time trying to make an addon so anyone interested in testing it out please do so (or helping develop it)

https://github.com/Fox214/closetCleaner

From the readme:
Quote:
Author: Brimstone

addon: closetCleaner

This addon is used in conjuction with gearswap to help find unneeded gear, all the include files are copies of those from the gearswap
addon except for closetCleaner.lua and ccConfig.lua

ccConfig should be setup, you will need to list your jobs that you actively play and keep gear for. You can also setup ignore lists so
things like furniture, food, ninja tools, meds, helm items etc... are not tallied. You may also specify a max item count to limit the size of the report
as well as skip entire bags when searching current gear.

To use this addon download and create a folder called closetCleaner in you .../Windower4/addons directory. This will look for files named
either <playername>_<job>.lua or <job>.lua in ../gearswap/data directory (only those specified in the ccjobs list)

It will tally up all the gear inside the init_gear_sets() function which are in the 'sets' tables. If you have sets defined elsewhere it will not be counted, if you have
sets defined in tables which are not in the 'sets' table space it will not be recognized. It only looks for items where the table key matches a slot
(ie head, back, waist etc...) if you have aliased augmented items make sure the variable is defined inside init_gear_sets(). Setting one table name equal
to another will cause a stack overflow (ie sets.A = sets.B crashes however sets.A = set_combine(sets.B, {}) will work)

Output report should be: .../Windower4/closetCleaner/report/<playername>_report.txt

To use simply type: //lua l closetCleaner
Then: //cc report

If you change the config file, you'll need to //lua r closetCleaner, if you only change your <job>.lua files you can just rerun //cc report

Known issues:
1. it will not process include files (except for organizer-lib)
2. it will not process gear outside the scope mentioned above (I'd like to fix this once some of these other limitations are handled)
3. it will not handle windower.raw_register_event statements (just comment them out before running //cc report)

Other musings:
It looks like I'm wasting about 80 inv. spots on stuff I'm not using.

If you abuse set_combine() a lot the counts may show up a lot higher than actually searching for them will. (I have my bladeborn earring in 635 sets across 16 jobs)

I want to fix the known issues stuff, but not sure how (Not sure if it would make more sense to integrate this into gearswap or keepit a separate addon?)

I was hoping to put options on what to do with gear in the report (ie AHable, send to mule, store on npc or slip, trade for voucher etc..) but I'm not sure that data is in the resources file.

It will also help you find typos in your files (if you shows gear you know you're using it could be because you've misspelled the gear or slot named (I had ranged instead of range on a few ugh...)

Feedback & help welcome.
[+]
 Asura.Thorva
Offline
Server: Asura
Game: FFXI
user: Thorva
By Asura.Thorva 2016-10-29 12:44:52
Link | Quote | Reply
 
I get gearswap/data/MNK.lua:196 attempt to index field 'DarkRing' (a nil value)

I don't have a mnk lua
[+]
Offline
Posts: 346
By Sidiov 2016-10-29 13:59:49
Link | Quote | Reply
 
I use windower.raw_register_event functions in a couple of my lua files and cc report throws a runtime error on each of those lines: "attempt to call field 'raw_register_event' (a nil value)"
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2016-10-29 19:55:19
Link | Quote | Reply
 
Sidiov said: »
I use windower.raw_register_event functions in a couple of my lua files and cc report throws a runtime error on each of those lines: "attempt to call field 'raw_register_event' (a nil value)"

See known issue #3, just comment them out (you can uncomment them immediately afterwards) I hope to fix this eventually. (if you use notepad++ hightlight the lines, hit cntl-Q,(to comment), cntl-S (to save) run //cc report, then it cntl-Q (to uncomment), cntl-S (save again) and its back to how it started, I know its annoying work around but it should only take a couple seconds. (and I really don't expect people to run this tool but once a week or so)
Offline
Posts: 346
By Sidiov 2016-10-29 20:54:33
Link | Quote | Reply
 
Fenrir.Brimstonefox said: »
Sidiov said: »
I use windower.raw_register_event functions in a couple of my lua files and cc report throws a runtime error on each of those lines: "attempt to call field 'raw_register_event' (a nil value)"

See known issue #3, just comment them out (you can uncomment them immediately afterwards) I hope to fix this eventually. (if you use notepad++ hightlight the lines, hit cntl-Q,(to comment), cntl-S (to save) run //cc report, then it cntl-Q (to uncomment), cntl-S (save again) and its back to how it started, I know its annoying work around but it should only take a couple seconds. (and I really don't expect people to run this tool but once a week or so)

Thanks, I should learn to read the whole post... Could you make it use the <job>_gear.lua or <player>_<job>_gear.lua files that are commonly used, especially in motes.
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2016-10-29 23:22:31
Link | Quote | Reply
 
Asura.Thorva said: »
I get gearswap/data/MNK.lua:196 attempt to index field 'DarkRing' (a nil value)

I don't have a mnk lua

I have no idea how you'd get that error if the file doesn't exist.

But if you don't play MNK edit the ccjobs list in ccConfig.lua should be only the jobs you care about tracking gear for. So if you play 5 jobs and have lua files for all 22 then put only those 5 jobs in the ccjobs list in ccConfig.lua. (conversely if you change ccJobs list to all 22 jobs and only have 5 lua files you should be fine, I think there's only 16 jobs in the initial list (which are the ones I play))

Sidiov: I can make that change tomorrow I assume look in this order (all .lua):
<player>_<job>_gear
<player>_<job>
<job>_gear
<job>

In fact if you want to test it before I do change lines 263 to 275 in closetCleaner.lua to this (untested hopefully no typos):
Code
lname = dpath..player.name..'_'..v..'.lua'
lgname = dpath..player.name..'_'..v..'_gear.lua'
sname = dpath..v..'.lua'
sgname = dpath..v..'_gear.lua'
if windower.file_exists(lgname) then
   dofile(lgname)
   init_gear_sets()
   supersets[v] = deepcopy(sets)
elseif windower.file_exists(lname) then
   dofile(lname)
   init_gear_sets()
   supersets[v] = deepcopy(sets)
elseif windower.file_exists(sgname) then
   dofile(sgname)
   init_gear_sets()
   supersets[v] = deepcopy(sets)
elseif windower.file_exists(sname) then
   dofile(sname)
   init_gear_sets()
   supersets[v] = deepcopy(sets)
else
   print('lua file for '..v..' not found!')
end
Offline
Posts: 346
By Sidiov 2016-10-30 20:35:50
Link | Quote | Reply
 
I made that change and ran it with just BLM in the ccconfig.lua, and I get a "lua file for BLM not found".
edit: I have a BLM.lua and a pname_blm_gear.lua in the data dir.
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2016-10-30 22:22:54
Link | Quote | Reply
 
Sidiov said: »
I made that change and ran it with just BLM in the ccconfig.lua, and I get a "lua file for BLM not found".
edit: I have a BLM.lua and a pname_blm_gear.lua in the data dir.

Add these lines in the else:
print('lua file for '..v..' not found!')
print('Checked: '..lgname)
print('Checked: '..lname)
print('Checked: '..sgname)
print('Checked: '..sname)

Make sure those files look like the path and names match. (only 1, don't need all 4)

lua is case sensitive, windows is not. I'm not sure if the dofile or file exists check are case sensitive or not. Make sure its the name of the character you're running from as well (although it should still see BLM.lua) I did put this in my version and it works fine for <job>.lua didn't test other formats but it should work too.
Offline
Posts: 346
By Sidiov 2016-10-30 22:44:42
Link | Quote | Reply
 
ok figured it out, basically had to force everything to lowercase to account for non-standard case junk:
Code
	fpath = windower.addon_path:gsub('\\','/')
	fpath = fpath:gsub('//','/')
	gspath = fpath:gsub('closetcleaner\/','')..'gearswap/'
	dpath = gspath..'data/'
	for i,v in ipairs(ccjobs) do
		v = string.lower(v)
		lname = string.lower(dpath..player.name..'_'..v..'.lua')
		lgname = string.lower(dpath..player.name..'_'..v..'_gear.lua')
		sname = string.lower(dpath..v..'.lua')
		sgname = string.lower(dpath..v..'_gear.lua')
		if string.lower(windower.file_exists(lgname)) then
		   dofile(lgname)
		   init_gear_sets()
		   supersets[v] = deepcopy(sets)
		elseif string.lower(windower.file_exists(lname)) then
		   dofile(lname)
		   init_gear_sets()
		   supersets[v] = deepcopy(sets)
		elseif string.lower(windower.file_exists(sgname)) then
		   dofile(sgname)
		   init_gear_sets()
		   supersets[v] = deepcopy(sets)
		elseif string.lower(windower.file_exists(sname)) then
		   dofile(sname)
		   init_gear_sets()
		   supersets[v] = deepcopy(sets)
		else
		    print('lua file for '..v..' not found!')
			print('Checked: '..lgname)
			print('Checked: '..lname)
			print('Checked: '..sgname)
			print('Checked: '..sname)
		end
	end


I think thatll end my testing though, the stack overflows kill it for me, I have several hundred set = set configs that I dont want to go through changing.
 Cerberus.Tidis
MSPaint Winner
Offline
Server: Cerberus
Game: FFXI
user: tidis
Posts: 3927
By Cerberus.Tidis 2016-10-31 04:29:25
Link | Quote | Reply
 
So wait, this tells you if stuff in all your storage options isn't being used? Blimey, I've been needing something like this for a long time!
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2016-10-31 08:31:06
Link | Quote | Reply
 
Cerberus.Tidis said: »
So wait, this tells you if stuff in all your storage options isn't being used? Blimey, I've been needing something like this for a long time!

Yes, part of me wanted to call it "*** paying for mog wardrobe 3 &4", and rather than simply report unused items, it counts how often everything is used. So you have the option to get look for alternatives for things that are only used once or twice.

Sidiov: sorry I didn't update yesterday, I'll put the changes in for the lowercase file names tonight hopefully.
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2016-11-01 09:20:19
Link | Quote | Reply
 
I put the changes for the _gear stuff up last night
necroskull Necro Bump Detected! [89 days between previous and next post]
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2017-01-29 16:38:50
Link | Quote | Reply
 
Just released v0.5, should fixed all the known issues from the initial release. README has been updated as well. Let me know if you have any questions/issues I will try and help.
 Lakshmi.Ratie
Offline
Server: Lakshmi
Game: FFXI
user: ratie
Posts: 153
By Lakshmi.Ratie 2017-01-31 22:29:22
Link | Quote | Reply
 
I had run into a few hiccups in trying to get this to work for me. In case others are having the same problem I figured I'd share what I did to get it to work in my environment.

Quote:
Line 282: gspath = fpath:gsub('closetCleaner\/','')..'gearswap/'
The fpath variable returns a string in all lowercase, but the gsub function is trying to match a string that contains an upper case C and the substitution doesn't take place.

Quote:
The multiple if statement block starting at Line 289 - 308
Lua would complain that 'init_gear_sets()' is a nil value. Doing a search for that function, it seems only Motes files use it(?). I don't use motes myself, and my filenames are Ratie_<job>.lua so to get around that I replaced the instances of 'init_gear_sets()' with 'get_sets()' (which was already in use on line 304).

Quote:
Line 336: if pos == "name" or pos == "main" or pos == "sub" or pos == "range" or pos == "ammo" or pos == "head" or pos == "neck" or pos == "left_ear" or pos == "right_ear" or pos == "body" or pos == "hands" or pos == "left_ring" or pos == "right_ring" or pos == "back" or pos == "waist" or pos == "legs" or pos == "feet" or pos == "ear1" or pos == "ear2" or pos == "ring1" or pos == "ring2" then
This line captures almost every alternative spelling for equip slots, just not mine :P We just need to add before 'then' at the end:
Quote:
or pos == "lear" or pos == "rear" or pos == "lring" or pos == "rring"
I'm not sure of any other alternative spellings for equip slots.

I hope this helps anyone else in the same boat.
[+]
 Valefor.Omnys
Offline
Server: Valefor
Game: FFXI
user: omnys
Posts: 1759
By Valefor.Omnys 2017-02-01 00:54:36
Link | Quote | Reply
 
oh honey, let me suggest

Quote:
Line 336: if pos == "name" or pos == "main" or pos == "sub" or pos == "range" or pos == "ammo" or pos == "head" or pos == "neck" or pos == "left_ear" or pos == "right_ear" or pos == "body" or pos == "hands" or pos == "left_ring" or pos == "right_ring" or pos == "back" or pos == "waist" or pos == "legs" or pos == "feet" or pos == "ear1" or pos == "ear2" or pos == "ring1" or pos == "ring2" then

to (just easier to read)
Code
if S{"name", "main", "sub", "range", "ammo", "head", "neck", "left_ear", "right_ear", "body", "hands", "left_ring", "right_ring", "back", "waist", "legs", "feet", "ear1", "ear2", "ring1", "ring2"}:contains(pos) then


Is "name" supposed to be an option?
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2017-02-09 11:52:33
Link | Quote | Reply
 
Name gets the augmented gear. Sorry I'll try and spend some time with this soon and get another update out.
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2017-02-19 00:21:28
Link | Quote | Reply
 
OK new version Up I've tried to address the issues raised here, please let me know if you see anything else.

I'm pretty sure problem you have with the path name is likely due to you naming the folder you put the tool in closetcleaner instead of closetCleaner. I just lower case the string though so as long as its spelled correctly that won't matter.
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 10133
By Asura.Sechs 2017-02-19 05:03:01
Link | Quote | Reply
 
Tried this and love it, but in the report there were some errors. It's like he didn't load a couple of my luas (two: PUP and RDM ones), so all the items in those sets were appearing as "0" uses in no sets at all.

Also, is there a way to make the "//cc report" command ignore some repositories?
Say I don't want it to check into MogSafe and MogSatchel, can I set such filters somewhere?
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2017-02-19 07:51:23
Link | Quote | Reply
 
In ccConfig.lua make sure PUP and RDM are in the ccjobs list, the default list there is most jobs but not all (I don't happen to play those, so I'm guessing that's your problem)

Also at the bottom is the other config:
-- List bags you want to not check against
skipBags = { 'Storage' }
just change to (needs to match Location column in the report):
skipBags = { 'Mog Safe', 'Mog Satchel' }

Might want to delete, add, change stuff to ccignore as well.
[+]
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 10133
By Asura.Sechs 2017-02-20 06:21:11
Link | Quote | Reply
 
Thanks a ton, will keep testing this very useful addon.

One more feature you might be thinking about for the future.
The report already lists the number of times an item appears in different sets, and this is already a very useful information by itself. But know what would be even better?
To know how many times an item X appears in different Luas.
Like if item X appears 4 times in WAR lua, 7 times in WHM lua and 2 times in BLU lua, the result in this column should display "3".
This number would be perfect to decide which items to prioritize into wardrobes.

Not sure how complicated this addition would be, but thought I would ask regardless.
[+]
 Asura.Vanyar
Offline
Server: Asura
Game: FFXI
Posts: 15
By Asura.Vanyar 2017-02-20 08:39:49
Link | Quote | Reply
 
As FYI --
It failed for a friend if the .lua had a sub set without a main set. I do not recall what error that caused, but I can look it up later.

e.g. just having the following would fail:
sets.midcast.Cure = {ammo="Random Item"}


While it would work when I have:
sets.midcast = {}
sets.midcast.Cure = {ammo="Random Item"}
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 10133
By Asura.Sechs 2017-02-20 11:46:21
Link | Quote | Reply
 
This is working only partially for me, what did I do wrong in the syntax of the config?
Code
skipBags = { 'Storage', 'Safe', 'Safe 2', 'Locker', 'Satchel' }
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2017-02-20 23:11:49
Link | Quote | Reply
 
Asura.Vanyar said: »
As FYI --
It failed for a friend if the .lua had a sub set without a main set. I do not recall what error that caused, but I can look it up later.

e.g. just having the following would fail:
sets.midcast.Cure = {ammo="Random Item"}


While it would work when I have:
sets.midcast = {}
sets.midcast.Cure = {ammo="Random Item"}

This is expected, lua won't let you define:
a.b.c = {}

unless you
a = {}
a.b = {}
first.

All I can figure is something he's got init_gear_sets or get_sets serialized with whatever function defines sets.midcast = {} (or its possibly in an include file I can't find)

ie if in a function he has:
sets.midcast = {}
get_sets()

His lua will work but this program will not because after it loads your file it just calls get_sets() so that table is not initialized, I was hacking around this in an eariler version but when I figured out how to read through Mote's include files I removed a few of these dummy tables figuring people would have them initialized.

Sechs:
Make sure you reloar //lua r closetCleaner if you edit your config file or change your inventory, those items are read when the program loads and not when the report is generated. That's the only reason I could figure why what you typed won't work.

Also I have a version which tries to show which jobs the gear is being used for, but I'm stuck I can post it some where if someone wants to look at it. The problem I'm having is lua doesn't seem to be crawling through he tables recursively it seems to be flattening them and going through in a random order.

so most lua should have:
sets.idle
sets.engaged

I'm reading through all the files can create:
supersets.BLM.sets.idle
supersets.BLM.sets.engaged
supersets.BLU.sets.idle
supersets.BLU.sets.engaged

so I pass supersets to list_sets function, and was thinking it would go through them recursively ie:
supersets is a table, descend:
supersets.BLM is a table, descend (store BLM here)
supersets.BLM.sets. is a table, descend
supersets.BLM.sets.idle is a table, but there are gear slots I recognize record that data. move on...

But it looks like its all randomized, so it might search like this:
supersets.BLU.sets.engaged
supersets.BLM.sets.idle
supersets.BLM.sets.engaged
supersets.BLU.sets.idle

which using the method above has my blm idle and engaged gear show as coming from the BLU file.

I don't know how to qualify a full table name in lua (in fact I think its a generic problem with languages that use references)

Fortunately the random order doesn't matter when I don't care where things come from. (which the current code does not)

So if anyone has ideas I'm all ears.

DISCLAIMER: I'm a total hack sorry if I offend any compSci types with my feeble explanations.

Edit #2: I wasn't planning on putting a count in I was trying to just make a list so Inyanga Jubbah +1 would just show WHM, SMN, BRD next to it (or some subset thereof) its the same as 3 but more informative. I don't think I can give 3 now either though since it gives false positives.
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 10133
By Asura.Sechs 2017-02-21 03:44:55
Link | Quote | Reply
 
Of course I was unloading and reloading the addon, it still reports every repository in the Report txt file :x


Btw, before you created this awesome addon, the way I was cleaning my inventory was through the "Validate" function built-in in Gearswap.
More details if anybody is curious:


Of course ClosetCleaner is so much better and offers so much more potentially than my primitive thing was able to do.
You should submit it to the Windower Github and turn it into an "official" addon btw.

If you can find a manageable way to "count" in how many luas/jobs an item is used and display that number, I think it's gonna be quite useful.
That, combined with how many sets a certain item is present in (an info CC already gives) will be awesome to decide which items to prioritize into wardrobes and maybe which items to get rid of.

For instance an item that offers stat+1 over another option but is used on a single job.
When I encounter these situations, I sometimes decide to get rid of that single item and eat the small stat loss, to gain an inventory slot.
It's not always an easy choice of course.
[+]
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2017-02-21 07:51:24
Link | Quote | Reply
 
Asura.Sechs said: »
For instance an item that offers stat+1 over another option but is used on a single job.
When I encounter these situations, I sometimes decide to get rid of that single item and eat the small stat loss, to gain an inventory slot.
It's not always an easy choice of course.

This is the exact reason I decided to print the count, obviously "0" is generally good candidates for /toss but things only used in a couple of sets that offer +1 STR or something over an alternative piece are nice candidates for saving space too.

The way I handles this though is I just have all my luas open in tabs in np++ I hit cntl-F for find and paste the name in and hit "Find in open documents" button. I tend to use short form names in my lua but I printed the long form off to the right in case others aren't then you can search for that too, so 2 searches max to find all locations for a piece of gear.
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 10133
By Asura.Sechs 2017-02-21 08:34:40
Link | Quote | Reply
 
Yeah, I kinda do the same. As I said, love it.
I already found 5 items in my wardrobes that I no longer used (replaced by other, newer items) and I didn't notice I wasn't using them anymore :D
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2017-02-22 23:20:47
Link | Quote | Reply
 
I figured this out and should have an update out tomorrow.

I actually discovered a major bug too, the whole problem wasn't lua reading tables in random order it was that I didn't reinitialize sets = {} before reading each file so extra gear was getting appended to it that I did not expect.

0 counts should still be correct but everything else will drop in numbers. (particularly with unique set names that would not get overwritten by subsequent files)

I just need a bit of time to clean up the code before I release it.
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 10133
By Asura.Sechs 2017-02-23 01:59:20
Link | Quote | Reply
 
Nomnomnom, can't wait.


(you should submit it to Windower Github and make it an official addon btw)
 Fenrir.Brimstonefox
Offline
Server: Fenrir
Game: FFXI
user: Brimstone
Posts: 183
By Fenrir.Brimstonefox 2017-02-23 23:05:03
Link | Quote | Reply
 
Ok its up, oddly I was getting a bug with the skipBags feature after I made updates (but not to that section of the code) so I ended up rewriting it and wondered how it worked for me.

Anything it previously counted 2+ for could be reduced in number as well (0 or 1s would have been correct).

I also got rid of the _sets, _inventory and _ignored files unless you set the debug flag in the config file. (and the input commands from help)

I also just cleaned up the code somewhat. so its hopefully a bit easier to read/maintain.
 Fenrir.Dibble
Offline
Server: Fenrir
Game: FFXI
user: Dibble
Posts: 141
By Fenrir.Dibble 2017-02-28 03:08:25
Link | Quote | Reply
 
Is it supposed to find and use the gearswap include files if they are already installed?
First Page 2 3
Log in to post.