|  | 
    Barebones Summoner Gearswap
 
    
        
        
        
            
            
                
			
			By Aeyela 2015-10-05 04:09:05			
			
						
                     
                 Your pact function is a child of the toggle function, which means Windower is not executing the commands because your macro is missing 'toggle'. Adding toggle won't work, either, as the syntax of the command will break. You need to move the pact function so that it is not a child of the toggle one. 
So basically, move all of this part:
 Code              -- Handles executing blood pacts in a generic, avatar-agnostic way.
            -- //gs c pact [pacttype]
            elseif commandArgs[1]:lower() == 'pact' then
                if not pet.isvalid then
                        windower.add_to_chat(122,'No avatar currently available. Returning to default macro set.')
                        set_macros(1,2)
                    return
                end
                
                if not commandArgs[2] then
                    windower.add_to_chat(123,'No pact type given.')
                    return
                end
                
                local pact = commandArgs[2]:lower()
                
                if not pacts[pact] then
                    windower.add_to_chat(123,'Unknown pact type: '..tostring(pact))
                    return
                end
                
                if pacts[pact][pet.name] then
                    if pact == 'astralflow' and not buffactive['astral flow'] then
                        windower.add_to_chat(122,'Cannot use Astral Flow pacts at this time.')
                        return
                    end
                
                    -- Leave out target; let Shortcuts auto-determine it.
                    send_command('@input /pet "'..pacts[pact][pet.name]..'"')
                else
                    windower.add_to_chat(122,pet.name..' does not have a pact of type ['..pact..'].')
                end    
            end
From where it is, and put it after  the toggle function, like so:
 Code          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] == 'exping' 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 exping then
                    exping = false
                    enable('back')
                    windower.add_to_chat(8,'----- Cape Unlocked, WILL LOSE EXP -----')
                    idle(pet)
                else
                    exping=true
                    disable('back')
                    windower.add_to_chat(8,'----- Cape Locked, WILL NOT LOSE EXP -----')
                    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 of Toggle Functions --
            -- Handles executing blood pacts in a generic, avatar-agnostic way.
            -- //gs c pact [pacttype]
            elseif commandArgs[1]:lower() == 'pact' then
                if not pet.isvalid then
                        windower.add_to_chat(122,'No avatar currently available. Returning to default macro set.')
                        set_macros(1,2)
                    return
                end
                
                if not commandArgs[2] then
                    windower.add_to_chat(123,'No pact type given.')
                    return
                end
                
                local pact = commandArgs[2]:lower()
                
                if not pacts[pact] then
                    windower.add_to_chat(123,'Unknown pact type: '..tostring(pact))
                    return
                end
                
                if pacts[pact][pet.name] then
                    if pact == 'astralflow' and not buffactive['astral flow'] then
                        windower.add_to_chat(122,'Cannot use Astral Flow pacts at this time.')
                        return
                    end
                
                    -- Leave out target; let Shortcuts auto-determine it.
                    send_command('@input /pet "'..pacts[pact][pet.name]..'"')
                else
                    windower.add_to_chat(122,pet.name..' does not have a pact of type ['..pact..'].')
                end    
            end 
            
            
                
			
			By Elizabet 2015-10-05 04:29:34			
			
						
                     
                 ^ This, Aeyela is correct. It's like that in my own lua as well, just made a mistake in my copy pasta >.<;  
