|  | 
    Barebones Summoner Gearswap
 
    
        
        
        
            
                
                     Carbuncle.Kyawind
                                                    
                                                                            
                                Server: Carbuncle Game: FFXI Posts: 49 
                
			
			By Carbuncle.Kyawind 2018-10-11 09:08:58			
			
						
                     
                 is there a way to add elemental siphon into it so it can automatically do it?? just curious if it can turn into 1 macro button lol?                                     
            
                
                     Lakshmi.Elidyr
                                                    
                                                                            
                                Server: Lakshmi Game: FFXI Posts: 913 
                
			
			By Lakshmi.Elidyr 2018-10-11 10:34:10			
			
						
                     
                 Specific to a certain file? Or just how can you do it?                                     
            
                
                     Lakshmi.Elidyr
                                                    
                                                                            
                                Server: Lakshmi Game: FFXI Posts: 913 
                
			
			By Lakshmi.Elidyr 2018-10-11 10:57:08			
			
						
                     
                 Step 1: Make a keybind/Alias: Code  send_command('bind @s gs c elemental_siphon')                          
send_command('alias siphon gs c elemental_siphon')
Step 2: Add the self command code: Code  
function self_command(command)    
if command == "elemental_siphon" then
    
        local mySpirit = DetermineMySpirit()
        
        if mySpirit ~= false then
        
            if pet.isvalid and player.mpp > 7 and (not buffactive['silence'] or not buffactive['amnesia']) then
                windower.send_command('pet "Release" <me>;wait 1;ma "' .. mySpirit .. '" <me>;wait 4;ja "Elemental Siphon" <me>')
                
            elseif player.mpp > 7 and (not buffactive['silence'] or not buffactive['amnesia']) then
                windower.send_command('ma "' .. mySpirit .. '" <me>;wait 4;ja "Elemental Siphon" <me>')
                
            end
            
        end
    
end
Step 3: Function to determine which spirit to use based on day: Code  function DetermineMySpirit()
    
    local zone_info = windower.ffxi.get_info()
    
    if zone_info then
        local day = gearswap.res.days[zone_info['day']].en
        
        if day == "Darksday" then
            return "Dark Spirit"
        
        elseif day == "Lightsday" then
            return "Light Spirit"
            
        elseif day == "Lightningday" then
            return "Thunder Spirit"
            
        elseif day == "Iceday" then
            return "Ice Spirit"
            
        elseif day == "Windsday" then
            return "Air Spirit"
            
        elseif day == "Watersday" then
            return "Water Spirit"
            
        elseif day == "Earthsday" then
            return "Earth Spirit"
            
        elseif day == "Firesday" then
            return "Fire Spirit"
            
        end
        
    end
    
    return false
    
end
I didnt test, I can't verify it will work. I also don't know where you would put them in your files, but I think it should work maybe? Some one else may have something made already.
 
Works by pressing: 
or by typing: 
EDIT: Fixed the 'then' error. 
Function only makes determination on day, not weather.                                     
            
                
                     Carbuncle.Kyawind
                                                    
                                                                            
                                Server: Carbuncle Game: FFXI Posts: 49 
                
			
			By Carbuncle.Kyawind 2018-10-11 12:09:59			
			
						
                     
                 any specific place i need put this onto in the file?? i have it from the original thread link lua.
 do i put it at the very end or anywhere in the middle??
 
 
 (im a total clueless noob with this type of codes)
 
            
                
                     Carbuncle.Kyawind
                                                    
                                                                            
                                Server: Carbuncle Game: FFXI Posts: 49 
                
			
			By Carbuncle.Kyawind 2018-10-11 12:13:00			
			
						
                     
                 Step 1: Make a keybind/Alias: Code  send_command('bind @s gs c elemental_siphon')                          
send_command('alias siphon gs c elemental_siphon')
Step 2: Add the self command code: Code  
function self_command(command)    
if command == "elemental_siphon"
    
        local mySpirit = DetermineMySpirit()
        
        if mySpirit ~= false then
        
            if pet.isvalid and player.mpp > 7 and (not buffactive['silence'] or not buffactive['amnesia']) then
                windower.send_command('pet "Release" <me>;wait 1;ma "' .. mySpirit .. '" <me>;wait 4;ja "Elemental Siphon" <me>')
                
            elseif player.mpp > 7 and (not buffactive['silence'] or not buffactive['amnesia']) then
                windower.send_command('ma "' .. mySpirit .. '" <me>;wait 4;ja "Elemental Siphon" <me>')
                
            end
            
        end
    
end
Step 3: Function to determine which spirit to use based on day: Code  function DetermineMySpirit()
    
    local zone_info = windower.ffxi.get_info()
    
    if zone_info then
        local day = gearswap.res.days[zone_info['day']].en
        
        if day == "Darksday" then
            return "Dark Spirit"
        
        elseif day == "Lightsday" then
            return "Light Spirit"
            
        elseif day == "Lightningday" then
            return "Thunder Spirit"
            
        elseif day == "Iceday" then
            return "Ice Spirit"
            
        elseif day == "Windsday" then
            return "Air Spirit"
            
        elseif day == "Watersday" then
            return "Water Spirit"
            
        elseif day == "Earthsday" then
            return "Earth Spirit"
            
        elseif day == "Firesday" then
            return "Fire Spirit"
            
        end
        
    end
    
    return false
    
