Custom Gearswap Validate To Clean-up Inventory

Language: JP EN DE FR
New Items
2023-11-19
users online
Forum » Windower » General » Custom Gearswap Validate to clean-up Inventory
Custom Gearswap Validate to clean-up Inventory
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 9876
By Asura.Sechs 2022-02-17 04:08:05
Link | Quote | Reply
 
You will still need to create the "fake lua". Either through the rather lenghty process I carefully described above, or through the simple system described by the user Ticktick (which works flawlessly but seems to be having some issues with Luas made by Selindrile).

It just means you won't have to go through the annoying sequence of temporarily overwriting the default Validate.lua with my custom one before the cleanup, and restore the original Validate.lua once the clean up is done.
[+]
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 9876
By Asura.Sechs 2022-02-21 17:10:43
Link | Quote | Reply
 
Updated the OP. As of today all of the advanced validation functions of my custom lua are built-in with the default Gearswap Validate.lua

Therefore you no longer need to backup or overwrite any validate.lua.
The only necessary step to fully use these advanced functions to clean up your repositories is to create a fake lua, and that's only necessary if you have more than 1 job, which is likely going to be the case otherwise you probably wouldn't need any inventory cleaning to begin with xD


Please let me know if any of the information provided is unclear.
necroskull Necro Bump Detected! [69 days between previous and next post]
 Asura.Sechs
Offline
Server: Asura
Game: FFXI
user: Akumasama
Posts: 9876
By Asura.Sechs 2022-05-02 03:44:08
Link | Quote | Reply
 
As someone already noticed and reported, using Ticktick's method to create the fake lua, doesn't work if you're using selindrile derived luas for your jobs.
You can still use the manual system, but there's a few additional steps you need to do.

Before explaining how to do it, I need to let you guys understand why this is happening (and maybe ticktick could created a second, alternative method, working with selindrile's luas?)

In lua syntax and for gearswap, if you want to define a subset, you need to have defined the higher tier sets before.
Example: let's say I want to define a sets called sets.brd.precast.songs, ok? This set has 3 sub levels. Just count the dots if you're having issues.
Before being able to define sets.brd.precast.songs I need to define the higher tier ones, so that means sets.brd.precast and sets.brd.
These do not necessarily have to be "real" sets, they could be empty, but they have to be defined nonetheless, otherwise Gearswap will return me an errors and will be unable to load my lua.
So to make a code example
Code
sets.brd = {}
sets.brd.precast = {}
sets.brd.precast.songs = {head=..., body=..., hands=..., etc}

See? The first 2 sets are completely empty because I'm not using them, but I "need" them to be able to use the following subset that I defined.

All of this that I just described is the default, "normal" behaviour of lua and gearswap.
Selindrile files though behave in a different way. They use a custom "init_gear_sets" function instead of the default "get_sets" function and they do not require declaring the higher tier sets.
In selindrile files for instance you will often see "sets.brd.precast.songs" without any of the higher tier sets being defined.
There's a reason why things are like that but you don't need to know so let's skip the details.
What you need to know is that these sets won't be declared in your job's specific lua, as such ticktick's method or my "manual" copy/paste method will end up creating a fake lua that lacks all the necessary higher tier sets being declared.
As such, if you were to try to load the fake lua, gearswap would get you an error, saying it's unable to load the file. And if the file can't be loaded, of course you can't use validate.


How to fix this?
There is no simple method, unless ticktick updates his code, the only way to fix this is to manually add all the missing subsets.
You need to create your fake lua using my instructions, then you have to declare all the missing higher tier sets, one by one.
Once you're done doing that (and it's gonna take a lot, lol) then you're gonna be able to load the lua file with Gearswap, and once the file is loaded you can use Validate as described above.


How do I know which higher tier sets are missing?!
After a while you're gonna be able to spot them on your own, but for the first few minutes you can let gearswap tell you.
Try to load your fake lua with gearswap, it will return an error saying he's unable to index a field called "xxx" and will tell you the exact line of your lua where this error occurs, usually will be at the very beginning.

For instance let's say your lua starts on line 5 with the following set:
Code
sets.drg.weapons.dt = {......}

Gearswap will give you an error like: fake.lua:5: attempt to index field 'drg' (a nil value)
Gearswap is actually tryin to tell you that on line 5 he couldn't interpret the set you defined because "sets.drg" hasn't been declared before.
Tecnically "weapons" is another non declared set, but gearswap stops on the first error he finds.
To fix this you would have to do it like this
Code
sets.drg = {}
sets.drg.weapons = {}
sets.drg.weapons.dt = {.......}

Now gearswap will be correctly able to accept your sets.drg.weapons.dt set.
[+]
necroskull Necro Bump Detected! [154 days between previous and next post]
Offline
Posts: 15
By mohgeroth 2022-10-03 15:28:45
Link | Quote | Reply
 
I've created a wrapper for Selindrile users based on the one TickTick created (many thanks by the way!). There are a few things that normally happen when sel libs are loaded so the approach is a little different.

Keep in mind that several items are used in the logic files rather than defined in the gear file so use your head when it reports an item that's missing that you know you're using.