Edited the post on previous page to erase the mistake from memory! You all never saw it!!                                             
                    [+]
                                              
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Hades Game: FFXI Posts: 11 
                
			
			By Hades.Ramorakomo 2015-10-05 05:54:02			
			
						
                     
                 Still not working :(((((((((((((((  Code  --[[
     Put: /console gs c pact [PactType] as your macro
      
        PactType can be one of:
            cure
            curaga
            buffOffense
            buffDefense
            buffSpecial
            debuff1
            debuff2
            sleep
            nuke2
            nuke4
            bp70
            bp75 (merits and lvl 75-80 pacts)
            bp99
            astralflow
--]]
    pacts = {}
    pacts.cure = {['Carbuncle']='Healing Ruby'}
    pacts.curaga = {['Carbuncle']='Healing Ruby II', ['Garuda']='Whispering Wind', ['Leviathan']='Spring Water'}
    pacts.buffoffense = {['Carbuncle']='Glittering Ruby', ['Ifrit']='Crimson Howl', ['Garuda']='Hastega II', ['Ramuh']='Rolling Thunder',
        ['Fenrir']='Ecliptic Growl', ['Shiva']='Crystal Blessing'}
    pacts.buffdefense = {['Carbuncle']='Shining Ruby', ['Shiva']='Frost Armor', ['Garuda']='Aerial Armor', ['Titan']='Earthen Ward',
        ['Ramuh']='Lightning Armor', ['Fenrir']='Ecliptic Howl', ['Diabolos']='Noctoshield', ['Cait Sith']='Reraise II'}
    pacts.buffspecial = {['Ifrit']=' <staff_and_grip Howl', ['Garuda']='Fleet Wind', ['Titan']='Earthen Armor', ['Diabolos']='Dream Shroud',
        ['Carbuncle']='Soothing Ruby', ['Fenrir']='Heavenward Howl', ['Cait Sith']='Raise II'}
    pacts.debuff1 = {['Shiva']='Diamond Storm', ['Ramuh']='Shock Squall', ['Leviathan']='Tidal Roar', ['Fenrir']='Lunar Cry',
        ['Diabolos']='Pavor Nocturnus', ['Cait Sith']='Eerie Eye'}
    pacts.debuff2 = {['Shiva']='Sleepga', ['Leviathan']='Slowga', ['Fenrir']='Lunar Roar', ['Diabolos']='Somnolence', ['Ramuh']='Thunderspark'}
    pacts.sleep = {['Shiva']='Sleepga', ['Diabolos']='Nightmare', ['Cait Sith']='Mewing Lullaby'}
    pacts.nuke2 = {['Ifrit']='Fire II', ['Shiva']='Blizzard II', ['Garuda']='Aero II', ['Titan']='Stone II',
        ['Ramuh']='Thunder II', ['Leviathan']='Water II'}
    pacts.nuke4 = {['Ifrit']='Fire IV', ['Shiva']='Blizzard IV', ['Garuda']='Aero IV', ['Titan']='Stone IV',
        ['Ramuh']='Thunder IV', ['Leviathan']='Water IV'}
    pacts.bp70 = {['Ifrit']='Flaming Crush', ['Shiva']='Rush', ['Garuda']='Predator Claws', ['Titan']='Mountain Buster',
        ['Ramuh']='Chaotic Strike', ['Leviathan']='Spinning Dive', ['Carbuncle']='Meteorite', ['Fenrir']='Eclipse Bite',
        ['Diabolos']='Nether Blast',['Cait Sith']='Regal Gash'}
    pacts.bp75 = {['Ifrit']='Meteor Strike', ['Shiva']='Heavenly Strike', ['Garuda']='Wind Blade', ['Titan']='Geocrush',
        ['Ramuh']='Thunderstorm', ['Leviathan']='Grand Fall', ['Carbuncle']='Holy Mist', ['Fenrir']='Lunar Bay',
        ['Diabolos']='Night Terror', ['Cait Sith']='Level ? Holy'}
    pacts.bp99 = {['Ifrit']='Conflag Strike', ['Ramuh']='Volt Strike', ['Titan']='Crag Throw', ['Fenrir']='Impact', ['Diabolos']='Blindside'}
    pacts.astralflow = {['Ifrit']='Inferno', ['Shiva']='Diamond Dust', ['Garuda']='Aerial Blast', ['Titan']='Earthen Fury',
        ['Ramuh']='Judgment Bolt', ['Leviathan']='Tidal Wave', ['Carbuncle']='Searing Light', ['Fenrir']='Howling Moon',
        ['Diabolos']='Ruinous Omen', ['Cait Sith']="Altana's Favor"}
include('global.lua') -- Just a collection of functions that I use in all my GearSwaps. See below (after this code block)
set_macros(2,3) -- 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 = {}
	-- AUGMENTED GEAR
        prep_feet = {name="Helios boots", augments={'"Avatar perpetuation cost" -4','Blood Pact Dmg.+7','Pet: Attack+22 Pet: Rng.Atk.+22',}}
	attack_feet = {name="Helios boots", augments={'Pet: Crit. hit rate +4%','Blood Pact Dmg.+6','Pet: "Mag.Atk.Bns."+22',}}
   
    -- Your idle set when you DON'T have an avatar out
    sets.me.idle = {
        main="Keraunos",
        sub="Vox Grip",
        ranged="",
        ammo="Seraphicaller",
        head="Glyphic horn +1",
        neck="Twilight torque",
        lear="handler's earring",
        rear="handler's earring +1",
        body="Shomonjijoe +1",
        hands="Serpentes cuffs",
        lring="shadow ring",
        rring="Warp ring",
        back="Convoyance cape",
        waist="Cimmerian sash",
        legs="Assiduity pants +1",
        feet="serpentes sabots"
    }
     
    -- Your MP Recovered Whilst Resting Set
    sets.me.resting = { 
       main="Keraunos",
        sub="Vox Grip",
        ranged="",
        ammo="Seraphicaller",
        head="Glyphic horn +1",
        neck="Twilight torque",
        lear="handler's earring",
        rear="handler's earring +1",
        body="Shomonjijoe +1",
        hands="Serpentes cuffs",
        lring="shadow ring",
        rring="Warp ring",
        back="Convoyance cape",
        waist="Cimmerian sash",
        legs="Assiduity pants +1",
        feet="serpentes sabots"
    }
     
    -----------------------
    -- Perpetuation Related
    -----------------------
     
    -- Avatar's Out --  
    -- This is the base for all perpetuation scenarios, as seen below
    sets.avatar.perp = {
        main="Keraunos",
        sub="Vox Grip",
        ranged="",
        ammo="Seraphicaller",
        head="Beckoner's horn +1",
        neck="caller's pendant",
        lear="handler's earring",
        rear="handler's earring +1",
        body="Shomonjijoe +1",
        hands="Glyphic bracers +1",
        lring="Thurandaut ring",
        rring="Evoker's ring",
        back="Convoyance cape",
        waist="Cimmerian sash",
        legs="Assiduity pants +1",
        feet=prep_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="vox grip",
        ranged="",
        ammo="Seraphicaller",
        head="",
        neck="caller's pendant",
        lear="",
        rear="",
        body="",
        hands="glyphic bracer's +1",
        lring="",
        rring="Evoker's ring",
        back="Convoyance cape",
        waist="Cimmerian sash",
        legs="",
        feet=""
    }
     
    -------------------------
    -- Individual Blood Pacts
    -------------------------
     
    -- Physical damage
    sets.avatar.atk = set_combine(sets.avatar.skill,{
        main="Espiritus",
        sub="Vox Grip",
        ranged="",
        ammo="Seraphicaller",
        head="Helios band",
        neck="caller's pendant",
        lear="gelos earring",
        rear="handler's earring +1",
        body="Convoker's doublet +1",
        hands="helios gloves",
        lring="thurandaut ring",
        rring="Evoker's ring",
        back="conveyance cape",
        waist="Cimmerian sash",
        legs="Helios spats",
        feet=attack_feet
    })
     
    -- Magic Attack
    sets.avatar.mab = set_combine(sets.avatar.skill,{
        main="Espiritus",
        sub="Vox Grip",
        ranged="",
        ammo="Seraphicaller",
        head="Helios band",
        neck="caller's pendant",
        lear="gelos earring",
        rear="handler's earring +1",
        body="Convoker's doublet +1",
        hands="helios gloves",
        lring="thurandaut ring",
        rring="Evoker's ring",
        back="conveyance cape",
        waist="Cimmerian sash",
        legs="Helios spats",
        feet=attack_feet
    })
 
    -- Hybrid
    sets.avatar.hybrid = set_combine(sets.avatar.skill,{
        main="Espiritus",
        sub="Vox Grip",
        ranged="",
        ammo="Seraphicaller",
        head="Helios band",
        neck="caller's pendant",
        lear="gelos earring",
        rear="handler's earring +1",
        body="Convoker's doublet +1",
        hands="helios gloves",
        lring="thurandaut ring",
        rring="Evoker's ring",
        back="conveyance cape",
        waist="Cimmerian sash",
        legs="Helios spats",
        feet=attack_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="Espirtus",
        sub="",
        ranged="",
        ammo="Seraphicaller",
        head="Glyphic horn +1",
        neck="",
        lear="Caller's earring",
        rear="",
        body="Glyphic doublet +1",
        hands="Glyphic bracers +1",
        lring="",
        rring="",
        back="Conveyance cape",
        waist="",
        legs="",
        feet="Glyphic pigaches +1"
    }
     
    -- 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="Espiritus",
        sub="Vox Grip",
        ranged="",
        ammo="Seraphicaller",
        head="Helios band",
        neck="caller's pendant",
        lear="gelos earring",
        rear="handler's earring +1",
        body="Convoker's doublet +1",
        hands="helios gloves",
        lring="thurandaut ring",
        rring="Evoker's ring",
        back="conveyance cape",
        waist="Cimmerian sash",
        legs="Helios spats",
        feet=attack_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.midcast.siphon)
         
        -- Checks if pet matches weather
        if pet.element == world.weather_element then
            equip(sets.midcast.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 and pet.isvalid then
     
        -- Avatar's favor takes priority!
        equip(sets.me.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)
    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 exping then
                    exping = false
                    enable('back')
                    windower.add_to_chat(8,'----- Cape Unlocked, WILL LOSE EXP -----')
                    idle(pet)
                else
                    exping=true
                    disable('back')
                    windower.add_to_chat(8,'----- Cape Locked, WILL NOT LOSE EXP -----')
                    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
        -- Handles executing blood pacts in a generic, avatar-agnostic way.
        -- //gs c pact [pacttype]
        elseif commandArgs[1]:lower() == 'pact' then
            if not pet.isvalid then
                    windower.add_to_chat(122,'No avatar currently available. Returning to default macro set.')
                    set_macros(1,2)
                return
            end
           
            if not commandArgs[2] then
                windower.add_to_chat(123,'No pact type given.')
                return
            end
           
            local pact = commandArgs[2]:lower()
           
            if not pacts[pact] then
                windower.add_to_chat(123,'Unknown pact type: '..tostring(pact))
                return
            end
           
            if pacts[pact][pet.name] then
                if pact == 'astralflow' and not buffactive['astral flow'] then
                    windower.add_to_chat(122,'Cannot use Astral Flow pacts at this time.')
                    return
                end
           
                -- Leave out target; let Shortcuts auto-determine it.
                send_command('@input /pet "'..pacts[pact][pet.name]..'"')
            else
                windower.add_to_chat(122,pet.name..' does not have a pact of type ['..pact..'].')
            end    
        end
    end
 
-- Required variables and their initial value
meleeing = false
autobp = false
favor = false
mode = "perp" 
            
            
                
			
			By Aeyela 2015-10-05 06:10:01			
			
						
                     
                 See this bit on lines 989 - 992? Code          end
        -- Handles executing blood pacts in a generic, avatar-agnostic way.
        -- //gs c pact [pacttype]
        elseif commandArgs[1]:lower() == 'pact' then
 You need to remove the first line: end.                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Hades Game: FFXI Posts: 11 
                
			
			By Hades.Ramorakomo 2015-10-05 06:51:34			
			
						
                     
                 I love you! If I could give you a hug I would...                                     
            
            
                
			
			By Elizabet 2015-10-05 07:00:03			
			
						
                     
                 Now that I am home... Here's my whole setup, based on Aeyela's for reference:Features: 
All the nifty things in the OP. 
Includes all the bug fixes found in the thread previously. 
Keybind and support for cycling through avatar modes with 1 key. 
Keybind for toggling autoBP 
Keybind for toggling melee weapon lock 
Avatar-agnostic Blood Pacts handling. (need the shortcuts add-on)
https://github.com/Tunaliz/Liz_Gearswaps 
                    [+]
                                              
            
            
                
			
			By Aeyela 2015-10-07 08:00:53			
			
						
                     
                 Are you using showswaps to check what's being swapped in and out? If you're just watching your equipment you won't see it equip any precasts.
 You're using an ENF reference in your precast but there's no ENF in my original post. If this is something you've added yourself make sure you're not copying something from another file that requires an include.
 
            
            
                
			
			By Aeyela 2015-10-07 08:05:07			
			
						
                     
                 no but if I rest and type a spell out like /ma "reraise" it will equip midcast and not precast I also tested the casting time and recast with the lua on and off and it was the same also sorry bout that long post I didn't know how to hide it
Put gs showswaps  into the console and cast a few spells and see if your log tells you precast is being equipped. You won't notice it being equipped watching equipment for any spells.                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Bismarck Game: FFXI Posts: 1 
                
			
			By Bismarck.Mithriditus 2015-10-09 19:33:02			
			
						
                     
                 Aeyela,
 Thank you so much for this. I have been working to use Gearswap for the last few weeks to no avail. The lua most use was a bit overwhelming as I do not write code. Even not knowing the code I was able to understand your blank and explanations in your lua blank. I input my gear and presto! I am a gearswap user.
 
 I LOVE playing Summoner. I have been playing FFXI off and on due to RL since day 3 of NA launch and only started playing SMN in last few months. But it was a bit intimidating everyone running around end game, done with missions, having large LS to group up and do gear farming. This is the first thing to make me feel like ***is getting accomplished. Now that this is done I can begin to farm Job Points and better equipment! THANKS!!!
 
            
            
                
			
			By Zubis 2015-10-09 21:06:05			
			
						
                     
                 Aeyela, Elizabet, I recommend you put your file on Github so you can easily update it and people can see when it updates.                                     
            
            
                
			
			By Elizabet 2015-10-09 22:58:08			
			
						
                     
                 https://github.com/Tunaliz/Liz_GearswapsAeyela, Elizabet, I recommend you put your file on Github so you can easily update it and people can see when it updates.
Done.
 
Also fixed a few bugs:
 
* Properly returning to idle set after resting 
* midcast casting sets correctly working. 
* Siphon set now correctly working                                     
            
            
                
			
			By Cleric 2015-10-14 09:09:35			
			
						
                     
                 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.midcast.siphon)
		
		-- Checks if pet matches weather
        if pet.element == world.weather_element then
            equip(sets.midcast.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)
    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.
This gearswap's siphon build doesn't work.  I haven't checked yet, but in the lower part of the lua, it equips sets.midcast.siphon, and in the upper part, the gearset is sets.precast.siphon.
 
Also, when going from resting to non-resting, equipment doesn't change                                     
            
            
                
			
			By Aeyela 2015-10-14 09:15:06			
			
						
                     
                 This gearswap's siphon build doesn't work.  I haven't checked yet, but in the lower part of the lua, it equips sets.midcast.siphon, and in the upper part, the gearset is sets.precast.siphon.
Good spot. That was fixed when somebody initially pointed out, must've re-copied from an older copy with a later change. Fixed.
 Also, when going from resting to non-resting, equipment doesn't change
That's because there's nothing in status change to change equipment. An oversight on my part as I don't rest very often, if at all, on Summoner. You can add this easily enough by changing the status change function to this:
 Code  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
I've updated the OP with those changes, cheers.                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Siren Game: FFXI Posts: 228 
                
			
			By Siren.Noxzema 2015-10-14 22:54:38			
			
						
                     
                 Here's a couple more functions (can't remember where I got em, was on one of my older smn luas, so credit where it's due) 
Looks at the moon %, and tells you the effects of affected wards
 
Under your idle(pet) line in function pet_aftercast (spell)
 Code  -- Add to Chat rules for buffs with variable values.
		if (spell.english=="Ecliptic Howl") then
                if (world.moon_pct>89) then
                        add_to_chat(104,"[Ecliptic Howl] Accuracy 25 - Evasion 1")
                elseif (world.moon_pct>74) then
                        add_to_chat(104,"[Ecliptic Howl] Accuracy 21 - Evasion 5")
                elseif (world.moon_pct>59) then
                        add_to_chat(104,"[Ecliptic Howl] Accuracy 17 - Evasion 9")
                elseif (world.moon_pct>39) then
                        add_to_chat(104,"[Ecliptic Howl] Accuracy 13 - Evasion 13")
                elseif (world.moon_pct>24) then
                        add_to_chat(104,"[Ecliptic Howl] Accuracy 9 - Evasion 17")
                elseif (world.moon_pct>9) then
                        add_to_chat(104,"[Ecliptic Howl] Accuracy 5 - Evasion 21")
                else
                        add_to_chat(104,"[Ecliptic Howl] Accuracy 1 - Evasion 25")
                end
        elseif (spell.english=="Ecliptic Growl") then
                if (world.moon_pct>89) then
                        add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 7 - INT/MND/CHR/AGI 1")
                elseif (world.moon_pct>74) then
                        add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 6 - INT/MND/CHR/AGI 2")
                elseif (world.moon_pct>59) then
                        add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 5 - INT/MND/CHR/AGI 3")
                elseif (world.moon_pct>39) then
                        add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 4 - INT/MND/CHR/AGI 4")
                elseif (world.moon_pct>24) then
                        add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 3 - INT/MND/CHR/AGI 5")
                elseif (world.moon_pct>9) then
                        add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 2 - INT/MND/CHR/AGI 6")
                else
                        add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 1 - INT/MND/CHR/AGI 7")
                end
        elseif (spell.english=="Lunar Cry") then
                if (world.moon_pct>89) then
                        add_to_chat(104,"[Lunar Cry] Enemy Acc Down 31 - Enemy Eva Down 1")
                elseif (world.moon_pct>74) then
                        add_to_chat(104,"[Lunar Cry] Enemy Acc Down 26 - Enemy Eva Down 6")
                elseif (world.moon_pct>59) then
                        add_to_chat(104,"[Lunar Cry] Enemy Acc Down 21 - Enemy Eva Down 11")
                elseif (world.moon_pct>39) then
                        add_to_chat(104,"[Lunar Cry] Enemy Acc Down 16 - Enemy Eva Down 16")
                elseif (world.moon_pct>24) then
                        add_to_chat(104,"[Lunar Cry] Enemy Acc Down 11 - Enemy Eva Down 21")
                elseif (world.moon_pct>9) then
                        add_to_chat(104,"[Lunar Cry] Enemy Acc Down 6 - Enemy Eva Down 26")
                else
                        add_to_chat(104,"[Lunar Cry] Enemy Acc Down 1 - Enemy Eva Down 31")
                end
        elseif (spell.english=="Heavenward Howl") then
                if (world.moon_pct>89) then
                        add_to_chat(104,"[Heavenward Howl] Moon Phase Full moon - Endrain 15%")
                elseif (world.moon_pct>73) then
                        add_to_chat(104,"[Heavenward Howl] Moon phase 74~90% {Endrain 12%")
                elseif (world.moon_pct>56) then
                        add_to_chat(104,"[Heavenward Howl] Moon phase 57~73% {Endrain 8%}")
                elseif (world.moon_pct>39) then
                        add_to_chat(104,"[Heavenward Howl] Moon phase 40~56% {First Quarter Moon - Endrain 5% | Last Quarter - moon Enaspir 1%}" )
                elseif (world.moon_pct>24) then
                        add_to_chat(104,"[Heavenward Howl] Moon phase 25~39% {Enaspir 2%}")
                elseif (world.moon_pct>9) then
                        add_to_chat(104,"[Heavenward Howl] Moon phase 10~24% {Enaspir 4%}")
                else
                        add_to_chat(104,"[Heavenward Howl] Moon Phase New Moon - Enaspir 5%")
        end		
		elseif (spell.english=="Dream Shroud") then
                if (world.time >= 0 and world.time < 1*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 13 - MDB 1")
                elseif (world.time >= 1*60 and world.time < 2*60) or (world.time >= 23*60 and world.time <= 23*60+59) then
                        add_to_chat(104,"[Dream Shroud] MAB 12 - MDB 2")
                elseif (world.time >= 2*60 and world.time < 3*60) or (world.time >= 22*60 and world.time < 23*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 11 - MDB 3")
                elseif (world.time >= 3*60 and world.time < 4*60) or (world.time >= 21*60 and world.time < 22*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 10 - MDB 4")
                elseif (world.time >= 4*60 and world.time < 5*60) or (world.time >= 20*60 and world.time < 21*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 9 - MDB 5")
                elseif (world.time >= 5*60 and world.time < 6*60) or (world.time >= 19*60 and world.time < 20*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 8 - MDB 6")
                elseif (world.time >= 6*60 and world.time < 7*60) or (world.time >= 18*60 and world.time < 19*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 7 - MDB 7")
                elseif (world.time >= 7*60 and world.time < 8*60) or (world.time >= 17*60 and world.time < 18*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 6 - MDB 8")
                elseif (world.time >= 8*60 and world.time < 9*60) or (world.time >= 16*60 and world.time < 17*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 5 - MDB 9")
                elseif (world.time >= 9*60 and world.time < 10*60) or (world.time >= 15*60 and world.time < 16*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 4 - MDB 10")
                elseif (world.time >= 10*60 and world.time < 11*60) or (world.time >= 14*60 and world.time < 15*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 3 - MDB 11")
                elseif (world.time >= 11*60 and world.time < 12*60) or (world.time >= 13*60 and world.time < 14*60) then
                        add_to_chat(104,"[Dream Shroud] MAB 2 - MDB 12")
                else
                        add_to_chat(104,"[Dream Shroud] MAB 1 - MDB 13")
        end
	end
Then this one is smaller, and will equip your Sacrifice Torque whenever you get slept:
 Code   function job_buff_change(buff, gain)
    if state.Buff[buff] ~= nil then
        handle_equipping_gear(player.status)
    elseif storms:contains(buff) then
        handle_equipping_gear(player.status)
    end
	if buff == 'sleep' and pet.isvalid then
        if gain then
            equip({neck="Sacrifice Torque"})
            disable('neck')
        else
            enable('neck')
            handle_equipping_gear(player.status)
		end
	end
end
Also one more thing, personally I like having 2 Favor sets, one with 512 + Beck. Horn with pet PDT/Refresh/Perp etc gear, and one with 575 + horn. 
This makes a new avatar mode for the 512 set, then the actual Favor toggle puts on my max Favor set.
 
So I made a new set with sets.avatar.favor.max, and changed the function to  Code      if favor then
     
        -- Avatar's favor takes priority!
        equip(sets.avatar.favor.max)
 and added  Code  			   mode = 'favor'
			   savedMode = 'favor'
			elseif savedMode == 'favor' then
 between the elseif savedMode == 'acc' then, and mode = 'perp'.                                             
                    [+]
                                              
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Siren Game: FFXI Posts: 228 
                
			
			By Siren.Noxzema 2015-10-18 11:47:00			
			
						
                     
                 I just downloaded the Github version, and I noticed you have Code  pacts.buffspecial = {['Ifrit']=' <staff_and_grip Howl',
I haven't done any testing yet, so maybe it still works for some reason, it just caught my eye.                                     
            
            
                
			
			By Elizabet 2015-10-18 13:33:23			
			
						
                     
                 Yeah, that's supposed to be inferno howl. Gonna fix that! Fortunately, it'll only make the gs function return nothing for buff special for ifrit (which should be inferno howl)
 Thanks!
 
 EdiT: Github updated.
 
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Bahamut Game: FFXI Posts: 879 
                
			
			By Bahamut.Seekerstar 2015-10-18 13:36:53			
			
						
                     
                 Does anyone know what I'd have to do in order to add custom timers to this?
 Also,that sacrifice torque one is gold.
 
            
                
                     Ragnarok.Bepe
                                                    
                                                                            
                                Server: Ragnarok Game: FFXI Posts: 202 
                
			
			By Ragnarok.Bepe 2015-10-20 16:51:08			
			
						
                     
                 Took me a little bit to figure out what was going on, but your set_combine are not working correctly. At least on the version i copied and pasted from the git. You can brute force it by putting the full gear set in each method that as set_combine which is what i ended up doing. Something must be slightly off with the syntax because it is not merging the 2 sets used as arguements and only using the set that is type in said method. If you want to test this, turn on gs showswaps and take everything out of sets.precast.stoneskin and sets.precast.enhancing. Now put an item in sets.precast.enhancing and cast stoneskin, the item will not swap. Now if you move said item to sets.precast.stoneskin it will swap. However sets.precast.stoneskin combines with set.precast.enhancing so it should swap either way. Is anyone else having said error?                                     
            
                
                     Quetzalcoatl.Frodnon
                                                    
                                                                            
                                Server: Quetzalcoatl Game: FFXI Posts: 31 
                
			
			By Quetzalcoatl.Frodnon 2015-10-20 18:41:44			
			
						
                     
                 About the only thing I'd add at this point is a way to block Sacrifice torque if you're weakened or below a threshold of HP. Already more than once I've killed myself because i was weakened and putting on apogee puts me at 1 HP and sac torque immediately kills me.                                     
            
                
                     Ragnarok.Orlind
                                                    
                                                                            
                                Server: Ragnarok Game: FFXI Posts: 303 
                
			
			By Ragnarok.Orlind 2015-10-20 18:53:21			
			
						
                     
                 Ignore me if I'm out of line but can we still call the resulting lua a "barebones" file anymore? =D 
 I mean besides the fact that spaces are being left for people to easily add their gear...
 
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Siren Game: FFXI Posts: 228 
                
			
			By Siren.Noxzema 2015-10-20 20:45:32			
			
						
                     
                 Quetzalcoatl.Frodnon said: »About the only thing I'd add at this point is a way to block Sacrifice torque if you're weakened or below a threshold of HP. Already more than once I've killed myself because i was weakened and putting on apogee puts me at 1 HP and sac torque immediately kills me.
Didn't even think about being back to 1 HP weakness again lol, not 100% sure but I think this would work? Not sure what would be the easiest way to test it, prob Diorama/Ballista?
 Code  
function job_buff_change(buff, gain)
    if state.Buff[buff] ~= nil then
        handle_equipping_gear(player.status)
    elseif storms:contains(buff) then
        handle_equipping_gear(player.status)
    end
    if buff == 'sleep' and player.hp > 250 and pet.isvalid then
        if gain then
            equip({neck="Sacrifice Torque"})
            disable('neck')
        else
            enable('neck')
            handle_equipping_gear(player.status)
        end
    end
end 
            
            
                
			
			By Elizabet 2015-10-21 05:00:09			
			
						
                     
                 Took me a little bit to figure out what was going on, but your set_combine are not working correctly. At least on the version i copied and pasted from the git. You can brute force it by putting the full gear set in each method that as set_combine which is what i ended up doing. Something must be slightly off with the syntax because it is not merging the 2 sets used as arguements and only using the set that is type in said method. If you want to test this, turn on gs showswaps and take everything out of sets.precast.stoneskin and sets.precast.enhancing. Now put an item in sets.precast.enhancing and cast stoneskin, the item will not swap. Now if you move said item to sets.precast.stoneskin it will swap. However sets.precast.stoneskin combines with set.precast.enhancing so it should swap either way. Is anyone else having said error?
When you type in chat this: //gs equip sets.precast.stoneskin 
 
Do you end up with the correct set? I'm not getting your error, mine combines correctly.
 
Did you forget a ")" after the set? The syntax is : Code  
yourset2 = set_combine(yourset1,{your gear})
 
            
                
                     Ragnarok.Bepe
                                                    
                                                                            
                                Server: Ragnarok Game: FFXI Posts: 202 
                
			
			By Ragnarok.Bepe 2015-10-21 18:48:10			
			
						
                     
                 Nothing appears if the items are in the combined set and not the original set actually being called from the SMN.lua file. I'm pretty sure the syntax is right as I was looking at that thoroughly since i thought that might be the error. Perhaps I need to include a ilbrary for set_combine to work? I won't be on the game tonight so I can't do //gs equip.                                     
            
                
                     Sylph.Mozhat
                                                    
                                                                            
                                Server: Sylph Game: FFXI Posts: 58 
                
			
			By Sylph.Mozhat 2015-10-23 10:19:29			
			
						
                     
                 Quetzalcoatl.Frodnon said: »About the only thing I'd add at this point is a way to block Sacrifice torque if you're weakened or below a threshold of HP. Already more than once I've killed myself because i was weakened and putting on apogee puts me at 1 HP and sac torque immediately kills me.
Didn't even think about being back to 1 HP weakness again lol, not 100% sure but I think this would work? Not sure what would be the easiest way to test it, prob Diorama/Ballista?
 Code  
function job_buff_change(buff, gain)
    if state.Buff[buff] ~= nil then
        handle_equipping_gear(player.status)
    elseif storms:contains(buff) then
        handle_equipping_gear(player.status)
    end
    if buff == 'sleep' and player.hp > 250 and pet.isvalid then
        if gain then
            equip({neck="Sacrifice Torque"})
            disable('neck')
        else
            enable('neck')
            handle_equipping_gear(player.status)
        end
    end
endWhere would you put this at on the lua script? 
There is no function job_buff_change(buff, gain) on SMN_Lua.
 
I for one love this command. So many times it has helped me to wake up and heal who ever needs it.
 
I'm still using Kinematics lua atm. Checking all options out.                                     
            
                
                    
                    
                    
                                                            
                                                    
                                                                            
                                Server: Siren Game: FFXI Posts: 228 
                
			
			By Siren.Noxzema 2015-10-23 18:32:27			
			
						
                     
                 I'm not sure if it matters too much, but I have it right before the function self_command(command) line.
 Edit: Actually now I'm not 100% sure that it's working, and I can't reserve the Isle until 10 PST because of the official matches that no one does... I'll test as soon as I can, unless someone beats me to it.
 
 Edit #2: Well it does work, guess something happened earlier to take priority that made me think otherwise. But I found out that the "player.hp > 200" doesn't...
 
            
                
                     Asura.Keja
                                                    
                                                                            
                                Server: Asura Game: FFXI Posts: 50 
                
			
			By Asura.Keja 2015-11-02 22:57:53			
			
						
                     
                 Hello,
 Question for you all! Is there a way to check avatar's TP before firing off a BP?  The reason why I ask is... Enticer's Pants vs Apogee Pants path A for magical BPs.. I've found that, since I've fully merited Shiva's BP, she's typically at/over TP bonus cap and I'm still BPing in Enticer's, where Apogee A would surely do more damage.
 
 Also, what would the snippet be for Asteria Mitts +1 on Carbuncle's blood pacts?
 
    
    
        
        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. |  |