end
I didnt test, I can't verify it will work. I also don't know where you would put them in your files, but I think it should work maybe? Some one else may have something made already.
 
Works by pressing: 
or by typing:
in step2 : Line5 
 
that pops up in my console saying :
 
'then' expected near 'local'
 
no idea what that means...                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Asura Game: FFXI Posts: 1518 
                
			
			By Asura.Pergatory 2018-10-11 18:02:15			
			
						
                     
                 I believe you need to add a "then" to the end of that line: Code  if command == "elemental_siphon" then
Also keep in mind that function doesn't appear to consider the weather, which sometimes affects your decision. So it won't be perfect but should be good most of the time.                                     
            
                
                     Lakshmi.Elidyr
                                                    
                                                                            
                                Server: Lakshmi Game: FFXI Posts: 913 
                
			
			By Lakshmi.Elidyr 2018-10-11 19:40:42			
			
						
                     
                 I believe you need to add a "then" to the end of that line: Code  if command == "elemental_siphon" then
Also keep in mind that function doesn't appear to consider the weather, which sometimes affects your decision. So it won't be perfect but should be good most of the time.
Yeah sorry, I forgot the then, and I didn't put any assumptions on weather, just the day.
 
Also I have no ideas about anything in the file, I was just attempting to help whoever asked, and give some ideas. Feel free to ignore me, I'm nobody! :D                                     
            
            
                            
                    [+]
                                               Necro Bump Detected! 
			[35 days between previous and next post]
            
            
                
			
			By Elizabet 2018-11-15 10:54:19			
			
						
                     
                 Carbuncle.Kyawind said: »is there a way to add elemental siphon
It does already, summon dark spirit, it'll hijack it and summon instead the best spirit. Then just add delay aand command to  siphon it, release etc... in your macro.
 
So you make a macro like:
 
/ma "Dark  Spirit" <me> 
/wait 3 (or w/e depending on FC) 
/ja "Elemental Siphon <me> 
/wait 1 
/ja "Release" <me>
 
something like that.
 
snippet: Code  
    elseif spell.type == 'SummonerPact' then
     
        -- This chunk of code handles Elemental Siphon. It will look at the current day and weather and cancel the spell to summon
        -- the right elemental. Your elemental siphon macro should summon a Dark Spirit to trigger this check
         
        -- These use the included lists in global.lua to determine the right spirit to summon
             
        if spell.name == 'Dark Spirit' then
            if world.weather_element == 'Dark' then
             
                -- Dark Weather is active, lets the spell go ahead and equips summoning precast
                equip(sets.precast.summoning)
                 
            elseif world.weather_element ~= 'None' and spirit_conflict[world.day_element] ~= world.weather_element then
             
                -- It's not dark weather but there is some weather up, cancels dark and summons the right spirit
                cancel_spell()
                send_command('input /ma "%s" <me>':format(spirit_element[world.weather_element]))
                equip(sets.precast.summoning)
                 
            elseif world.day_element == 'Dark' then
             
                -- It's darksday so allow the dark spirit to go ahead and equip summoning
                equip(sets.precast.summoning)
                 
            else
             
                -- There is no weather up and it's not darksday, so summon the current day's spirit
                cancel_spell()              
                send_command('input /ma "%s" <me>':format(spirit_element[world.day_element]))
                equip(sets.precast.summoning)
                 
            end
        else
         
            -- We're not summoning Dark Spirit, so we don't want to Siphon, which means we're summoning an avatar
            equip(sets.precast.summoning)
             
        end
 
            
            
                
			
			By Elizabet 2018-11-15 10:57:28			
			
						
                     
                 i am having an issue getting the precast for bp delay to work
Can you elaborate what sort of issue you are having? It works for me and most people.                                     
            
            
                
			
			By Elizabet 2018-11-19 00:36:09			
			
						
                     
                 never mind now it works. not sure why sometimes it doesn't swap.
Maybe you had apogee / conduit up?
 
There is a check in the LUA to not swap into BP delay when those are up to prevent BPing in delay set instead of dmg set when under those buffs where delay is irrelevant.
 
Edit: repo link changed: https://github.com/Tunaliz/Liz_Gearswaps  Necro Bump Detected! 
			[218 days between previous and next post]
            
            
                
			
			By Mcdougall 2019-06-25 03:45:05			
			
						
                     
                 Carbuncle.Kyawind said: »is there a way to add elemental siphon
It does already, summon dark spirit, it'll hijack it and summon instead the best spirit. Then just add delay aand command to  siphon it, release etc... in your macro.
 
So you make a macro like:
 
/ma "Dark  Spirit" <me> 
/wait 3 (or w/e depending on FC) 
/ja "Elemental Siphon <me> 
/wait 1 
/ja "Release" <me>
 
something like that.
I believe he is talking something like how kinematics handles siphoning.
 
All you have to do is gs c siphon.
 
It will automatically check the day and weather and summon the spirit just as this Lua does. 
 
But it has a few extra that would be amazing to have in this Lua I just have no idea how to code or else I would try.. 
 
The really cool things it does if you have a pet out and use siphon it will automatically resummon the pet. 
 
This is the code that handles it all.. 
 Code  -- Custom uber-handling of Elemental Siphon