To use this:

  1. Save the code to the Gearswap\Data folder as "AllJobs.lua"

  2. Edit the file and Modify the top two variables, jobs to whichever jobs you play and playerName so that the correct files are be loaded

  3. In game, run "//gs load AllJobs.lua"

  4. In game, run "//gs validate BAGNAME" (such as WARDROBE or WARDROBE2, etc.)

  5. When you are done run "//lua r gearswap" to reset everything



I've also included a toggle for your global items file PLAYER-Items.lua in case you're like me and you store all your herculean gear in shared variables such as gear.HercBootsTripAcc or other sets. If you want to use your global items file there is one extra step. You will need to edit your existing PLAYER-ITEMS.lua file and wrap the existing sets in a function called GetGlobalItems(), then call that function at the bottom to ensure that this still loads when you switch jobs like normal. I've included a small example of a tiny PLAYER-ITEMS file below.

AllJobs.lua wrapper
Code
-- Fill in which jobs you've created swaps for that you want to compare against as
-- well as your player name as these are used to load the correct files
local jobs = T{ "BLM", "BLU", "BST", "COR", "DRG", "MNK", "PUP", "RDM", "RUN", "SAM", "THF", "WHM"}
local playerName = 'Mohgeroth'
mysets = {}

-- To use your PLAYER-Items.lua file set this to true then edit your PLAYER-Items.lua file
-- and wrap a function around those sets called GetGlobalItems(), then call it again
-- at the bottom of the PLAYER-Items.lua after the function to ensure it runs when sel libs load
useGlobalItems = false

function InitializeSetsForSelindrile()
	sets.precast = {}
	sets.precast.FC = {}
	sets.precast.JA = {}
	sets.precast.WS = {}
	sets.precast.RA = {}
	sets.precast.Item = {}
	sets.midcast = {}
	sets.midcast.RA = {}
	sets.midcast.Pet = {}
	sets.idle = {}
	sets.resting = {}
	sets.engaged = {}
	sets.defense = {}
	sets.buff = {}
	sets.element = {}
	sets.passive = {}
	sets.weapons = {}
	sets.DuskIdle = {}
	sets.DayIdle = {}
	sets.NightIdle = {}
	sets.buff = {}	
	gear = {}
	gear.default = {}
	gear.ElementalGorget = {name=""}
	gear.ElementalBelt = {name=""}
	gear.ElementalObi = {name=""}
	gear.ElementalCape = {name=""}
	gear.ElementalRing = {name=""}
	gear.FastcastStaff = {name=""}
	gear.RecastStaff = {name=""}
end

if useGlobalItems then
	InitializeSetsForSelindrile()
	include(playerName .. '-Items.lua')
end

for k,v in pairs(jobs) do
	InitializeSetsForSelindrile()				-- Must set each time after clearing out the sets list
	if useGlobalItems then GetGlobalItems() end
	include(playerName .. '_' .. v .. '_Gear.lua')
	init_gear_sets()							-- Selindrile uses this rather than get_sets
	mysets[v] = sets
	sets = {}
end

function get_sets()
    for k,v in pairs(mysets) do sets[k] = v end
end


PLAYER-Items.lua - If you're not using this or didn't even know about it then disregard this part and make your life easier!
Code
-- Wrap your sets in THIS function!
function GetGlobalItems()
	--Gearsets your character will use among multiple jobs.
	sets.Sheltered = {ring2="Sheltered Ring"}
	sets.Capacity = {back="Mecisto. Mantle"}

	sets.buff.Doom = {
		waist="Gishdubar Sash",
		ring1="Saida Ring",
		--ring2="Eshmun's Ring"
	}

	sets.TreasureHunter = {head="Volte Cap",waist="Chaac Belt"}

	sets.precast.Item['Hallowed Water'] = {

	}

	sets.precast.Item['Holy Water'] = {

	}

	--Augmented items that you'll use among multiple jobs.

	-- Taeon
	gear.TaeonHeadSnapshot = {
		name="Taeon Chapeau", 
		augments={'Mag. Evasion+16','"Snapshot"+5','"Snapshot"+5',}
	}

	-- Herculean Gear
	gear.HercHelmTreasureHunter = {
		name="Herculean Helm", 
		augments={'Accuracy+16','STR+7','"Treasure Hunter"+2','Accuracy+3 Attack+3','Mag. Acc.+13 "Mag.Atk.Bns."+13',}
	}	
	
	-- More gear sets.... however many you've got!
end

-- Call this AFTER the function like so or else it 
-- will NOT load when you switch jobs like normal
GetGlobalItems()
[+]
necroskull Necro Bump Detected! [46 days between previous and next post]
Offline
Posts: 33
By Autherius 2022-11-18 12:40:17
Link | Quote | Reply
 
This is one of the best things to have happened in my time playing this game. Amazing! Great work!
[+]
necroskull Necro Bump Detected! [259 days between previous and next post]
 Asura.Kanzaka
Offline
Server: Asura
Game: FFXI
user: Swordman
Posts: 1
By Asura.Kanzaka 2023-08-04 06:52:38
Link | Quote | Reply
 
This is Amazing, Thank you Sechs, TickTick and mohgeroth.
would be nice if we can extract the output to txt file.
[+]
Log in to post.