function handle_siphoning()
    if areas.Cities:contains(world.area) then
        add_to_chat(122, 'Cannot use Elemental Siphon in a city area.')
        return
    end
    local siphonElement
    local stormElementToUse
    local releasedAvatar
    local dontRelease
    
    -- If we already have a spirit out, just use that.
    if pet.isvalid and spirits:contains(pet.name) then
        siphonElement = pet.element
        dontRelease = true
        -- If current weather doesn't match the spirit, but the spirit matches the day, try to cast the storm.
        if player.sub_job == 'SCH' and pet.element == world.day_element and pet.element ~= world.weather_element then
            if not S{'Light','Dark','Lightning'}:contains(pet.element) then
                stormElementToUse = pet.element
            end
        end
    -- If we're subbing /sch, there are some conditions where we want to make sure specific weather is up.
    -- If current (single) weather is opposed by the current day, we want to change the weather to match
    -- the current day, if possible.
    elseif player.sub_job == 'SCH' and world.weather_element ~= 'None' then
        -- We can override single-intensity weather; leave double weather alone, since even if
        -- it's partially countered by the day, it's not worth changing.
        if get_weather_intensity() == 1 then
            -- If current weather is weak to the current day, it cancels the benefits for
            -- siphon.  Change it to the day's weather if possible (+0 to +20%), or any non-weak
            -- weather if not.
            -- If the current weather matches the current avatar's element (being used to reduce
            -- perpetuation), don't change it; just accept the penalty on Siphon.
            if world.weather_element == elements.weak_to[world.day_element] and
                (not pet.isvalid or world.weather_element ~= pet.element) then
                -- We can't cast lightning/dark/light weather, so use a neutral element
                if S{'Light','Dark','Lightning'}:contains(world.day_element) then
                    stormElementToUse = 'Wind'
                else
                    stormElementToUse = world.day_element
                end
            end
        end
    end
    
    -- If we decided to use a storm, set that as the spirit element to cast.
    if stormElementToUse then
        siphonElement = stormElementToUse
    elseif world.weather_element ~= 'None' and (get_weather_intensity() == 2 or world.weather_element ~= elements.weak_to[world.day_element]) then
        siphonElement = world.weather_element
    else
        siphonElement = world.day_element
    end
    
    local command = ''
    local releaseWait = 0
    
    if pet.isvalid and avatars:contains(pet.name) then
        command = command..'input /pet "Release" <me>;wait 1.1;'
        releasedAvatar = pet.name
        releaseWait = 10
    end
    
    if stormElementToUse then
        command = command..'input /ma "'..elements.storm_of[stormElementToUse]..'" <me>;wait 4;'
        releaseWait = releaseWait - 4
    end
    
    if not (pet.isvalid and spirits:contains(pet.name)) then
        command = command..'input /ma "'..elements.spirit_of[siphonElement]..'" <me>;wait 4;'
        releaseWait = releaseWait - 4
    end
    
    command = command..'input /ja "Elemental Siphon" <me>;'
    releaseWait = releaseWait - 1
    releaseWait = releaseWait + 0.1
    
    if not dontRelease then
        if releaseWait > 0 then
            command = command..'wait '..tostring(releaseWait)..';'
        else
            command = command..'wait 1.1;'
        end
        
        command = command..'input /pet "Release" <me>;'
    end
    
    if releasedAvatar then
        command = command..'wait 1.1;input /ma "'..releasedAvatar..'" <me>'
    end
    
    send_command(command)
end
Here is kinematics Lua if I missed something important for someone to help me out. 
  Necro Bump Detected! 
			[47 days between previous and next post]
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Sylph Game: FFXI Posts: 90 
                
			
			By Sylph.Excalin 2019-08-11 15:17:35			
			
						
                     
                 So another necro bump, but never saw the above resolved....how do I set it up to use //gs c siphon?  been trying to dig through all this stuff and not sure where that gets set up to work.                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Asura Game: FFXI Posts: 497 
                
			
			By Asura.Elizabet 2019-08-11 15:26:17			
			
						
                     
                 There is no //gs c siphon in this lua.  
It simply replaces dark spirit with whichever spirit will be most efficient. 
 
Macro this: 
 Quote:  /ma "Dark Spirit" <me>/wait 3 (or w/e depending on FC)
 /ja "Elemental Siphon <me>
 /wait 1
 /ja "Release" <me>
 
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Sylph Game: FFXI Posts: 90 
                
			
			By Sylph.Excalin 2019-08-11 15:37:18			
			
						
                     
                 There is no //gs c siphon in this lua.  
It simply replaces dark spirit with whichever spirit will be most efficient. 
 
Macro this: 
 Quote:  /ma "Dark Spirit" <me>/wait 3 (or w/e depending on FC)
 /ja "Elemental Siphon <me>
 /wait 1
 /ja "Release" <me>
I am trying to figure out how to put it in there                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Asura Game: FFXI Posts: 497 
                
			
			By Asura.Elizabet 2019-08-11 15:49:26			
			
						
                     
                 just in game macro, not in the lua itself                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Sylph Game: FFXI Posts: 90 
                
			
			By Sylph.Excalin 2019-08-11 15:54:36			
			
						
                     
                 just in game macro, not in the lua itself
Yes, I understand that.  I am not asking how to use your LUA, I am asking how to change your LUA to what I want to do with it.                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Sylph Game: FFXI Posts: 90 
                
			
			By Sylph.Excalin 2019-08-11 18:15:49			
			
						
                     
                 So instead of adding a binding I decided to just add in a precast to Elemental Siphon: 
So I can get the code to release the avatar, but I get the "Already has a pet". what am I doing wrong with the wait time?
 Code  
	elseif spell.name == 'Elemental Siphon' then
         
		cancel_spell()
		
		if pet.isvalid then
		
			send_command('pet "Release";wait 1.1;')
			releasedAvatar = pet.name
		end
		
		if world.weather_element ~= 'None' then
		send_command('input /ma "%s" <me>':format(spirit_element[world.weather_element]))
        equip(sets.precast.summoning)		
--		send_Command('wait 4;ja "Elemental Siphon" <me>')			
		
		else
        -- There is no weather up, summon the current day's spirit		
		send_command('input /ma "%s" <me>':format(spirit_element[world.day_element]))
        equip(sets.precast.summoning)
--		send_Command('wait 4;ja "Elemental Siphon" <me>')	
		
	end
 
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Asura Game: FFXI Posts: 497 
                
			
			By Asura.Elizabet 2019-08-11 18:32:38			
			
						
                     
                 Oh, well since you posted in this thread I thought it was with the lua itself. But your question is just generic gearswap stuff. 
 I think the pet release is wrongly put and doesn't work but silently fails cause gearswaps does the thing but the game doesnt do anything with it.
 
 send_command('pet "Release";wait 1.1;')
 
 think you wanna put:
 
 send_command('input /pet "Release";wait 1.1;')
 
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Sylph Game: FFXI Posts: 90 
                
			
			By Sylph.Excalin 2019-08-11 18:39:50			
			
						
                     
                 Oh, well since you posted in this thread I thought it was with the lua itself. But your question is just generic gearswap stuff. 
 I think the pet release is wrongly put and doesn't work but silently fails cause gearswaps does the thing but the game doesnt do anything with it.
 
 send_command('pet "Release";wait 1.1;')
 
 think you wanna put:
 
 send_command('input /pet "Release";wait 1.1;')
Didn't fix it.
 
It will release the current pet just fine, but it runs into the "Already have" or "cant cast" message.
 
If I have nothing out, it summons the correct elemental.
 
I just can't get it to move through the chain correctly
 
P.S. posting in this thread because I am working with this lua specifically, but I may move to the main thread soon.                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Asura Game: FFXI Posts: 1518 
                
			
			By Asura.Pergatory 2019-08-12 10:10:51			
			
						
                     
                 I think the problem is that the "wait" does nothing at the end of the statement.
 send_command('input /pet "Release";wait 1.1;')
 
 send_command('input /ma "%s" <me>':format(spirit_element[world.weather_element]))
 
 These are two separate lines. The wait is for anything that comes after it on the same line.
 
 I'd suggest constructing one long console statement, then send it all at once.
 
 Edit: Or do it like you have in your comments, put the wait at the start of the line.
 
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Asura Game: FFXI Posts: 497 
                
			
			By Asura.Elizabet 2019-08-12 12:26:31			
			
						
                     
                 Try this instead of the snippet you posted 
Also, now that I am looking at it not hella tired, I noticed your above code snippet was using siphon in your fast cast set. So I fixed that in the code below.
sets.precast.summoning  is fast cast for summoning pet, it combines from sets.precast.casting, but is sepperate so you can put in Bayaami body for SIRD. 
sets.avatar.skill  is the set for max Summoning Magic Skill.
 Code  
    elseif spell.name == 'Elemental Siphon' then
          
        cancel_spell()
         
        if pet.isvalid then
			if world.weather_element ~= 'None' then
				releasedAvatar = pet.name
				send_command('/pet "Release" <me>')
				equip(sets.precast.summoning)
				send_command('wait 1.1;/ma "%s" <me>':format(spirit_element[world.weather_element])))
			else -- There is no weather up, summon the current day's spirit 
				releasedAvatar = pet.name
				send_command('/pet "Release" <me>')
				equip(sets.precast.summoning)
				send_command('wait 1.1;/ma "%s" <me>':format(spirit_element[world.day_element])))
			end
        else -- No pet was up
			if world.weather_element ~= 'None' then
				equip(sets.precast.summoning)
				send_command('input /ma "%s" <me>':format(spirit_element[world.weather_element]))
			else -- There is no weather up, summon the current day's spirit 
				equip(sets.precast.summoning)
				send_command('input /ma "%s" <me>':format(spirit_element[world.day_element]))
			end
		end
        
		equip(sets.avatar.skill)
		send_Command('wait 4;/ja "Elemental Siphon" <me>') 
         
    end
  Necro Bump Detected! 
			[98 days between previous and next post]
            
            
                
			
			By Jetackuu 2019-11-18 12:10:44			
			
						
                     
                 So since the git doesn't have the file is there anywhere this is posted with a lot of the updates that were mentioned?                                      Necro Bump Detected! 
			[978 days between previous and next post]
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Asura Game: FFXI Posts: 3 
                
			
			By Asura.Shakyamuni 2022-07-23 17:33:55			
			
						
                     
                 I was trying to find your smn.lua and it is not listed in your github gearswap.                                     
    
    
        
        GitHub: Thanks to Elizabet for hosting this on GitHub
People have been having issues with Mote's SMN Gearswap recently. After lengthy conversations on the topic as well as going through his files, I believe the files themselves are to blame. Several people, evidently myself included, have not had issues with custom SMN Lua files. As a result, and due to several requests, I've decided to post my Lua to provide a viable alternative to Mote's. I make no elaborate claims that this is better (or worse, for that matter), I'm sharing purely so people can try it for themselves.
 
I give my personal guarantee that everything worked 100% at the time of posting, tested numerous times with Abyssea Revitalizers.
 
The inline comments should assist you in setting this up. You'll find it's much simpler than most SMN Luas. With no disrespect meant to people who have helped people out with Gear Swap, I find SMN Luas in particular to be way more complicated than they need to be, often containing dozens of lines of superfluous code.
What this Lua is: What this Lua is not:SimpleDoes not rely on lengthy includes or libraries, which will make it easier to trouble shoot should part of it not be working correctly at some pointCut and paste ready. I've even taken the liberty of not adding gear so you can type yours in quicker
 ComplicatedNirvana ready. I don't and will never own a Nirvana so Aftermaths are moot to me. If enough people want this, I'm happy to add it thoughThe best of the bestest all others suck etc, judge for yourself
 
With that said, here we go. This comes in two files: firstly, global.lua, which contains a list of blood pacts and what not, as well as a couple of my own functions that I use in all my Lua files (like auto style lock, macro books, etc.) The second file is the lua file itself that you'll need to add your equipment to. Be sure to remove blank lines when you're done (ie, hands="".)
 
You can put the global.lua file contents at the start of your SMN.lua file if you prefer, that way you have no includes.
Global.lua: SMN.Lua:Code  function set_macros(sheet,book)
	if book then 
		send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(sheet))
		return
	end
	send_command('@input /macro set '..tostring(sheet))
end
function set_style(sheet)
	send_command('@input /lockstyleset '..sheet)
end
bp_physical=S{'Punch','Rock Throw','Barracuda Dive','Claw','Axe Kick','Shock Strike','Camisado','Regal Scratch','Poison Nails','Moonlit Charge','Crescent Fang','Rock Buster','Tail Whip','Double Punch','Megalith Throw','Double Slap','Eclipse Bite','Mountain Buster','Spinning Dive','Predator Claws','Rush','Chaotic Strike','Crag Throw','Volt Strike'}bp_hybrid=S{'Burning Strike','Flaming Crush'}bp_magical=S{'Inferno','Earthen Fury','Tidal Wave','Aerial Blast','Diamond Dust','Judgment Bolt','Searing Light','Howling Moon','Ruinous Omen','Fire II','Stone II','Water II','Aero II','Blizzard II','Thunder II','Thunderspark','Somnolence','Meteorite','Fire IV','Stone IV','Water IV','Aero IV','Blizzard IV','Thunder IV','Nether Blast','Meteor Strike','Geocrush','Grand Fall','Wind Blade','Heavenly Strike','Thunderstorm','Level ? Holy','Holy Mist','Lunar Bay','Night Terror','Conflag Strike'}bp_debuff=S{'Lunar Cry','Mewing Lullaby','Nightmare','Lunar Roar','Slowga','Ultimate Terror','Sleepga','Eerie Eye','Tidal Roar','Diamond Storm','Shock Squall','Pavor Nocturnus'}bp_buff=S{'Shining Ruby','Frost Armor','Rolling Thunder','Crimson Howl','Lightning Armor','Ecliptic Growl','Hastega','Noctoshield','Ecliptic Howl','Dream Shroud','Earthen Armor','Fleet Wind','Inferno Howl','Soothing Ruby','Heavenward Howl','Soothing Current','Hastega II','Crystal Blessing'}bp_other=S{'Healing Ruby','Raise II','Aerial Armor','Reraise II','Whispering Wind','Glittering Ruby','Earthen Ward','Spring Water','Healing Ruby II'} AvatarList=S{'Shiva','Ramuh','Garuda','Leviathan','Diabolos','Titan','Fenrir','Ifrit','Carbuncle','Fire Spirit','Air Spirit','Ice Spirit','Thunder Spirit','Light Spirit','Dark Spirit','Earth Spirit','Water Spirit','Cait Sith','Alexander','Odin','Atomos'}spirit_element={Fire='Fire Spirit',Earth='Earth Spirit',Water='Water Spirit',Wind='Air Spirit',Ice='Ice Spirit',Lightning='Thunder Spirit',Light='Light Spirit',Dark='Dark Spirit'}spirit_conflict={Fire='Ice',Earth='Lightning',Water='Fire',Wind='Earth',Ice='Wind',Lightning='Water',Light='Dark',Dark='Light'}Code  include('global.lua') -- Just a collection of functions that I use in all my GearSwaps. See below (after this code block)
set_macros(1,2) -- Sheet, Book
function get_sets()
	-- My formatting is very easy to follow. All sets that pertain to my character doing things are under 'me'.
	-- All sets that are equipped to faciliate my avatar's behaviour or abilities are under 'avatar', eg, Perpetuation, Blood Pacts, etc
	
	sets.me = {}
	sets.avatar = {}
	
	-- Your idle set when you DON'T have an avatar out
	sets.me.idle = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	
	-- Your MP Recovered Whilst Resting Set
	sets.me.resting = {	
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	
	-----------------------
	-- Perpetuation Related
	-----------------------
	
	-- Avatar's Out --	
	-- This is the base for all perpetuation scenarios, as seen below
	sets.avatar.perp = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	-- The following sets base off of perpetuation, so you can consider them idle sets.
	-- Set the relevant gear, bearing in mind it will overwrite the perpetuation item for that slot!
	
	-- When we want our avatar to stay alive
	sets.avatar.tank = set_combine(sets.avatar.perp,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- When we want our avatar to shred
	sets.avatar.melee = set_combine(sets.avatar.perp,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- When we want our avatar to hit
	sets.avatar.acc = set_combine(sets.avatar.perp,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- When Avatar's Favori s active
	sets.avatar.favor = set_combine(sets.avatar.perp,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	----------------------------
	-- Summoning Skill Related
	-- Including all blood pacts
	----------------------------
	
	-- + Summoning Magic. This is a base set for max skill and blood pacts and we'll overwrite later as and when we need to
	sets.avatar.skill = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	
	-------------------------
	-- Individual Blood Pacts
	-------------------------
	
	-- Physical damage
	sets.avatar.atk = set_combine(sets.avatar.skill,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Magic Attack
	sets.avatar.mab = set_combine(sets.avatar.skill,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	-- Hybrid
	sets.avatar.hybrid = set_combine(sets.avatar.skill,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Magic Accuracy
	sets.avatar.macc = set_combine(sets.avatar.skill,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Buffs
	sets.avatar.buff = set_combine(sets.avatar.skill,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Other
	sets.avatar.other = set_combine(sets.avatar.skill,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Combat Related Sets
	
	-- Melee
	-- The melee set combines with perpetuation, because we don't want to be losing all our MP whilst we swing our Staff
	-- Anything you equip here will overwrite the perpetuation/refresh in that slot.
	sets.me.melee = set_combine(sets.avatar.perp,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Shattersoul. Weapon Skills do not work off perpetuation as it only stays equipped for a moment
	sets.me["Shattersoul"] = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	sets.me["Garland of Bliss"] = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	
	-- Feel free to add new weapon skills, make sure you spell it the same as in game. These are the only two I ever use though
	---------------
	-- Casting Sets
	---------------
	
	sets.precast = {}
	sets.midcast = {}
	sets.aftercast = {}
	
	----------
	-- Precast
	----------
	
	-- Generic Casting Set that all others take off of. Here you should add all your fast cast	
	sets.precast.casting = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}	
	
	-- Summoning Magic Cast time - gear
	sets.precast.summoning = set_combine(sets.precast.casting,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Enhancing Magic, eg. Siegal Sash, etc
	sets.precast.enhancing = set_combine(sets.precast.casting,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	-- Stoneskin casting time -, works off of enhancing -
	sets.precast.stoneskin = set_combine(sets.precast.enhancing,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Curing Precast, Cure Spell Casting time -
	sets.precast.cure = set_combine(sets.precast.casting,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	---------------------
	-- Ability Precasting
	---------------------
	
	-- Blood Pact Ability Delay
	sets.precast.bp = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	
	-- Mana Cede
	sets.precast["Mana Cede"] = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	
	-- Astral Flow	
	sets.precast["Astral Flow"] = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	
	-- Elemental Siphon, eg, Tatsumaki Thingies, Esper Stone, etc
	sets.precast.siphon = set_combine(sets.avatar.skill,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	----------
	-- Midcast
	----------
	
	-- We handle the damage and etc. in Pet Midcast later
	
	-- Whatever you want to equip mid-cast as a catch all for all spells, and we'll overwrite later for individual spells
	sets.midcast.casting = {
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	}
	
	-- Enhancing
	sets.midcast.enhancing = set_combine(sets.midcast.casting,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Stoneskin
	sets.midcast.stoneskin = set_combine(sets.midcast.enhancing,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	-- Cure Potency
	sets.midcast.cure = set_combine(sets.midcast.casting,{
		main="",
		sub="",
		ranged="",
		ammo="",
		head="",
		neck="",
		lear="",
		rear="",
		body="",
		hands="",
		lring="",
		rring="",
		back="",
		waist="",
		legs="",
		feet=""
	})
	
	------------
	-- Aftercast
	------------
	
	-- I don't use aftercast sets, as we handle what to equip later depending on conditions using a function, eg, do we have an avatar out?
end
function precast(spell)
	-- Don't swap if we're in the middle of something or our pet's doing something
	-- Stops macro spam from interfering with an action GS is already handling
    if midaction() or pet_midaction() then
        return
    end
	
	-- If we're doing a blood pact, equip our delay set IF Apogee or Astral Conduit are not active
    if (spell.type == 'BloodPactRage' or spell.type == 'BloodPactWard') and not (buffactive['Astral Conduit'] or buffactive['Apogee']) then
	
        equip(sets.precast.bp)
		
    elseif spell.type == 'SummonerPact' then
	
		-- This chunk of code handles Elemental Siphon. It will look at the current day and weather and cancel the spell to summon
		-- the right elemental. Your elemental siphon macro should summon a Dark Spirit to trigger this check
		
		-- These use the included lists in global.lua to determine the right spirit to summon
			
        if spell.name == 'Dark Spirit' then
            if world.weather_element == 'Dark' then
			
				-- Dark Weather is active, lets the spell go ahead and equips summoning precast
                equip(sets.precast.summoning)
				
			elseif world.weather_element ~= 'None' and spirit_conflict[world.day_element] ~= world.weather_element then
			
				-- It's not dark weather but there is some weather up, cancels dark and summons the right spirit
                cancel_spell()
                send_command('input /ma "%s" <me>':format(spirit_element[world.weather_element]))
				equip(sets.precast.summoning)
				
            elseif world.day_element == 'Dark' then
			
				-- It's darksday so allow the dark spirit to go ahead and equip summoning
                equip(sets.precast.summoning)
				
            else
			
				-- There is no weather up and it's not darksday, so summon the current day's spirit
                cancel_spell()				
                send_command('input /ma "%s" <me>':format(spirit_element[world.day_element]))
				equip(sets.precast.summoning)
				
            end
		else
		
			-- We're not summoning Dark Spirit, so we don't want to Siphon, which means we're summoning an avatar
			equip(sets.precast.summoning)
			
		end
		
	-- Moving on to other types of magic
	elseif spell.type == 'WhiteMagic' or spell.type == 'BlackMagic' then
	
		-- Stoneskin Precast
        if spell.name == 'Stoneskin' then
		
            windower.ffxi.cancel_buff(37)--[[Cancels stoneskin, not delayed incase you get a Quick Cast]]
            equip(sets.precast.stoneskin)
			
		-- Cure Precast
        elseif spell.name:match('Cure') or spell.name:match('Cura') then
		
            equip(sets.precast.cure)
			
		-- Enhancing Magic
        elseif spell.skill == 'Enhancing Magic' then
		
            equip(sets.precast.enhancing)
			
            if spell.name == 'Sneak' then
                windower.ffxi.cancel_buff(71)--[[Cancels Sneak]]
            end
        else
		
			-- For everything else we go with max fastcast
            equip(sets.precast.casting)
			
        end
		
	-- Summoner Abilities
	-- We use a catch all here, if the set exists for an ability, use it
	-- This way we don't need to write a load of different code for different abilities, just make a set
	
	elseif sets.precast[spell.name] then
        equip(sets.precast[spell.name])
    end
	
end
function midcast(spell)
	-- If our pet is doing something, prevents us swapping equipment too early
    if pet_midaction() then
        return
    end
	
	-- No need to annotate all this, it's fairly logical. Just equips the relevant sets for the relevant magic
	if spell.type == 'WhiteMagic' or spell.type == 'BlackMagic' then
        if spell.name == 'Stoneskin' then
            equip(sets.midcast.stoneskin)
        elseif spell.name:match('Cure') or spell.name:match('Cura') then
            equip(sets.midcast.cure)
        elseif spell.skill == 'Enhancing Magic' then
            equip(sets.midcast.enhancing)
			if spell.name:match('Protect') or spell.name:match('Shell') then
				equip({rring="Sheltered Ring"})
            end
        else
            equip(sets.midcast.casting)
        end
    elseif spell.name == 'Elemental Siphon' then
	
		-- Siphon Set
        equip(sets.precast.siphon)
		
		-- Checks if pet matches weather
        if pet.element == world.weather_element then
            equip(sets.precast.siphon,{main="Chatoyant Staff"--[[Take advantage of the weather boost]]})
		end
		
	-- And our catch all, if a set exists for this spell use it
	elseif sets.midcast[spell.name] then
		equip(sets.midcast[spell.name])
		
	-- Remember those WS Sets we defined? :)
	elseif sets.me[spell.name] then
		equip(sets.me[spell.name])
	end
end
function aftercast(spell)
	-- If our pet's doing something, Stop!
    if pet_midaction() then
        return
    end	
	
	-- If not a blood pact or summon
	if spell and (not spell.type or not string.find(spell.type,'BloodPact') and not AvatarList:contains(spell.name) or spell.interrupted) then
	
		-- Then initiate idle function to check which set should be equipped
		idle(pet)
		
	end
end
function pet_midcast(spell)
	-- Our pet is doing something
    if (spell.type == 'BloodPactRage' or spell.type == 'BloodPactWard') then
	
		-- We're going to check the lists in global.lua for matches and equip the relevant sets
		
		if bp_physical:contains(spell.name) then
		
            equip(sets.avatar.atk)
			
        elseif bp_hybrid:contains(spell.name) then
		
            equip(sets.avatar.hybrid)
			if pet.name == 'Ifrit' then
				equip({rring="Fervor Ring"})--[[Change rring to lring if you put Evoker's on your right hand]]
			end
			
        elseif bp_magical:contains(spell.name) then
		
			equip(sets.avatar.mab)
			if pet.name == 'Ifrit' then
				equip({rring="Fervor Ring"})--[[Change rring to lring if you put Evoker's on your right hand]]
			end
		elseif bp_debuff:contains(spell.name) then
		
            equip(sets.avatar.macc)
			
        elseif bp_buff:contains(spell.name) then
		
            equip(sets.avatar.buff)
			
        elseif bp_other:contains(spell.name) then
		
            equip(sets.avatar.other)
			
        elseif spell.name == 'Perfect Defense' then
		
			equip(sets.avatar.skill)
			
		else
		
			equip(sets.avatar.skill)
			
		end
	end	
end
function pet_aftercast(spell)
	
	-- Pet aftercast is simply a check for whether Conduit and Apogee are up, and then a call to our aftercast function
	-- We have a variable called autobp that we set to true or false with commands to auto repeat BPs for us
    if (buffactive['Apogee'] or buffactive['Astral Conduit']) and autobp then
        send_command('input /pet "%s" <t>':format(spell.name))
		return
	end
	
	idle(pet)
	
end
function idle(pet)
	-- This function is called after every action, and handles which set to equip depending on what we're doing
	-- We check if we're meleeing because we don't want to idle in melee gear when we're only engaged for trusts
	
	if favor then
	
		-- Avatar's favor takes priority!
		equip(sets.avatar.favor)
		
	elseif meleeing and player.status=='Engaged' then
	
		-- We're both engaged and meleeing
		equip(sets.me.melee)
		
	elseif pet.isvalid then
		
		-- We have a pet out but we're not meleeing, set the right idle set
		equip(sets.avatar[mode])
	else
	
		-- We're not meleeing and we have no pet out
		equip(sets.me.idle)
		
	end
end
function status_change(new,old)
    if new == 'Engaged' then
	
		-- If we engage check our meleeing status
		idle(pet)
		
	elseif new=='Resting' then
	
		-- We're resting
        equip(sets.me.resting)
	else
		idle(pet)
	end
end
function pet_change(pet,gain)
	-- When we summon or release an avatar
    idle(pet)
end
function self_command(command)
	local commandArgs = command
	
	-- This command takes //gs c avatar mode, where mode is what you want, eg, tank, acc, melee, etc
    if #commandArgs:split(' ') >= 2 then
        commandArgs = T(commandArgs:split(' '))
		if commandArgs[1] == 'avatar' then
			if commandArgs[2] then
				mode = tostring(commandArgs[2])
				equip(sets.avatar[mode])
				windower.add_to_chat(8,'----- Avatar set to '..mode..' mode! -----')
			end
		elseif commandArgs[1] == 'toggle' then
			if commandArgs[2] == 'auto' then
			
				-- //gs c toggle auto will toggle auto blood pacts on and off. Auto blood pact will make your GS repeat BPs under Apogee or Conduit
				-- And by repeat I mean repeat. If Conduit is up, it will SPAM the BP until Conduit is down
				if autobp then
					autobp = false
					windower.add_to_chat(8,'----- Auto BP mode Disabled -----')
				else
					autobp = true
					windower.add_to_chat(8,'----- Auto BP mode Enabled -----')
				end
			elseif commandArgs[2] == 'melee' then
			
				-- //gs c toggle melee will toggle melee mode on and off.
				-- This basically locks the slots that will cause you to lose TP if changing them,
				-- As well as equip your melee set if you're engaged
				if meleeing then
					meleeing = false
					enable('main','sub','ranged')
					windower.add_to_chat(8,'----- Weapons Unlocked, WILL LOSE TP -----')
					idle(pet)
				else
					meleeing=true
					disable('main','sub','ranged')
					windower.add_to_chat(8,'----- Weapons Locked, WILL NOT LOSE TP -----')
					idle(pet)
				end
				
			elseif commandArgs[2] == 'favor' then
					
				-- //gs c toggle favor will toggle Favor mode on and off.
				-- It won't automatically toggle, as some people like having favor active without the gear swaps for maximum effectiveness
				-- You need to toggle prioritisation yourself
				if favor then
					favor = false
					windower.add_to_chat(8,"----- Avatar's Favor Mode OFF -----")
				else
					favor = true
					windower.add_to_chat(8,"----- Avatar's Favor Mode ON -----")
				end
				
			end
		end
	end
end
-- Required variables and their initial value
meleeing = false
autobp = false
favor = false
mode = "perp"
Here's a run down on commands:
//gs c avatar [mode] 
Replace [mode] with either: perp, tank, melee, acc to set your avatar's idling equipment to a particular setup. Perp is for maximum perp- and refresh, tank for tanking, melee for doing maximum physical damage and acc for accuracy.
//gs c toggle melee 
This will toggle your character between melee mode. Initially set to false, enabling this will idle to your melee set when engaged as well as disable slots that changing items in would remove TP. With this turned off being engaged will not equip your melee gear, so you can stay engaged for the purposes of trusts whilst keeping your relevant perpetuation gear on.
//gs c toggle auto 
Initially turned off, using this command will toggle auto blood pacts on Apogee and Conduit. By auto I literally mean auto. Using a blood pact with this on will use it again instantly if you have Apogee or Conduit up. If you have Conduit up, your character will spam abilities until you either toggle this off or Conduit drops.
//gs c toggle favor 
Initially turned off, this command will toggle your character into favor prioritisation mode. This means that, with this on, Avatar's Favor set will override other idle sets, including melee. Using Avatar's Favor will not  toggle this automatically. One particular problem with lots of Luas is this assumption is made, and most end users don't know how to disable it.
 
There are times and places we want maximum Favor power, and they are quite limited. You be the judge and set this yourself when you want it.
 
--
 
If you have any questions or problems, please reply and I'll try and help. |  |