Gearswap Support Thread

Langues: JP EN DE FR
users online
Forum » Windower » Support » Gearswap Support Thread
Gearswap Support Thread
First Page 2 3 ... 155 156 157 ... 183 184 185
 Phoenix.Logical
Offline
Serveur: Phoenix
Game: FFXI
Posts: 519
By Phoenix.Logical 2019-12-26 14:56:52
Link | Citer | R
 
Bismarck.Xurion said: »
Apologies, I misunderstood. If you want to avoid motes due to it's default functionality, you'd have to use the Gearswap self_command function. There are numerous ways you can use this, but I'll stick to a simple solution of changing a variable in a higher scope:
Code
tp_mode = 'normal' --higher scope var

function self_command(command)
  tp_mode = command
end


You'd also need to have a number of sets defined:
Code
sets.engaged = {...}
sets.engaged.dw40 = {...}


Calling (or more likely key binding) the following will trigger the self_command with 'dw40' as the command arg:
Code
//gs c dw40


Finally you'll need to configure/extend your pre/mid/aftercast functions to handle decisions:
Code
function aftercast(spell, act, spellMap, eventArgs)
  local set
  if player.status == 'Engaged' then
    set = sets.engaged
  end
  if set[tp_mode] then
    set = set[tp_mode]
  end
  equip(set)


Disclaimer: not tested.

THANK YOU!!! That is exactly what I was looking for. Going to adapt this to my scripts and see how it goes. Very much appreciate your help!
[+]
Offline
Posts: 1449
By fillerbunny9 2019-12-26 22:37:38
Link | Citer | R
 
would there be an easy way to program in canceling existing Utsusemi shadows on precast when going from Ni > Ichi?

edit: nevermind, I found exactly what I was looking for in another thread
 Asura.Kurdtray
Offline
Serveur: Asura
Game: FFXI
user: Kurdtray
Posts: 22
By Asura.Kurdtray 2019-12-27 15:54:58
Link | Citer | R
 
I have a question. I'm wanting to setup a keybind command to switch between autotarget. Basically I want to press ctrl or alt a and it to turn on or off autotarget for me. Although I have learned a lot about gearswap, this still eludes me. Any suggestions? Thanks
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2019-12-27 16:31:04
Link | Citer | R
 
Asura.Kurdtray said: »
I have a question. I'm wanting to setup a keybind command to switch between autotarget. Basically I want to press ctrl or alt a and it to turn on or off autotarget for me. Although I have learned a lot about gearswap, this still eludes me. Any suggestions? Thanks
Because there's no toggle (you have to explicitly say on or off) you can make use of the Gearswap self_command function that would use a variable to track on/off:
Code
windower.send_command('bind ^a gs c auto target');
auto_target = true

function self_command(command)
  if command == 'auto target' then
    if auto_target then
      windower.send_command('input /autotarget off')
      auto_target = false
    else
      windower.send_command('input /autotarget on')
      auto_target = true
    end
  end
end
 Asura.Kurdtray
Offline
Serveur: Asura
Game: FFXI
user: Kurdtray
Posts: 22
By Asura.Kurdtray 2019-12-27 20:08:02
Link | Citer | R
 
I put this into my lua and at first it didn't work so i moved it around until i got it to work. However once i got it to work it shutdown all other functions. So i need to know where to put this.
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2019-12-28 14:19:31
Link | Citer | R
 
Can you post your existing lua?
 Phoenix.Logical
Offline
Serveur: Phoenix
Game: FFXI
Posts: 519
By Phoenix.Logical 2019-12-28 15:03:36
Link | Citer | R
 
Phoenix.Logical said: »
Bismarck.Xurion said: »
Apologies, I misunderstood. If you want to avoid motes due to it's default functionality, you'd have to use the Gearswap self_command function. There are numerous ways you can use this, but I'll stick to a simple solution of changing a variable in a higher scope:
Code
tp_mode = 'normal' --higher scope var

function self_command(command)
  tp_mode = command
end


You'd also need to have a number of sets defined:
Code
sets.engaged = {...}
sets.engaged.dw40 = {...}


Calling (or more likely key binding) the following will trigger the self_command with 'dw40' as the command arg:
Code
//gs c dw40


Finally you'll need to configure/extend your pre/mid/aftercast functions to handle decisions:
Code
function aftercast(spell, act, spellMap, eventArgs)
  local set
  if player.status == 'Engaged' then
    set = sets.engaged
  end
  if set[tp_mode] then
    set = set[tp_mode]
  end
  equip(set)


Disclaimer: not tested.

THANK YOU!!! That is exactly what I was looking for. Going to adapt this to my scripts and see how it goes. Very much appreciate your help!

Thanks so much for your help with this, with some minor modifications and fixes I've gotten it to work and it works great. Thanks so much!

I now have another thing that I would like to do if possible that is very similar to this. I'd like to have a separate command for mb_mode that triggers whether or not to use my mb gear set. The way I'm seeing this right now I believe that the command that is being sent (//gs c dw40) is being picked up by that tp_mode section and therefore if I just duplicated this section and called it "mb_mode" it wouldn't work. Is there a way to setup a MB mode section that would work? Ie... I would be able to enter //gs c tp_mode/dw40 to set tp mode and //gs c mb_mode/mb to set mb mode. Is something like this possible? Much appreciate your help!
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2019-12-28 16:20:51
Link | Citer | R
 
The self_command function receives a single argument of anything you type after the //gs c. With this you can split the string:
Code
tp_mode = 'normal'
mb_mode = 'normal'
 
function self_command(command)
  local args = split_args(command)
  if args[1] == 'tp' then
    tp_mode = args[2]
  elseif args[1] == 'mb' then
    mb_mode = args[2]
  end
end

function split_args(args)
  fields = {}
  args:gsub("([^ ]*) ?", function(c)
   table.insert(fields, c)
  end)
  return fields
end


Then you can use:
Code
//gs c tp dw40
//gs c mb burst


Note that I went with spaces between commands/args instead of slashes, as this is the most common pattern.
 Asura.Kurdtray
Offline
Serveur: Asura
Game: FFXI
user: Kurdtray
Posts: 22
By Asura.Kurdtray 2019-12-28 18:39:51
Link | Citer | R
 
Here is my current lua.
Code
-------------------------------------------------------------------------------------------------------------------
--  Keybinds
-------------------------------------------------------------------------------------------------------------------

--  Modes:      [ F9 ]              Cycle Offense Modes
--              [ CTRL+F9 ]         Cycle Hybrid Modes
--              [ WIN+F9 ]          Cycle Weapon Skill Modes
--              [ F10 ]             Emergency -PDT Mode
--              [ CTRL+F10 ]		Cycle PDT/Reraise
--              [ ALT+F10 ]         Toggle Kiting Mode
--              [ F11 ]             Emergency -MDT Mode
--              [ F12 ]             Update Current Gear / Report Current Status
--              [ CTRL+F12 ]        Cycle Idle Modes
--              [ ALT+F12 ]         Cancel Emergency -PDT/-MDT Mode
--              [ ALT+C ]           Toggle Capacity Points Mode
--
--
--				[ CTRL+numpad7 ]    Tachi: Fudo
--				[ CTRL+numpad8 ]    Tachi: Shoha
--				[ CTRL+numpad4 ]    Tachi: Rana
--				[ CTRL+numpad1 ]    Namas Arrow
--				[ CTRL+numpad2 ]    Apex Arrow
--
--				[ CTRL+numpad/ ]    Berserk
--				[ CTRL+numpad* ]    Warcry
--				[ CTRL+numpad- ]    Aggressor
--				[ CTRL+numpad0 ]    Meditate
--
--              (Global-Binds.lua contains additional non-job-related keybinds)

-------------------------------------------------------------------------------------------------------------------
-- Initialization function that defines sets and variables to be used.
-------------------------------------------------------------------------------------------------------------------
--Ionis Zones
--Anahera Blade (4 hit): 52
--Tsurumaru (4 hit): 49
--Kogarasumaru (or generic 450 G.katana) (5 hit): 40
--Amanomurakumo/Masamune 437 (5 hit): 46
--
--Non Ionis Zones:
--Anahera Blade (4 hit): 52
--Tsurumaru (5 hit): 24
--Kogarasumaru (5 hit): 40
--Amanomurakumo/Masamune 437 (5 hit): 46
--
--Aftermath sets
-- Koga AM1/AM2 = sets.engaged.Kogarasumaru.AM
-- Koga AM3 = sets.engaged.Kogarasumaru.AM3
-- Amano AM = sets.engaged.Amanomurakumo.AM
-- Using Namas Arrow while using Amano will cancel STPAM set

-- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.

-- Initialization function for this job file.
function get_sets()
	-- Load and initialize the include file.
    mote_include_version = 2
	include('Mote-Include.lua')
	include('organizer-lib')
end


-- Setup vars that are user-independent.
function job_setup()
    get_combat_form()
    --get_combat_weapon()
    update_melee_groups()
    
    state.CapacityMode = M(false, 'Capacity Point Mantle')

    state.YoichiAM = M(false, 'Cancel Yoichi AM Mode')
    -- list of weaponskills that make better use of otomi helm in low acc situations
    wsList = S{'Tachi: Fudo', 'Tachi: Shoha'}

    gear.RAarrow = {name="Yoichi's Arrow"}
   

    state.Buff.Sekkanoki = buffactive.sekkanoki or false
    state.Buff.Sengikori = buffactive.sengikori or false
    state.Buff['Third Eye'] = buffactive['Third Eye'] or false
	state.Buff['Seigan'] = buffactive['Seigan'] or false
    state.Buff['Meikyo Shisui'] = buffactive['Meikyo Shisui'] or false
	
	--Lockstyle
    lockstyleset = 9
end


-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
function user_setup()
    -- Options: Override default values
    state.OffenseMode:options('Normal', 'Low', 'Mid', 'Acc', 'Crit')
    state.RangedMode:options('Normal', 'Yoichi')
	state.HybridMode:options('Normal', 'PDT', 'Reraise')
    state.WeaponskillMode:options('Normal', 'Mid', 'Acc')
    state.IdleMode:options('Normal', 'Craft')
    state.RestingMode:options('Normal')
    state.PhysicalDefenseMode:options('PDT', 'Reraise')
    state.MagicalDefenseMode:options('MDT')
    
    -- Additional local binds
    send_command('bind ^[ input /lockstyle on')
    send_command('bind ![ input /lockstyle off')
    send_command('bind !c gs c toggle CapacityMode')
	
	if player.sub_job == 'WAR' then
        send_command('bind ^numpad/ input /ja "Berserk" <me>')
        send_command('bind ^numpad* input /ja "Warcry" <me>')
        send_command('bind ^numpad- input /ja "Aggressor" <me>')
    end
	
	send_command('bind ^numpad7 input /ws "Tachi: Fudo" <t>')
    send_command('bind ^numpad8 input /ws "Tachi: Shoha" <t>')
    send_command('bind ^numpad4 input /ws "Tachi: Rana" <t>')
    send_command('bind ^numpad1 input /ws "Namas Arrow" <t>')
    send_command('bind ^numpad2 input /ws "Apex Arrow" <t>')

    send_command('bind ^numpad0 input /ja "Meditate" <me>')
    
    select_default_macro_book()
	set_lockstyle()
end



-- Called when this job file is unloaded (eg: job change)
function file_unload()
    send_command('unbind ^[')
    send_command('unbind !c')
    send_command('unbind ![')
	
	send_command('unbind ^numpad/')
    send_command('unbind ^numpad*')
    send_command('unbind ^numpad-')
    send_command('unbind ^numpad7')
    send_command('unbind ^numpad8')
    send_command('unbind ^numpad5')
    send_command('unbind ^numpad1')
    send_command('unbind ^numpad2')
    send_command('unbind ^numpad0')
    send_command('unbind ^numpad.')
end

--[[
-- SC's
Rana > Shoha > Fudo > Kasha > Shoha > Fudo - light
Rana > Shoha > Fudo > Kasha > Rana > Fudo - dark
Kasha > Shoha > Fudo
Fudo > Kasha > Shoha > fudo
Shoha > Fudo > Kasha > Shoha > Fudo
--]]
function init_gear_sets()
    --------------------------------------
    -- Start defining the sets
    --------------------------------------
	--gear.Valo_WSD_head
	--gear.Valo_WSD_hands
	--gear.Valo_WSD_feet
    
    --Smertrios
    --Smertrios.TP
    --Smertrios.WS
	--Smertrios.RA
	
    -- Precast Sets
    -- Precast sets to enhance JAs
    sets.precast.JA.Meditate = {
        head="Wakido Kabuto +3",
        hands="Sakonji kote +3",
        back=Smertrios.WS
    }
    sets.precast.JA.Seigan = {head="Sakonji Haidate +2"}
    sets.precast.JA['Warding Circle'] = {head="Wakido Kabuto +3"}
    sets.precast.JA['Third Eye'] = {legs="Sakonji Haidate +2"}
    --sets.precast.JA['Blade Bash'] = {hands="Sakonji Kote +3"}
   
    sets.precast.FC = {
        right_ear="Etiolation Earring",
        left_ear="Loquacious Earring",
        hands="Leyline Gloves",
        ring1="Prolix Ring",
        ring2="Weatherspoon Ring"
    }
    -- Waltz set (chr and vit)
    sets.precast.Waltz = {}

    sets.Organizer = {
        sub="Utu Grip",
        range="Yoichinoyumi",
        ammo=gear.RAarrow,
        back=Smertrios.RA
    }
    sets.precast.RA = {
		ammo=gear.RAarrow,
		head="Sakonji Kabuto +3",
		body="Acro Surcoat",
        hands="Acro Gauntlets",
        legs="Acro Breeches",
		feet="Acro Leggings",
		back=Smertrios.RA
	}
    sets.midcast.RA = {
        head="Sakonji Kabuto +3",
        body="Kendatsuba Samue",
        legs="Kendatsuba Hakama",
        neck="Sanctity Necklace",
        hands="Kendatsuba Tekko",
        waist="Eschan Stone",
        left_ear="Enervating Earring",
        right_ear="Telos Earring",
        ring1="Hajduk Ring",
        ring2="Longshot Ring",
        feet="Wakido Sune-ate +3",
		back=Smertrios.RA
    }	
    -- Don't need any special gear for Healing Waltz.
    sets.precast.Waltz['Healing Waltz'] = {}
    
    sets.CapacityMantle  = { back="Mecistopins Mantle" }
    --sets.Berserker       = { neck="Berserker's Torque" }
    sets.WSDayBonus      = { head="Gavialis Helm" }
    sets.BrutalMoonshade = { right_ear="Moonshade Earring", left_ear="Brutal Earring" }
    sets.LugraFlame      = { right_ear="Lugra Earring +1", left_ear="Flame Pearl" }
    sets.FlameFlame      = { right_ear="Flame Pearl", left_ear="Flame Pearl" }
       
    -- Weaponskill sets
    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS = {
		ammo="Knobkierrie",
        head=gear.Valo_WSD_head,
		body="Sakonji Domaru +3", augments={'Enhances "Overwhelm" effect',},
		hands="Valorous Mitts",
		legs="Wakido Haidate +3",
		feet=gear.Valo_WSD_feet,
		neck="Samurai's Nodowa +1",
		waist="Fotia Belt",
		right_ear={name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
		left_ear="Thrud Earring",
		left_ring="Karieyh Ring",
		right_ring="Regal Ring",
		back=Smertrios.WS
    }
    sets.precast.WS.Mid = set_combine(sets.precast.WS, {left_ear="Telos Earring",})
    sets.precast.WS.Acc = set_combine(sets.precast.WS.Mid, {})
    
    sets.precast.WS['Namas Arrow'] = {
        ammo=gear.RAarrow,
		head="Sakonji Kabuto +3",
        body="Sakonji Domaru +3", augments={'Enhances "Overwhelm" effect',},
        legs="Wakido Haidate +3",
        neck="Fotia Gorget",
        hands="Kendatsuba Tekko",
        waist="Fotia Belt",
        right_ear="Enervating Earring",
        left_ear="Telos Earring",
        ring1="Karieyh Ring",
        ring2="Regal Ring",
        feet="Wakido Sune-ate +3"
    }
    sets.precast.WS['Namas Arrow'].Mid = set_combine(sets.precast.WS['Namas Arrow'], {legs="Kendatsuba Hakama", "Kendatsuba Samue"})
    sets.precast.WS['Namas Arrow'].Acc = set_combine(sets.precast.WS['Namas Arrow'].Mid, {ring1="Hajduk Ring"})
    
    sets.precast.WS['Apex Arrow'] = set_combine(sets.precast.WS['Namas Arrow'], {})
    sets.precast.WS['Apex Arrow'].Mid = set_combine(sets.precast.WS['Apex Arrow'], {legs="Kendatsuba Hakama", "Kendatsuba Samue"})
    sets.precast.WS['Apex Arrow'].Acc = set_combine(sets.precast.WS['Apex Arrow'].Mid, {ring1="Hajduk Ring"})
	
	sets.precast.WS['Sidewinder'] = set_combine(sets.precast.WS['Namas Arrow'], {})
    sets.precast.WS['Sidewinder'].Mid = sets.precast.WS['Apex Arrow']
    sets.precast.WS['Sidewinder'].Acc = set_combine(sets.precast.WS['Apex Arrow'], {})
    
    sets.precast.WS['Tachi: Fudo'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Tachi: Fudo'].Mid = set_combine(sets.precast.WS['Tachi: Fudo'], {
        head="Flam. Zucchetto +2",
		hands="Wakido Kote +3",
		left_ear="Telos Earring",
		})
    sets.precast.WS['Tachi: Fudo'].Acc = set_combine(sets.precast.WS['Tachi: Fudo'].Mid, {
        head="Flam. Zucchetto +2",
		body="Wakido Domaru +3",
		hands="Wakido Kote +3",
		})
	
    sets.precast.WS['Impulse Drive'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Impulse Drive'].Mid = set_combine(sets.precast.WS['Impulse Drive'], {})
    sets.precast.WS['Impulse Drive'].Acc = set_combine(sets.precast.WS['Impulse Drive'].Mid, {})
    
    sets.precast.WS['Tachi: Shoha'] = set_combine(sets.precast.WS, {
		head="Flamma Zucchetto +2",
		feet="Flamma Gambieras +2",
		})
    sets.precast.WS['Tachi: Shoha'].Mid = set_combine(sets.precast.WS['Tachi: Shoha'], {
		hands="Wakido Kote +3",
		left_ear="Telos Earring",
		})
    sets.precast.WS['Tachi: Shoha'].Acc = set_combine(sets.precast.WS['Tachi: Shoha'].Mid, {body="Wakido Domaru +3",})

    sets.precast.WS['Stardiver'] = set_combine(sets.precast.WS['Tachi: Shoha'], {
        head="Flam. Zucchetto +2",
		body="Sakonji Domaru +3", augments={'Enhances "Overwhelm" effect',},
		hands="Wakido Kote +3",
		legs="Wakido Haidate +3",
		feet=gear.Valo_WSD_feet,
		neck="Samurai's Nodowa +1",
		waist="Fotia Belt",
		right_ear={name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
		left_ear="Thrud Earring",
		left_ring="Karieyh Ring",
		right_ring="Flamma Ring",
		back=Smertrios.WS
    })
    sets.precast.WS['Stardiver'].Mid = set_combine(sets.precast.WS['Stardiver'], {})
    sets.precast.WS['Stardiver'].Acc = set_combine(sets.precast.WS['Stardiver'].Mid, {})
    
    sets.precast.WS['Tachi: Rana'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Tachi: Rana'].Mid = set_combine(sets.precast.WS['Tachi: Rana'], {})
    sets.precast.WS['Tachi: Rana'].Acc = set_combine(sets.precast.WS.Acc, {})
    -- CHR Mod
    sets.precast.WS['Tachi: Ageha'] = set_combine(sets.precast.WS, {})
	
    sets.precast.WS['Tachi: Jinpu'] = set_combine(sets.precast.WS, {
		neck="Fotia Gorget",
		body="Founder's Breastplate",
		hands="Founder's Gauntlets",
		feet="Founder's Greaves",
		left_ear="Friomisi Earring",
	})
    
    sets.precast.WS['Tachi: Kasha'] = set_combine(sets.precast.WS, {})
    
    sets.precast.WS['Tachi: Gekko'] = set_combine(sets.precast.WS, {})
    
    sets.precast.WS['Tachi: Yukikaze'] = set_combine(sets.precast.WS, {})
    
    
    -- Midcast Sets
    sets.midcast.FastRecast = {
    	-- head="Otomi Helm",
        -- body="Kyujutsugi",
    	-- legs="Wakido Haidate +1",
        -- feet="Ejekamal Boots"
        waist="Sailfi Belt +1"
    }
    -- Sets to return to when not performing an action.
    
    -- Resting sets
    sets.resting = {
        -- head="Twilight Helm",
        -- body="Twilight Mail",
        -- ring2="Paguroidea Ring"
    }
    
    sets.idle.Town = {
        feet="Danzo Sune-ate"
    }
	
	sets.idle.Town.Craft = {
		head="Midras's Helm +1",
		body="Blacksmith's Apn.",
		hands="Smithy's Mitts",
		left_ring="Craftkeeper's Ring",
		right_ring="Artificer's Ring",
	    feet="Danzo Sune-ate"
    }
	
    sets.idle.Town.Adoulin = set_combine(sets.idle.Town, {
        feet="Danzo Sune-ate"
    })
    
	sets.idle.Town.Adoulin.Craft = set_combine(sets.idle.Town.Craft, {
        feet="Danzo Sune-ate"
    })
		
    sets.idle.Field = set_combine(sets.idle.Town, {
		head="Wakido Kabuto +3",
        feet="Danzo Sune-ate",
		left_ring="Karieyh Ring"
    })
	
	sets.idle.Field.Craft = set_combine(sets.idle.Town.Craft, {
        feet="Danzo Sune-ate",
    })

    sets.idle.Regen = set_combine(sets.idle.Field, {
        head="Rao Kabuto",
        neck="Sanctity Necklace",
        ring2="Paguroidea Ring",
        head="Rao Kabuto",
   	    body="Hizamaru Haramaki +2",
        back=Smertrios.WS,
        feet="Danzo Sune-ate"
    })
	
	sets.idle.Regen.Craft = set_combine(sets.idle.Town.Craft, {
        feet="Danzo Sune-ate",
    })
    
    sets.idle.Weak = set_combine(sets.idle.Field, {
        -- head="Twilight Helm",
    	-- body="Twilight Mail"
    })
	
	sets.idle.Field.Craft = set_combine(sets.idle.Town.Craft, {
        feet="Danzo Sune-ate",
    })
	
    sets.idle.Yoichi = set_combine(sets.idle.Field, {
    	ammo=gear.RAarrow
    })
    
    -- Defense sets
    sets.defense.PDT = {
		head="Kasuga Kabuto +1",
		body="Wakido Domaru +3",
		hands="Wakido Kote +3",
		legs="Sakonji Haidate +2",
		feet="Wakido Sune. +3",
		neck="Loricate Torque +1",
		waist="Ioskeha Belt",
		right_ear="Unkai Mimikazari",
		left_ear="Brutal Earring",
		left_ring="Defending Ring",
		right_ring="Flamma Ring",
		back="Solemnity Cape"
    }
    
    sets.defense.Reraise = set_combine(sets.defense.PDT, {
    	head="Twilight Helm",
    	body="Twilight Mail"
    })
    
    sets.defense.MDT = set_combine(sets.defense.PDT, {
		head="Midras's Helm +1",
		body="Blacksmith's Apn.",
		hands="Smithy's Mitts",
		left_ring="Craftkeeper's Ring",
		right_ring="Artificer's Ring",
	})
    
    sets.Kiting = {feet="Danzo Sune-ate"}
    
    sets.Reraise = {head="Twilight Helm",body="Twilight Mail"}
    
    -- Engaged sets
    
    -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
    -- sets if more refined versions aren't defined.
    -- If you create a set with both offense and defense modes, the offense mode should be first.
    -- EG: sets.engaged.Dagger.Accuracy.Evasion
    
    -- I generally use Anahera outside of Adoulin areas, so this set aims for 47 STP + 5 from Anahera (52 total)
    -- Note, this set assumes use of Cibitshavore (hence the arrow as ammo)
    sets.engaged = {
		ammo="Ginsen",
        head="Flam. Zucchetto +2",
		body="Kasuga Domaru +1",
		hands="Wakido Kote +3",
		legs="Wakido Haidate +3",
		feet="Ryuo Sune-ate +1",
		neck="Samurai's Nodowa +1",
		waist="Ioskeha Belt",
		right_ear="Brutal Earring",
		left_ear="Telos Earring",
		left_ring="Regal Ring",
		right_ring="Flamma Ring",
		back=Smertrios.TP
    }
    
    sets.engaged.Low = set_combine(sets.engaged, {body="Wakido Domaru +3",})
	sets.engaged.Mid = set_combine(sets.engaged.Low, {head="Wakido Kabuto +3",})
    sets.engaged.Acc = set_combine(sets.engaged.Mid, {feet="Wakido Sune-ate +3",})
	sets.engaged.Crit = set_combine(sets.engaged, {legs="Kasuga Haidate +1", feet="Wakido Sune-ate +3",})
	
    sets.engaged.PDT = set_combine(sets.engaged, {
		head="Kasuga Kabuto +1",
		body="Wakido Domaru +3",
		hands="Wakido Kote +3",
		legs="Sakonji Haidate +2",
		feet="Wakido Sune. +3",
		neck="Loricate Torque +1",
		waist="Ioskeha Belt",
		right_ear="Brutal Earring",
		left_ear="Unkai Mimikazari",
		left_ring="Defending Ring",
		right_ring="Regal Ring",
		back="Solemnity Cape"
	})
    sets.engaged.Mid.PDT = set_combine(sets.engaged.Mid, {
        head="Kendatsuba Jinpachi",
		body="Kendatsuba Haramaki",
		hands="Wakido Kote +3",
		legs="Kendatsuba Hakama",
		feet="Kendatsuba Sune-ate",
		waist="Flume Belt +1",
		right_ear="Brutal Earring",
		left_ear="Telos Earring",
		left_ring="Regal Ring",
		right_ring="Flamma Ring",
		back=Smertrios.TP
    })
    sets.engaged.Acc.PDT = set_combine(sets.engaged.Mid, {})
    
    
    sets.engaged.Yoichi = set_combine(sets.engaged, {
		range="Yoichinoyumi",
        ammo=gear.RAarrow
    })
    
    sets.engaged.Yoichi.Mid = set_combine(sets.engaged.Yoichi, {})
    
    sets.engaged.Yoichi.Acc = set_combine(sets.engaged.Yoichi.Mid, {})
    
    sets.engaged.PDT = set_combine(sets.engaged, {})
    
    sets.engaged.Yoichi.PDT = set_combine(sets.engaged.PDT,  {})
    
    sets.engaged.Acc.PDT = set_combine(sets.engaged.Acc, {})
    
    sets.engaged.Reraise = set_combine(sets.engaged.PDT, {
        head="Twilight Helm", 
        body="Twilight Mail",
    })
    
    sets.engaged.Reraise.Yoichi = set_combine(sets.engaged.Reraise, {})
    
    sets.engaged.Acc.Reraise = set_combine(sets.engaged.Reraise, {})
    
    sets.engaged.Acc.Reraise.Yoichi = set_combine(sets.engaged.Acc.Reraise, {})
    	
    sets.engaged.Amanomurakumo = set_combine(sets.engaged, {
    })
    sets.engaged.Amanomurakumo.AM = set_combine(sets.engaged, {
    })
    sets.engaged.Kogarasumaru = set_combine(sets.engaged, {
    })
    sets.engaged.Kogarasumaru.AM = set_combine(sets.engaged, {
    })
    sets.engaged.Kogarasumaru.AM3 = set_combine(sets.engaged, {
    })
    
    sets.buff.Sekkanoki = {hands="Kasuga Kote"}
    sets.buff.Sengikori = {feet="Kasuga Sune-ate"}
    sets.buff['Meikyo Shisui'] = {feet="Sakonji Sune-ate +1"}
    
    sets.thirdeye = {head="Kasuga Kabuto +1", legs="Sakonji Haidate +2"}
    --sets.seigan = {head="Kasuga Kabuto +1", legs="Sakonji Haidate +2"}
    sets.bow = {ammo=gear.RAarrow}
end


-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks that are called to process player actions at specific points in time.
-------------------------------------------------------------------------------------------------------------------

-- Set eventArgs.handled to true if we don't want any automatic target handling to be done.
function job_pretarget(spell, action, spellMap, eventArgs)
	if spell.type:lower() == 'weaponskill' then
		-- Change any GK weaponskills to polearm weaponskill if we're using a polearm.
		if player.equipment.main =='Nativus Halberd' or player.equipment.main =='Quint Spear' then
			if spell.english:startswith("Tachi:") then
				send_command('@input /ws "Stardiver" '..spell.target.raw)
				eventArgs.cancel = true
			end
		end
	end
    if state.Buff[spell.english] ~= nil then
        state.Buff[spell.english] = true
    end
end

function job_precast(spell, action, spellMap, eventArgs)
    --if spell.english == 'Third Eye' and not buffactive.Seigan then
    --    cancel_spell()
    --    send_command('@wait 0.5;input /ja Seigan <me>')
    --    send_command('@wait 1;input /ja "Third Eye" <me>')
    --end
end
-- Run after the default precast() is done.
-- eventArgs is the same one used in job_precast, in case information needs to be persisted.
function job_post_precast(spell, action, spellMap, eventArgs)
	if spell.type:lower() == 'weaponskill' then
		if state.Buff.Sekkanoki then
			equip(sets.buff.Sekkanoki)
		end
        if state.CapacityMode.value then
            equip(sets.CapacityMantle)
        end
		if player.equipment.range == 'Yoichinoyumi' then
			equip(sets.bow)
		end
        -- if is_sc_element_today(spell) then
        --     if state.OffenseMode.current == 'Normal' and wsList:contains(spell.english) then
        --         -- do nothing
        --     else
        --         equip(sets.WSDayBonus)
        --     end
        -- end
        
	if state.Buff['Meikyo Shisui'] then
			equip(sets.buff['Meikyo Shisui'])
		end
	end
    if spell.english == "Seigan" then
        -- Third Eye gearset is only called if we're in PDT mode
        if state.HybridMode.value == 'PDT' or state.PhysicalDefenseMode.value == 'PDT' then
            equip(sets.thirdeye)
        else
            equip(sets.seigan)
        end
    end
    if spell.name == 'Spectral Jig' and buffactive.sneak then
            -- If sneak is active when using, cancel before completion
            send_command('cancel 71')
    end
    update_am_type(spell)
end


-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_midcast(spell, action, spellMap, eventArgs)
	if spell.action_type == 'Magic' then
		equip(sets.midcast.FastRecast)
	end
end

-- Run after the default midcast() is done.
-- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
function job_post_midcast(spell, action, spellMap, eventArgs)
	-- Effectively lock these items in place.
	if state.HybridMode.value == 'Reraise' or
    (state.HybridMode.value == 'Physical' and state.PhysicalDefenseMode.value == 'Reraise') then
		equip(sets.Reraise)
	end
end

-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_aftercast(spell, action, spellMap, eventArgs)
	if state.Buff[spell.english] ~= nil then
		state.Buff[spell.english] = not spell.interrupted or buffactive[spell.english]
	end
end

-- Modify the default idle set after it was constructed.
function customize_idle_set(idleSet)
    if player.hpp < 90 then
        idleSet = set_combine(idleSet, sets.idle.Regen)
    end
	return idleSet
end

-- Modify the default melee set after it was constructed.
function customize_melee_set(meleeSet)
    if state.Buff['Seigan'] then
        if state.HybridMode.value == 'Normal' or state.DefenseMode.value == 'PDT' then
    	    meleeSet = set_combine(meleeSet, sets.thirdeye)
        end
    end
    if state.RangedMode.value == 'Yoichi' then
        meleeSet = set_combine(meleeSet, sets.bow, {range="Yoichinoyumi"})
    end
    if state.CapacityMode.value then
        meleeSet = set_combine(meleeSet, sets.CapacityMantle)
    end
    if player.equipment.range == 'Yoichinoyumi' then
        meleeSet = set_combine(meleeSet, sets.bow)
    end
    return meleeSet
end

-------------------------------------------------------------------------------------------------------------------
-- Customization hooks for idle and melee sets, after they've been automatically constructed.
-------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------
-- General hooks for other events.
-------------------------------------------------------------------------------------------------------------------
function job_status_change(newStatus, oldStatus, eventArgs)
    if newStatus == 'Engaged' then
        if player.inventory["Yoichi's Arrow"] then
            gear.RAarrow.name = "Yoichi's Arrow"
        elseif player.inventory['Tulfaire Arrow'] then
            gear.RAarrow.name = 'Tulfaire Arrow'
        elseif player.equipment.ammo == 'empty' then
            add_to_chat(122, 'No more Arrows!')
        end
    elseif newStatus == 'Idle' then
        determine_idle_group()
    end
end
-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
    if state.Buff[buff] ~= nil then
    	state.Buff[buff] = gain
        handle_equipping_gear(player.status)
    end

    if S{'aftermath'}:contains(buff:lower()) then
        classes.CustomMeleeGroups:clear()
       
        if player.equipment.main == 'Amanomurakumo' and state.YoichiAM.value then
            classes.CustomMeleeGroups:clear()
        elseif player.equipment.main == 'Kogarasumaru'  then
            if buff == "Aftermath: Lv.3" and gain or buffactive['Aftermath: Lv.3'] then
                classes.CustomMeleeGroups:append('AM3')
            end
        elseif buff == "Aftermath" and gain or buffactive.Aftermath then
            classes.CustomMeleeGroups:append('AM')
        end
    end
    
    if not midaction() then
        handle_equipping_gear(player.status)
    end

end

-------------------------------------------------------------------------------------------------------------------
-- User code that supplements self-commands.
-------------------------------------------------------------------------------------------------------------------

-- Called by the 'update' self-command, for common needs.
-- Set eventArgs.handled to true if we don't want automatic equipping of gear.
function job_update(cmdParams, eventArgs)
	get_combat_form()
    update_melee_groups()
    --get_combat_weapon()
end

-- Set eventArgs.handled to true if we don't want the automatic display to be run.
function display_current_job_state(eventArgs)

end

-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
function get_combat_weapon()
    if player.equipment.range == 'Yoichinoyumi' then
        if player.equipment.main == 'Amanomurakumo' then
            state.CombatWeapon:set('AmanoYoichi')
        else
            state.CombatWeapon:set('Yoichi')
        end
    else
        state.CombatWeapon:set(player.equipment.main)
    end
end
-- Handle zone specific rules
windower.register_event('Zone change', function(new,old)
    determine_idle_group()
end)

function determine_idle_group()
    classes.CustomIdleGroups:clear()
    if areas.Adoulin:contains(world.area) then
    	classes.CustomIdleGroups:append('Adoulin')
    end
end

function get_combat_form()
    -- if areas.Adoulin:contains(world.area) and buffactive.ionis then
    -- 	state.CombatForm:set('Adoulin')
    -- else
    --     state.CombatForm:reset()
    -- end
end

function seigan_thirdeye_active()
    return state.Buff['Seigan'] or state.Buff['Third Eye']
end

function update_melee_groups()
    classes.CustomMeleeGroups:clear()

    if player.equipment.main == 'Amanomurakumo' and state.YoichiAM.value then
        -- prevents using Amano AM while overriding it with Yoichi AM
        classes.CustomMeleeGroups:clear()
    elseif player.equipment.main == 'Kogarasumaru' then
        if buffactive['Aftermath: Lv.3'] then
            classes.CustomMeleeGroups:append('AM3')
        end
    else
        if buffactive['Aftermath'] then
            classes.CustomMeleeGroups:append('AM')
        end
    end
end
-- call this in job_post_precast() 
function update_am_type(spell)
    if spell.type == 'WeaponSkill' and spell.skill == 'Archery' and spell.english == 'Namas Arrow' then
        if player.equipment.main == 'Amanomurakumo' then
            -- Yoichi AM overwrites Amano AM
            state.YoichiAM:set(true)
        end
    else
        state.YoichiAM:set(false)
    end
end
-- Set eventArgs.handled to true if display was handled, and you don't want the default info shown.
function display_current_job_state(eventArgs)
    local cf_msg = ''
    if state.CombatForm.has_value then
        cf_msg = ' (' ..state.CombatForm.value.. ')'
    end

    local m_msg = state.OffenseMode.value
    if state.HybridMode.value ~= 'Normal' then
        m_msg = m_msg .. '/' ..state.HybridMode.value
	elseif state.RangedMode.value ~= 'Normal' then
        m_msg = m_msg .. '/' ..state.RangedMode.value
    end

    local ws_msg = state.WeaponskillMode.value

    local d_msg = 'None'
    if state.DefenseMode.value ~= 'None' then
        d_msg = state.DefenseMode.value .. state[state.DefenseMode.value .. 'DefenseMode'].value
    end

    local i_msg = state.IdleMode.value

    local msg = ''
    if state.Kiting.value then
        msg = msg .. ' Kiting: On |'
    end

    add_to_chat(002, '| ' ..string.char(31,210).. 'Melee' ..cf_msg.. ': ' ..string.char(31,001)..m_msg.. string.char(31,002)..  ' |'
        ..string.char(31,207).. ' WS: ' ..string.char(31,001)..ws_msg.. string.char(31,002)..  ' |'
        ..string.char(31,004).. ' Defense: ' ..string.char(31,001)..d_msg.. string.char(31,002)..  ' |'
        ..string.char(31,008).. ' Idle: ' ..string.char(31,001)..i_msg.. string.char(31,002)..  ' |'
        ..string.char(31,002)..msg)

    eventArgs.handled = true
end
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
    -- Default macro set/book
    if player.sub_job == 'WAR' then
    	set_macro_page(1, 1)
    elseif player.sub_job == 'DNC' then
    	set_macro_page(1, 1)
    else
    	set_macro_page(1, 1)
    end
end
function set_lockstyle()
    send_command('wait 2; input /lockstyleset ' .. lockstyleset)
end
 Phoenix.Logical
Offline
Serveur: Phoenix
Game: FFXI
Posts: 519
By Phoenix.Logical 2019-12-28 19:03:30
Link | Citer | R
 
Bismarck.Xurion said: »
The self_command function receives a single argument of anything you type after the //gs c. With this you can split the string:
Code
tp_mode = 'normal'
mb_mode = 'normal'
 
function self_command(command)
  local args = split_args(command)
  if args[1] == 'tp' then
    tp_mode = args[2]
  elseif args[1] == 'mb' then
    mb_mode = args[2]
  end
end

function split_args(args)
  fields = {}
  args:gsub("([^ ]*) ?", function(c)
   table.insert(fields, c)
  end)
  return fields
end


Then you can use:
Code
//gs c tp dw40
//gs c mb burst


Note that I went with spaces between commands/args instead of slashes, as this is the most common pattern.

Perfect! Thanks again!!!
[+]
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2019-12-29 03:59:24
Link | Citer | R
 
@Kurdtray It's slightly different due to motes. I tested this and it seems to work as expected:
Code
-------------------------------------------------------------------------------------------------------------------
--  Keybinds
-------------------------------------------------------------------------------------------------------------------
 
--  Modes:      [ F9 ]              Cycle Offense Modes
--              [ CTRL+F9 ]         Cycle Hybrid Modes
--              [ WIN+F9 ]          Cycle Weapon Skill Modes
--              [ F10 ]             Emergency -PDT Mode
--              [ CTRL+F10 ]        Cycle PDT/Reraise
--              [ ALT+F10 ]         Toggle Kiting Mode
--              [ F11 ]             Emergency -MDT Mode
--              [ F12 ]             Update Current Gear / Report Current Status
--              [ CTRL+F12 ]        Cycle Idle Modes
--              [ ALT+F12 ]         Cancel Emergency -PDT/-MDT Mode
--              [ ALT+C ]           Toggle Capacity Points Mode
--
--
--              [ CTRL+numpad7 ]    Tachi: Fudo
--              [ CTRL+numpad8 ]    Tachi: Shoha
--              [ CTRL+numpad4 ]    Tachi: Rana
--              [ CTRL+numpad1 ]    Namas Arrow
--              [ CTRL+numpad2 ]    Apex Arrow
--
--              [ CTRL+numpad/ ]    Berserk
--              [ CTRL+numpad* ]    Warcry
--              [ CTRL+numpad- ]    Aggressor
--              [ CTRL+numpad0 ]    Meditate
--
--              (Global-Binds.lua contains additional non-job-related keybinds)
 
-------------------------------------------------------------------------------------------------------------------
-- Initialization function that defines sets and variables to be used.
-------------------------------------------------------------------------------------------------------------------
--Ionis Zones
--Anahera Blade (4 hit): 52
--Tsurumaru (4 hit): 49
--Kogarasumaru (or generic 450 G.katana) (5 hit): 40
--Amanomurakumo/Masamune 437 (5 hit): 46
--
--Non Ionis Zones:
--Anahera Blade (4 hit): 52
--Tsurumaru (5 hit): 24
--Kogarasumaru (5 hit): 40
--Amanomurakumo/Masamune 437 (5 hit): 46
--
--Aftermath sets
-- Koga AM1/AM2 = sets.engaged.Kogarasumaru.AM
-- Koga AM3 = sets.engaged.Kogarasumaru.AM3
-- Amano AM = sets.engaged.Amanomurakumo.AM
-- Using Namas Arrow while using Amano will cancel STPAM set
 
-- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.
 
-- Initialization function for this job file.
function get_sets()
    -- Load and initialize the include file.
    mote_include_version = 2
    include('Mote-Include.lua')
    include('organizer-lib')
end
 
 
-- Setup vars that are user-independent.
function job_setup()
    get_combat_form()
    --get_combat_weapon()
    update_melee_groups()
     
    state.CapacityMode = M(false, 'Capacity Point Mantle')
 
    state.YoichiAM = M(false, 'Cancel Yoichi AM Mode')
    -- list of weaponskills that make better use of otomi helm in low acc situations
    wsList = S{'Tachi: Fudo', 'Tachi: Shoha'}
 
    gear.RAarrow = {name="Yoichi's Arrow"}
    
 
    state.Buff.Sekkanoki = buffactive.sekkanoki or false
    state.Buff.Sengikori = buffactive.sengikori or false
    state.Buff['Third Eye'] = buffactive['Third Eye'] or false
    state.Buff['Seigan'] = buffactive['Seigan'] or false
    state.Buff['Meikyo Shisui'] = buffactive['Meikyo Shisui'] or false
     
    --Lockstyle
    lockstyleset = 9

    auto_target = true
end
 
 
-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
function user_setup()
    -- Options: Override default values
    state.OffenseMode:options('Normal', 'Low', 'Mid', 'Acc', 'Crit')
    state.RangedMode:options('Normal', 'Yoichi')
    state.HybridMode:options('Normal', 'PDT', 'Reraise')
    state.WeaponskillMode:options('Normal', 'Mid', 'Acc')
    state.IdleMode:options('Normal', 'Craft')
    state.RestingMode:options('Normal')
    state.PhysicalDefenseMode:options('PDT', 'Reraise')
    state.MagicalDefenseMode:options('MDT')
     
    -- Additional local binds
    send_command('bind ^[ input /lockstyle on')
    send_command('bind ![ input /lockstyle off')
    send_command('bind !c gs c toggle CapacityMode')
     
    if player.sub_job == 'WAR' then
        send_command('bind ^numpad/ input /ja "Berserk" <me>')
        send_command('bind ^numpad* input /ja "Warcry" <me>')
        send_command('bind ^numpad- input /ja "Aggressor" <me>')
    end
     
    send_command('bind ^numpad7 input /ws "Tachi: Fudo" <t>')
    send_command('bind ^numpad8 input /ws "Tachi: Shoha" <t>')
    send_command('bind ^numpad4 input /ws "Tachi: Rana" <t>')
    send_command('bind ^numpad1 input /ws "Namas Arrow" <t>')
    send_command('bind ^numpad2 input /ws "Apex Arrow" <t>')
 
    send_command('bind ^numpad0 input /ja "Meditate" <me>')
    send_command('bind ^a gs c autotarget');
     
    select_default_macro_book()
    set_lockstyle()
end
 
 
 
-- Called when this job file is unloaded (eg: job change)
function file_unload()
    send_command('unbind ^[')
    send_command('unbind !c')
    send_command('unbind ![')
     
    send_command('unbind ^numpad/')
    send_command('unbind ^numpad*')
    send_command('unbind ^numpad-')
    send_command('unbind ^numpad7')
    send_command('unbind ^numpad8')
    send_command('unbind ^numpad5')
    send_command('unbind ^numpad1')
    send_command('unbind ^numpad2')
    send_command('unbind ^numpad0')
    send_command('unbind ^numpad.')
    send_command('unbind ^a');
end
 
--[[
-- SC's
Rana > Shoha > Fudo > Kasha > Shoha > Fudo - light
Rana > Shoha > Fudo > Kasha > Rana > Fudo - dark
Kasha > Shoha > Fudo
Fudo > Kasha > Shoha > fudo
Shoha > Fudo > Kasha > Shoha > Fudo
--]]
function init_gear_sets()
    --------------------------------------
    -- Start defining the sets
    --------------------------------------
    --gear.Valo_WSD_head
    --gear.Valo_WSD_hands
    --gear.Valo_WSD_feet
     
    --Smertrios
    --Smertrios.TP
    --Smertrios.WS
    --Smertrios.RA
     
    -- Precast Sets
    -- Precast sets to enhance JAs
    sets.precast.JA.Meditate = {
        head="Wakido Kabuto +3",
        hands="Sakonji kote +3",
        back=Smertrios.WS
    }
    sets.precast.JA.Seigan = {head="Sakonji Haidate +2"}
    sets.precast.JA['Warding Circle'] = {head="Wakido Kabuto +3"}
    sets.precast.JA['Third Eye'] = {legs="Sakonji Haidate +2"}
    --sets.precast.JA['Blade Bash'] = {hands="Sakonji Kote +3"}
    
    sets.precast.FC = {
        right_ear="Etiolation Earring",
        left_ear="Loquacious Earring",
        hands="Leyline Gloves",
        ring1="Prolix Ring",
        ring2="Weatherspoon Ring"
    }
    -- Waltz set (chr and vit)
    sets.precast.Waltz = {}
 
    sets.Organizer = {
        sub="Utu Grip",
        range="Yoichinoyumi",
        ammo=gear.RAarrow,
        back=Smertrios.RA
    }
    sets.precast.RA = {
        ammo=gear.RAarrow,
        head="Sakonji Kabuto +3",
        body="Acro Surcoat",
        hands="Acro Gauntlets",
        legs="Acro Breeches",
        feet="Acro Leggings",
        back=Smertrios.RA
    }
    sets.midcast.RA = {
        head="Sakonji Kabuto +3",
        body="Kendatsuba Samue",
        legs="Kendatsuba Hakama",
        neck="Sanctity Necklace",
        hands="Kendatsuba Tekko",
        waist="Eschan Stone",
        left_ear="Enervating Earring",
        right_ear="Telos Earring",
        ring1="Hajduk Ring",
        ring2="Longshot Ring",
        feet="Wakido Sune-ate +3",
        back=Smertrios.RA
    }   
    -- Don't need any special gear for Healing Waltz.
    sets.precast.Waltz['Healing Waltz'] = {}
     
    sets.CapacityMantle  = { back="Mecistopins Mantle" }
    --sets.Berserker       = { neck="Berserker's Torque" }
    sets.WSDayBonus      = { head="Gavialis Helm" }
    sets.BrutalMoonshade = { right_ear="Moonshade Earring", left_ear="Brutal Earring" }
    sets.LugraFlame      = { right_ear="Lugra Earring +1", left_ear="Flame Pearl" }
    sets.FlameFlame      = { right_ear="Flame Pearl", left_ear="Flame Pearl" }
        
    -- Weaponskill sets
    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS = {
        ammo="Knobkierrie",
        head=gear.Valo_WSD_head,
        body="Sakonji Domaru +3", augments={'Enhances "Overwhelm" effect',},
        hands="Valorous Mitts",
        legs="Wakido Haidate +3",
        feet=gear.Valo_WSD_feet,
        neck="Samurai's Nodowa +1",
        waist="Fotia Belt",
        right_ear={name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
        left_ear="Thrud Earring",
        left_ring="Karieyh Ring",
        right_ring="Regal Ring",
        back=Smertrios.WS
    }
    sets.precast.WS.Mid = set_combine(sets.precast.WS, {left_ear="Telos Earring",})
    sets.precast.WS.Acc = set_combine(sets.precast.WS.Mid, {})
     
    sets.precast.WS['Namas Arrow'] = {
        ammo=gear.RAarrow,
        head="Sakonji Kabuto +3",
        body="Sakonji Domaru +3", augments={'Enhances "Overwhelm" effect',},
        legs="Wakido Haidate +3",
        neck="Fotia Gorget",
        hands="Kendatsuba Tekko",
        waist="Fotia Belt",
        right_ear="Enervating Earring",
        left_ear="Telos Earring",
        ring1="Karieyh Ring",
        ring2="Regal Ring",
        feet="Wakido Sune-ate +3"
    }
    sets.precast.WS['Namas Arrow'].Mid = set_combine(sets.precast.WS['Namas Arrow'], {legs="Kendatsuba Hakama", "Kendatsuba Samue"})
    sets.precast.WS['Namas Arrow'].Acc = set_combine(sets.precast.WS['Namas Arrow'].Mid, {ring1="Hajduk Ring"})
     
    sets.precast.WS['Apex Arrow'] = set_combine(sets.precast.WS['Namas Arrow'], {})
    sets.precast.WS['Apex Arrow'].Mid = set_combine(sets.precast.WS['Apex Arrow'], {legs="Kendatsuba Hakama", "Kendatsuba Samue"})
    sets.precast.WS['Apex Arrow'].Acc = set_combine(sets.precast.WS['Apex Arrow'].Mid, {ring1="Hajduk Ring"})
     
    sets.precast.WS['Sidewinder'] = set_combine(sets.precast.WS['Namas Arrow'], {})
    sets.precast.WS['Sidewinder'].Mid = sets.precast.WS['Apex Arrow']
    sets.precast.WS['Sidewinder'].Acc = set_combine(sets.precast.WS['Apex Arrow'], {})
     
    sets.precast.WS['Tachi: Fudo'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Tachi: Fudo'].Mid = set_combine(sets.precast.WS['Tachi: Fudo'], {
        head="Flam. Zucchetto +2",
        hands="Wakido Kote +3",
        left_ear="Telos Earring",
        })
    sets.precast.WS['Tachi: Fudo'].Acc = set_combine(sets.precast.WS['Tachi: Fudo'].Mid, {
        head="Flam. Zucchetto +2",
        body="Wakido Domaru +3",
        hands="Wakido Kote +3",
        })
     
    sets.precast.WS['Impulse Drive'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Impulse Drive'].Mid = set_combine(sets.precast.WS['Impulse Drive'], {})
    sets.precast.WS['Impulse Drive'].Acc = set_combine(sets.precast.WS['Impulse Drive'].Mid, {})
     
    sets.precast.WS['Tachi: Shoha'] = set_combine(sets.precast.WS, {
        head="Flamma Zucchetto +2",
        feet="Flamma Gambieras +2",
        })
    sets.precast.WS['Tachi: Shoha'].Mid = set_combine(sets.precast.WS['Tachi: Shoha'], {
        hands="Wakido Kote +3",
        left_ear="Telos Earring",
        })
    sets.precast.WS['Tachi: Shoha'].Acc = set_combine(sets.precast.WS['Tachi: Shoha'].Mid, {body="Wakido Domaru +3",})
 
    sets.precast.WS['Stardiver'] = set_combine(sets.precast.WS['Tachi: Shoha'], {
        head="Flam. Zucchetto +2",
        body="Sakonji Domaru +3", augments={'Enhances "Overwhelm" effect',},
        hands="Wakido Kote +3",
        legs="Wakido Haidate +3",
        feet=gear.Valo_WSD_feet,
        neck="Samurai's Nodowa +1",
        waist="Fotia Belt",
        right_ear={name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
        left_ear="Thrud Earring",
        left_ring="Karieyh Ring",
        right_ring="Flamma Ring",
        back=Smertrios.WS
    })
    sets.precast.WS['Stardiver'].Mid = set_combine(sets.precast.WS['Stardiver'], {})
    sets.precast.WS['Stardiver'].Acc = set_combine(sets.precast.WS['Stardiver'].Mid, {})
     
    sets.precast.WS['Tachi: Rana'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Tachi: Rana'].Mid = set_combine(sets.precast.WS['Tachi: Rana'], {})
    sets.precast.WS['Tachi: Rana'].Acc = set_combine(sets.precast.WS.Acc, {})
    -- CHR Mod
    sets.precast.WS['Tachi: Ageha'] = set_combine(sets.precast.WS, {})
     
    sets.precast.WS['Tachi: Jinpu'] = set_combine(sets.precast.WS, {
        neck="Fotia Gorget",
        body="Founder's Breastplate",
        hands="Founder's Gauntlets",
        feet="Founder's Greaves",
        left_ear="Friomisi Earring",
    })
     
    sets.precast.WS['Tachi: Kasha'] = set_combine(sets.precast.WS, {})
     
    sets.precast.WS['Tachi: Gekko'] = set_combine(sets.precast.WS, {})
     
    sets.precast.WS['Tachi: Yukikaze'] = set_combine(sets.precast.WS, {})
     
     
    -- Midcast Sets
    sets.midcast.FastRecast = {
        -- head="Otomi Helm",
        -- body="Kyujutsugi",
        -- legs="Wakido Haidate +1",
        -- feet="Ejekamal Boots"
        waist="Sailfi Belt +1"
    }
    -- Sets to return to when not performing an action.
     
    -- Resting sets
    sets.resting = {
        -- head="Twilight Helm",
        -- body="Twilight Mail",
        -- ring2="Paguroidea Ring"
    }
     
    sets.idle.Town = {
        feet="Danzo Sune-ate"
    }
     
    sets.idle.Town.Craft = {
        head="Midras's Helm +1",
        body="Blacksmith's Apn.",
        hands="Smithy's Mitts",
        left_ring="Craftkeeper's Ring",
        right_ring="Artificer's Ring",
        feet="Danzo Sune-ate"
    }
     
    sets.idle.Town.Adoulin = set_combine(sets.idle.Town, {
        feet="Danzo Sune-ate"
    })
     
    sets.idle.Town.Adoulin.Craft = set_combine(sets.idle.Town.Craft, {
        feet="Danzo Sune-ate"
    })
         
    sets.idle.Field = set_combine(sets.idle.Town, {
        head="Wakido Kabuto +3",
        feet="Danzo Sune-ate",
        left_ring="Karieyh Ring"
    })
     
    sets.idle.Field.Craft = set_combine(sets.idle.Town.Craft, {
        feet="Danzo Sune-ate",
    })
 
    sets.idle.Regen = set_combine(sets.idle.Field, {
        head="Rao Kabuto",
        neck="Sanctity Necklace",
        ring2="Paguroidea Ring",
        head="Rao Kabuto",
        body="Hizamaru Haramaki +2",
        back=Smertrios.WS,
        feet="Danzo Sune-ate"
    })
     
    sets.idle.Regen.Craft = set_combine(sets.idle.Town.Craft, {
        feet="Danzo Sune-ate",
    })
     
    sets.idle.Weak = set_combine(sets.idle.Field, {
        -- head="Twilight Helm",
        -- body="Twilight Mail"
    })
     
    sets.idle.Field.Craft = set_combine(sets.idle.Town.Craft, {
        feet="Danzo Sune-ate",
    })
     
    sets.idle.Yoichi = set_combine(sets.idle.Field, {
        ammo=gear.RAarrow
    })
     
    -- Defense sets
    sets.defense.PDT = {
        head="Kasuga Kabuto +1",
        body="Wakido Domaru +3",
        hands="Wakido Kote +3",
        legs="Sakonji Haidate +2",
        feet="Wakido Sune. +3",
        neck="Loricate Torque +1",
        waist="Ioskeha Belt",
        right_ear="Unkai Mimikazari",
        left_ear="Brutal Earring",
        left_ring="Defending Ring",
        right_ring="Flamma Ring",
        back="Solemnity Cape"
    }
     
    sets.defense.Reraise = set_combine(sets.defense.PDT, {
        head="Twilight Helm",
        body="Twilight Mail"
    })
     
    sets.defense.MDT = set_combine(sets.defense.PDT, {
        head="Midras's Helm +1",
        body="Blacksmith's Apn.",
        hands="Smithy's Mitts",
        left_ring="Craftkeeper's Ring",
        right_ring="Artificer's Ring",
    })
     
    sets.Kiting = {feet="Danzo Sune-ate"}
     
    sets.Reraise = {head="Twilight Helm",body="Twilight Mail"}
     
    -- Engaged sets
     
    -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
    -- sets if more refined versions aren't defined.
    -- If you create a set with both offense and defense modes, the offense mode should be first.
    -- EG: sets.engaged.Dagger.Accuracy.Evasion
     
    -- I generally use Anahera outside of Adoulin areas, so this set aims for 47 STP + 5 from Anahera (52 total)
    -- Note, this set assumes use of Cibitshavore (hence the arrow as ammo)
    sets.engaged = {
        ammo="Ginsen",
        head="Flam. Zucchetto +2",
        body="Kasuga Domaru +1",
        hands="Wakido Kote +3",
        legs="Wakido Haidate +3",
        feet="Ryuo Sune-ate +1",
        neck="Samurai's Nodowa +1",
        waist="Ioskeha Belt",
        right_ear="Brutal Earring",
        left_ear="Telos Earring",
        left_ring="Regal Ring",
        right_ring="Flamma Ring",
        back=Smertrios.TP
    }
     
    sets.engaged.Low = set_combine(sets.engaged, {body="Wakido Domaru +3",})
    sets.engaged.Mid = set_combine(sets.engaged.Low, {head="Wakido Kabuto +3",})
    sets.engaged.Acc = set_combine(sets.engaged.Mid, {feet="Wakido Sune-ate +3",})
    sets.engaged.Crit = set_combine(sets.engaged, {legs="Kasuga Haidate +1", feet="Wakido Sune-ate +3",})
     
    sets.engaged.PDT = set_combine(sets.engaged, {
        head="Kasuga Kabuto +1",
        body="Wakido Domaru +3",
        hands="Wakido Kote +3",
        legs="Sakonji Haidate +2",
        feet="Wakido Sune. +3",
        neck="Loricate Torque +1",
        waist="Ioskeha Belt",
        right_ear="Brutal Earring",
        left_ear="Unkai Mimikazari",
        left_ring="Defending Ring",
        right_ring="Regal Ring",
        back="Solemnity Cape"
    })
    sets.engaged.Mid.PDT = set_combine(sets.engaged.Mid, {
        head="Kendatsuba Jinpachi",
        body="Kendatsuba Haramaki",
        hands="Wakido Kote +3",
        legs="Kendatsuba Hakama",
        feet="Kendatsuba Sune-ate",
        waist="Flume Belt +1",
        right_ear="Brutal Earring",
        left_ear="Telos Earring",
        left_ring="Regal Ring",
        right_ring="Flamma Ring",
        back=Smertrios.TP
    })
    sets.engaged.Acc.PDT = set_combine(sets.engaged.Mid, {})
     
     
    sets.engaged.Yoichi = set_combine(sets.engaged, {
        range="Yoichinoyumi",
        ammo=gear.RAarrow
    })
     
    sets.engaged.Yoichi.Mid = set_combine(sets.engaged.Yoichi, {})
     
    sets.engaged.Yoichi.Acc = set_combine(sets.engaged.Yoichi.Mid, {})
     
    sets.engaged.PDT = set_combine(sets.engaged, {})
     
    sets.engaged.Yoichi.PDT = set_combine(sets.engaged.PDT,  {})
     
    sets.engaged.Acc.PDT = set_combine(sets.engaged.Acc, {})
     
    sets.engaged.Reraise = set_combine(sets.engaged.PDT, {
        head="Twilight Helm", 
        body="Twilight Mail",
    })
     
    sets.engaged.Reraise.Yoichi = set_combine(sets.engaged.Reraise, {})
     
    sets.engaged.Acc.Reraise = set_combine(sets.engaged.Reraise, {})
     
    sets.engaged.Acc.Reraise.Yoichi = set_combine(sets.engaged.Acc.Reraise, {})
         
    sets.engaged.Amanomurakumo = set_combine(sets.engaged, {
    })
    sets.engaged.Amanomurakumo.AM = set_combine(sets.engaged, {
    })
    sets.engaged.Kogarasumaru = set_combine(sets.engaged, {
    })
    sets.engaged.Kogarasumaru.AM = set_combine(sets.engaged, {
    })
    sets.engaged.Kogarasumaru.AM3 = set_combine(sets.engaged, {
    })
     
    sets.buff.Sekkanoki = {hands="Kasuga Kote"}
    sets.buff.Sengikori = {feet="Kasuga Sune-ate"}
    sets.buff['Meikyo Shisui'] = {feet="Sakonji Sune-ate +1"}
     
    sets.thirdeye = {head="Kasuga Kabuto +1", legs="Sakonji Haidate +2"}
    --sets.seigan = {head="Kasuga Kabuto +1", legs="Sakonji Haidate +2"}
    sets.bow = {ammo=gear.RAarrow}
end
 
 
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks that are called to process player actions at specific points in time.
-------------------------------------------------------------------------------------------------------------------
 
-- Set eventArgs.handled to true if we don't want any automatic target handling to be done.
function job_pretarget(spell, action, spellMap, eventArgs)
    if spell.type:lower() == 'weaponskill' then
        -- Change any GK weaponskills to polearm weaponskill if we're using a polearm.
        if player.equipment.main =='Nativus Halberd' or player.equipment.main =='Quint Spear' then
            if spell.english:startswith("Tachi:") then
                send_command('@input /ws "Stardiver" '..spell.target.raw)
                eventArgs.cancel = true
            end
        end
    end
    if state.Buff[spell.english] ~= nil then
        state.Buff[spell.english] = true
    end
end
 
function job_precast(spell, action, spellMap, eventArgs)
    --if spell.english == 'Third Eye' and not buffactive.Seigan then
    --    cancel_spell()
    --    send_command('@wait 0.5;input /ja Seigan <me>')
    --    send_command('@wait 1;input /ja "Third Eye" <me>')
    --end
end
-- Run after the default precast() is done.
-- eventArgs is the same one used in job_precast, in case information needs to be persisted.
function job_post_precast(spell, action, spellMap, eventArgs)
    if spell.type:lower() == 'weaponskill' then
        if state.Buff.Sekkanoki then
            equip(sets.buff.Sekkanoki)
        end
        if state.CapacityMode.value then
            equip(sets.CapacityMantle)
        end
        if player.equipment.range == 'Yoichinoyumi' then
            equip(sets.bow)
        end
        -- if is_sc_element_today(spell) then
        --     if state.OffenseMode.current == 'Normal' and wsList:contains(spell.english) then
        --         -- do nothing
        --     else
        --         equip(sets.WSDayBonus)
        --     end
        -- end
         
    if state.Buff['Meikyo Shisui'] then
            equip(sets.buff['Meikyo Shisui'])
        end
    end
    if spell.english == "Seigan" then
        -- Third Eye gearset is only called if we're in PDT mode
        if state.HybridMode.value == 'PDT' or state.PhysicalDefenseMode.value == 'PDT' then
            equip(sets.thirdeye)
        else
            equip(sets.seigan)
        end
    end
    if spell.name == 'Spectral Jig' and buffactive.sneak then
            -- If sneak is active when using, cancel before completion
            send_command('cancel 71')
    end
    update_am_type(spell)
end
 
 
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_midcast(spell, action, spellMap, eventArgs)
    if spell.action_type == 'Magic' then
        equip(sets.midcast.FastRecast)
    end
end
 
-- Run after the default midcast() is done.
-- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
function job_post_midcast(spell, action, spellMap, eventArgs)
    -- Effectively lock these items in place.
    if state.HybridMode.value == 'Reraise' or
    (state.HybridMode.value == 'Physical' and state.PhysicalDefenseMode.value == 'Reraise') then
        equip(sets.Reraise)
    end
end
 
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_aftercast(spell, action, spellMap, eventArgs)
    if state.Buff[spell.english] ~= nil then
        state.Buff[spell.english] = not spell.interrupted or buffactive[spell.english]
    end
end
 
-- Modify the default idle set after it was constructed.
function customize_idle_set(idleSet)
    if player.hpp < 90 then
        idleSet = set_combine(idleSet, sets.idle.Regen)
    end
    return idleSet
end
 
-- Modify the default melee set after it was constructed.
function customize_melee_set(meleeSet)
    if state.Buff['Seigan'] then
        if state.HybridMode.value == 'Normal' or state.DefenseMode.value == 'PDT' then
            meleeSet = set_combine(meleeSet, sets.thirdeye)
        end
    end
    if state.RangedMode.value == 'Yoichi' then
        meleeSet = set_combine(meleeSet, sets.bow, {range="Yoichinoyumi"})
    end
    if state.CapacityMode.value then
        meleeSet = set_combine(meleeSet, sets.CapacityMantle)
    end
    if player.equipment.range == 'Yoichinoyumi' then
        meleeSet = set_combine(meleeSet, sets.bow)
    end
    return meleeSet
end
 
-------------------------------------------------------------------------------------------------------------------
-- Customization hooks for idle and melee sets, after they've been automatically constructed.
-------------------------------------------------------------------------------------------------------------------
 
-------------------------------------------------------------------------------------------------------------------
-- General hooks for other events.
-------------------------------------------------------------------------------------------------------------------
function job_status_change(newStatus, oldStatus, eventArgs)
    if newStatus == 'Engaged' then
        if player.inventory["Yoichi's Arrow"] then
            gear.RAarrow.name = "Yoichi's Arrow"
        elseif player.inventory['Tulfaire Arrow'] then
            gear.RAarrow.name = 'Tulfaire Arrow'
        elseif player.equipment.ammo == 'empty' then
            add_to_chat(122, 'No more Arrows!')
        end
    elseif newStatus == 'Idle' then
        determine_idle_group()
    end
end
-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
    if state.Buff[buff] ~= nil then
        state.Buff[buff] = gain
        handle_equipping_gear(player.status)
    end
 
    if S{'aftermath'}:contains(buff:lower()) then
        classes.CustomMeleeGroups:clear()
        
        if player.equipment.main == 'Amanomurakumo' and state.YoichiAM.value then
            classes.CustomMeleeGroups:clear()
        elseif player.equipment.main == 'Kogarasumaru'  then
            if buff == "Aftermath: Lv.3" and gain or buffactive['Aftermath: Lv.3'] then
                classes.CustomMeleeGroups:append('AM3')
            end
        elseif buff == "Aftermath" and gain or buffactive.Aftermath then
            classes.CustomMeleeGroups:append('AM')
        end
    end
     
    if not midaction() then
        handle_equipping_gear(player.status)
    end
 
end
 
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements self-commands.
-------------------------------------------------------------------------------------------------------------------
 
-- Called by the 'update' self-command, for common needs.
-- Set eventArgs.handled to true if we don't want automatic equipping of gear.
function job_update(cmdParams, eventArgs)
    get_combat_form()
    update_melee_groups()
    --get_combat_weapon()
end
 
-- Set eventArgs.handled to true if we don't want the automatic display to be run.
function display_current_job_state(eventArgs)
 
end
 
function job_self_command(args)
  local command = args[1]
  if command == 'autotarget' then
    if auto_target then
      windower.send_command('input /autotarget off')
      auto_target = false
    else
      windower.send_command('input /autotarget on')
      auto_target = true
    end
  end
end
 
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
function get_combat_weapon()
    if player.equipment.range == 'Yoichinoyumi' then
        if player.equipment.main == 'Amanomurakumo' then
            state.CombatWeapon:set('AmanoYoichi')
        else
            state.CombatWeapon:set('Yoichi')
        end
    else
        state.CombatWeapon:set(player.equipment.main)
    end
end
-- Handle zone specific rules
windower.register_event('Zone change', function(new,old)
    determine_idle_group()
end)
 
function determine_idle_group()
    classes.CustomIdleGroups:clear()
    if areas.Adoulin:contains(world.area) then
        classes.CustomIdleGroups:append('Adoulin')
    end
end
 
function get_combat_form()
    -- if areas.Adoulin:contains(world.area) and buffactive.ionis then
    --  state.CombatForm:set('Adoulin')
    -- else
    --     state.CombatForm:reset()
    -- end
end
 
function seigan_thirdeye_active()
    return state.Buff['Seigan'] or state.Buff['Third Eye']
end
 
function update_melee_groups()
    classes.CustomMeleeGroups:clear()
 
    if player.equipment.main == 'Amanomurakumo' and state.YoichiAM.value then
        -- prevents using Amano AM while overriding it with Yoichi AM
        classes.CustomMeleeGroups:clear()
    elseif player.equipment.main == 'Kogarasumaru' then
        if buffactive['Aftermath: Lv.3'] then
            classes.CustomMeleeGroups:append('AM3')
        end
    else
        if buffactive['Aftermath'] then
            classes.CustomMeleeGroups:append('AM')
        end
    end
end
-- call this in job_post_precast() 
function update_am_type(spell)
    if spell.type == 'WeaponSkill' and spell.skill == 'Archery' and spell.english == 'Namas Arrow' then
        if player.equipment.main == 'Amanomurakumo' then
            -- Yoichi AM overwrites Amano AM
            state.YoichiAM:set(true)
        end
    else
        state.YoichiAM:set(false)
    end
end
-- Set eventArgs.handled to true if display was handled, and you don't want the default info shown.
function display_current_job_state(eventArgs)
    local cf_msg = ''
    if state.CombatForm.has_value then
        cf_msg = ' (' ..state.CombatForm.value.. ')'
    end
 
    local m_msg = state.OffenseMode.value
    if state.HybridMode.value ~= 'Normal' then
        m_msg = m_msg .. '/' ..state.HybridMode.value
    elseif state.RangedMode.value ~= 'Normal' then
        m_msg = m_msg .. '/' ..state.RangedMode.value
    end
 
    local ws_msg = state.WeaponskillMode.value
 
    local d_msg = 'None'
    if state.DefenseMode.value ~= 'None' then
        d_msg = state.DefenseMode.value .. state[state.DefenseMode.value .. 'DefenseMode'].value
    end
 
    local i_msg = state.IdleMode.value
 
    local msg = ''
    if state.Kiting.value then
        msg = msg .. ' Kiting: On |'
    end
 
    add_to_chat(002, '| ' ..string.char(31,210).. 'Melee' ..cf_msg.. ': ' ..string.char(31,001)..m_msg.. string.char(31,002)..  ' |'
        ..string.char(31,207).. ' WS: ' ..string.char(31,001)..ws_msg.. string.char(31,002)..  ' |'
        ..string.char(31,004).. ' Defense: ' ..string.char(31,001)..d_msg.. string.char(31,002)..  ' |'
        ..string.char(31,008).. ' Idle: ' ..string.char(31,001)..i_msg.. string.char(31,002)..  ' |'
        ..string.char(31,002)..msg)
 
    eventArgs.handled = true
end
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
    -- Default macro set/book
    if player.sub_job == 'WAR' then
        set_macro_page(1, 1)
    elseif player.sub_job == 'DNC' then
        set_macro_page(1, 1)
    else
        set_macro_page(1, 1)
    end
end
function set_lockstyle()
    send_command('wait 2; input /lockstyleset ' .. lockstyleset)
end
 Asura.Kurdtray
Offline
Serveur: Asura
Game: FFXI
user: Kurdtray
Posts: 22
By Asura.Kurdtray 2019-12-29 09:22:36
Link | Citer | R
 
That did it thank you. I see now that i was close to the right train of thought, but there is still much for me to learn with lua's. Thanks again.
[+]
 Phoenix.Logical
Offline
Serveur: Phoenix
Game: FFXI
Posts: 519
By Phoenix.Logical 2019-12-29 10:15:36
Link | Citer | R
 
Phoenix.Logical said: »
Bismarck.Xurion said: »
The self_command function receives a single argument of anything you type after the //gs c. With this you can split the string:
Code
tp_mode = 'normal'
mb_mode = 'normal'
 
function self_command(command)
  local args = split_args(command)
  if args[1] == 'tp' then
    tp_mode = args[2]
  elseif args[1] == 'mb' then
    mb_mode = args[2]
  end
end

function split_args(args)
  fields = {}
  args:gsub("([^ ]*) ?", function(c)
   table.insert(fields, c)
  end)
  return fields
end


Then you can use:
Code
//gs c tp dw40
//gs c mb burst


Note that I went with spaces between commands/args instead of slashes, as this is the most common pattern.

Perfect! Thanks again!!!

So I've implemented this into my script in the way that I think is correct and sadly it's not working. The tp_mode still works great and is now receiving commands properly though the gs c tp XXX command. However, once I tried to add the mb_mode code to my midcast for the elemental ninjutsu the midcast part stopped working entirely on all my elemental ninjutsu. Mind taking a look and seeing if it's obvious where I made my error? Thanks!
Code
	--  Welcome to Logical's Ninja Lua.  This Lua is used for changing gear during precast and midcast and then swapping to the appropriate set for aftercast.
	--  It will also cancel shadows for you when necessary to recast new shadows.
	--  Please refer to my video on my NextGames YouTube channel for how to properly utilize this LUA.  

	-- This is what sets the initial set that you normally want to be in by default.
	tp_mode = 'dw0'
    mb_mode = 'mbnin'
	
function self_command(command)
  local args = split_args(command)
  if args[1] == 'tp' then
    tp_mode = args[2]
  elseif args[1] == 'mb' then
    mb_mode = args[2]
  end
end
 
function split_args(args)
  fields = {}
  args:gsub("([^ ]*) ?", function(c)
   table.insert(fields, c)
  end)
  return fields
end

function get_sets()

	-- This is where we will define our precast sets.  These are sets of gear that get equiped BEFORE the spell or ability is used.
	sets.precast = {}
	sets.precast.fc = {
		ammo="Sapience Orb",
		head={ name="Herculean Helm", augments={'Accuracy+13','"Fast Cast"+6',}},
		body="Dread Jupon",
		hands={ name="Leyline Gloves", augments={'Accuracy+15','Mag. Acc.+15','"Mag.Atk.Bns."+15','"Fast Cast"+3',}},
		legs="Gyve Trousers",
		feet={ name="Herculean Boots", augments={'Crit. hit damage +1%','"Fast Cast"+4','"Treasure Hunter"+2',}},
		neck="Baetyl Pendant",
		waist="Oneiros Belt",
		left_ear="Loquac. Earring",
		right_ear="Odnowa Earring +1",
		left_ring="Kishar Ring",
		right_ring="Rahab Ring",
		back={ name="Andartia's Mantle", augments={'AGI+20','Eva.+20 /Mag. Eva.+20','Mag. Evasion+10','"Fast Cast"+10','Damage taken-5%',}},
	}
	sets.precast.utsusemi = {
		ammo="Staunch Tathlum +1",
		head={ name="Herculean Helm", augments={'Accuracy+13','"Fast Cast"+6',}},
		body={ name="Mochi. Chainmail +3", augments={'Enhances "Sange" effect',}},
		hands={ name="Leyline Gloves", augments={'Accuracy+15','Mag. Acc.+15','"Mag.Atk.Bns."+15','"Fast Cast"+3',}},
		legs="Malignance Tights",
		feet="Hattori Kyahan +1",
		neck="Magoraga Beads",
		waist="Oneiros Belt",
		left_ear="Loquac. Earring",
		right_ear="Odnowa Earring +1",
		left_ring="Kishar Ring",
		right_ring="Meridian Ring",
		back={ name="Andartia's Mantle", augments={'AGI+20','Eva.+20 /Mag. Eva.+20','Mag. Evasion+10','"Fast Cast"+10','Damage taken-5%',}},
	}
	
	-- This is where we will define our midcast sets.  These are sets of gear that get equiped BEFORE the spell or ability lands.
	sets.midcast = {}
	sets.midcast.utsusemi = {
	}
	sets.midcast.elenin = {
		ammo="Ghastly Tathlum +1",
		head={ name="Mochi. Hatsuburi +3", augments={'Enhances "Yonin" and "Innin" effect',}},
		body={ name="Samnuha Coat", augments={'Mag. Acc.+5','"Mag.Atk.Bns."+6',}},
		hands={ name="Leyline Gloves", augments={'Accuracy+15','Mag. Acc.+15','"Mag.Atk.Bns."+15','"Fast Cast"+3',}},
		legs="Gyve Trousers",
		feet={ name="Mochi. Kyahan +3", augments={'Enh. Ninj. Mag. Acc/Cast Time Red.',}},
		neck="Baetyl Pendant",
		waist="Orpheus's Sash",
		left_ear="Hecate's Earring",
		right_ear="Friomisi Earring",
		left_ring="Shiva Ring +1",
		right_ring="Shiva Ring +1",
		back={ name="Andartia's Mantle", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','Magic Damage +10','"Mag.Atk.Bns."+10',}},
	}
	
	sets.midcast.mbnin = {
		ammo="Ghastly Tathlum +1",
		head={ name="Mochi. Hatsuburi +3", augments={'Enhances "Yonin" and "Innin" effect',}},
		body={ name="Samnuha Coat", augments={'Mag. Acc.+5','"Mag.Atk.Bns."+6',}},
		hands={ name="Herculean Gloves", augments={'"Mag.Atk.Bns."+24','Magic burst dmg.+6%','INT+8',}},
		legs={ name="Herculean Trousers", augments={'"Mag.Atk.Bns."+24','Magic burst dmg.+8%','Mag. Acc.+15',}},
		feet={ name="Mochi. Kyahan +3", augments={'Enh. Ninj. Mag. Acc/Cast Time Red.',}},
		neck="Baetyl Pendant",
		waist="Orpheus's Sash",
		left_ear="Static Earring",
		right_ear="Friomisi Earring",
		left_ring="Locus Ring",
		right_ring="Mujin Band",
		back={ name="Andartia's Mantle", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','Magic Damage +10','"Mag.Atk.Bns."+10',}},
	}
	
	sets.midcast.enfnin = {
	    ammo="Yamarang",
		head="Hachiya Hatsu. +3",
		body="Malignance Tabard",
		hands="Malignance Gloves",
		legs="Malignance Tights",
		feet="Hachiya Kyahan +3",
		neck="Incanter's Torque",
		waist="Eschan Stone",
		left_ear="Hermetic Earring",
		right_ear="Gwati Earring",
		left_ring="Stikini Ring",
		right_ring="Stikini Ring +1",
		back={ name="Andartia's Mantle", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','Magic Damage +10','"Mag.Atk.Bns."+10',}},
	}
	
	sets.midcast.enmity = {
	    ammo="Sapience Orb",
		head={ name="Naga Somen", augments={'HP+50','VIT+10','Evasion+20',}},
		body="Emet Harness +1",
		hands="Kurys Gloves",
		legs="Zoar Subligar +1",
		feet={ name="Mochi. Kyahan +3", augments={'Enh. Ninj. Mag. Acc/Cast Time Red.',}},
		neck="Unmoving Collar +1",
		waist="Trance Belt",
		left_ear="Trux Earring",
		right_ear="Cryptic Earring",
		left_ring="Supershear Ring",
		right_ring="Begrudging Ring",
		back={ name="Andartia's Mantle", augments={'Enmity+10',}},
	}
	
	sets.midcast.waltz = {
	    ammo="Yamarang",
		head="Mummu Bonnet +2",
		left_ring="Valseur's Ring",
	}

	sets.midcast.migawari = {
		-- Lowers Activation to ~50% insead of approx ~62%.  Default is disabled. -- body="Hattori nigi +1",
	}

	sets.midcast.bladehi = {
	    ammo="Yetshila +1",
		head="Hachiya Hatsu. +3",
		body="Mummu Jacket +2",
		hands="Mummu Wrists +2",
		legs={ name="Mochi. Hakama +3", augments={'Enhances "Mijin Gakure" effect',}},
		feet="Mummu Gamash. +2",
		neck="Fotia Gorget",
		waist="Fotia Belt",
		left_ear="Ishvara Earring",
		right_ear="Odr Earring",
		left_ring="Mummu Ring",
		right_ring="Begrudging Ring",
		back={ name="Andartia's Mantle", augments={'AGI+20','Accuracy+20 Attack+20','AGI+10','Weapon skill damage +10%',}},
	}
	
	sets.midcast.blademetsu = {
	    ammo="Date Shuriken",
		head="Hachiya Hatsu. +3",
		body={ name="Herculean Vest", augments={'Weapon skill damage +5%','STR+9','Attack+13',}},
		hands={ name="Herculean Gloves", augments={'Accuracy+10','Weapon skill damage +5%','Attack+10',}},
		legs={ name="Mochi. Hakama +3", augments={'Enhances "Mijin Gakure" effect',}},
		feet={ name="Herculean Boots", augments={'Weapon skill damage +5%','AGI+9','Accuracy+13',}},
		neck="Fotia Gorget",
		waist="Fotia Belt",
		left_ear="Ishvara Earring",
		right_ear="Odr Earring",
		left_ring="Epaminondas's Ring",
		right_ring="Ilabrat Ring",
		back={ name="Andartia's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%',}},
	}
	
	sets.midcast.bladeshun = {
		ammo="Date Shuriken",
		head="Ken. Jinpachi +1",
		body={ name="Adhemar Jacket +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
		hands="Ken. Tekko +1",
		legs="Jokushu Haidate",
		feet="Ken. Sune-Ate +1",
		neck="Fotia Gorget",
		waist="Fotia Belt",
		left_ear="Mache Earring +1",
		right_ear="Odr Earring",
		left_ring="Epaminondas's Ring",
		right_ring="Ilabrat Ring",
		back={ name="Andartia's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},
	}
	
	sets.midcast.bladeten = {
	    ammo="Date Shuriken",
		head="Hachiya Hatsu. +3",
		body={ name="Herculean Vest", augments={'Weapon skill damage +5%','STR+9','Attack+13',}},
		hands={ name="Herculean Gloves", augments={'Accuracy+10','Weapon skill damage +5%','Attack+10',}},
		legs={ name="Mochi. Hakama +3", augments={'Enhances "Mijin Gakure" effect',}},
		feet={ name="Herculean Boots", augments={'Weapon skill damage +5%','AGI+9','Accuracy+13',}},
		neck="Ninja Nodowa +2",
		waist="Grunfeld Rope",
		left_ear="Ishvara Earring",
		right_ear="Odr Earring",
		left_ring="Epaminondas's Ring",
		right_ring="Karieyh Ring",
		back={ name="Andartia's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},
	}
	
	sets.midcast.bladechi = {
	    ammo="Seeth. Bomblet +1",
		head={ name="Mochi. Hatsuburi +3", augments={'Enhances "Yonin" and "Innin" effect',}},
		body={ name="Samnuha Coat", augments={'Mag. Acc.+5','"Mag.Atk.Bns."+6',}},
		hands={ name="Leyline Gloves", augments={'Accuracy+15','Mag. Acc.+15','"Mag.Atk.Bns."+15','"Fast Cast"+3',}},
		legs="Gyve Trousers",
		feet="Hachiya Kyahan +3",
		neck="Baetyl Pendant",
		waist="Orpheus's Sash",
		left_ear="Novio Earring",
		right_ear="Friomisi Earring",
		left_ring="Shiva Ring +1",
		right_ring="Dingir Ring",
		back={ name="Andartia's Mantle", augments={'STR+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','Weapon skill damage +10%',}},
	}
		
	-- This is where we will define our aftercast sets.  These are sets of gear that get equiped AFTER the spell or ability is used.  Normally this is used to put you back into your current TP set.
	sets.aftercast = {}
	sets.aftercast.dw40 = {
	    ammo="Seki Shuriken",
		head={ name="Ryuo Somen +1", augments={'HP+65','"Store TP"+5','"Subtle Blow"+8',}},
		body={ name="Mochi. Chainmail +3", augments={'Enhances "Sange" effect',}},
		hands={ name="Floral Gauntlets", augments={'Rng.Acc.+15','Accuracy+15','"Triple Atk."+3','Magic dmg. taken -4%',}},
		legs={ name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
		feet="Hiza. Sune-Ate +2",
		neck="Ninja Nodowa +2",
		waist="Windbuffet Belt +1",
		left_ear="Suppanomimi",
		right_ear="Eabani Earring",
		left_ring="Chirich Ring +1",
		right_ring="Epona's Ring",
		back={ name="Andartia's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},
	}
	
	sets.aftercast.dw20 = {
	    ammo="Seki Shuriken",
		head={ name="Ryuo Somen +1", augments={'HP+65','"Store TP"+5','"Subtle Blow"+8',}},
		body={ name="Adhemar Jacket +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
		hands={ name="Floral Gauntlets", augments={'Rng.Acc.+15','Accuracy+15','"Triple Atk."+3','Magic dmg. taken -4%',}},
		legs={ name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
		feet={ name="Herculean Boots", augments={'Accuracy+20','"Triple Atk."+4',}},
		neck="Ninja Nodowa +2",
		waist="Windbuffet Belt +1",
		left_ear="Cessance Earring",
		right_ear="Brutal Earring",
		left_ring="Chirich Ring +1",
		right_ring="Epona's Ring",
		back={ name="Andartia's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},
	}

	sets.aftercast.dw0 = {
		ammo="Happo Shuriken +1",
		head="Ken. Jinpachi +1",
		body="Ken. Samue +1",
		hands="Ken. Tekko +1",
		legs="Ken. Hakama +1",
		feet="Ken. Sune-Ate +1",
		neck="Ninja Nodowa +2",
		waist="Windbuffet Belt +1",
		left_ear="Cessance Earring",
		right_ear="Brutal Earring",
		left_ring="Hetairoi Ring",
		right_ring="Epona's Ring",
		back={ name="Andartia's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},
	}
	sets.aftercast.accuracy = {
	    ammo="Yamarang",
		head="Ken. Jinpachi +1",
		body="Ken. Samue +1",
		hands="Ken. Tekko +1",
		legs="Ken. Hakama +1",
		feet="Ken. Sune-Ate +1",
		neck="Ninja Nodowa +2",
		waist="Olseni Belt",
		left_ear="Mache Earring +1",
		right_ear="Mache Earring +1",
		left_ring="Chirich Ring +1",
		right_ring="Chirich Ring +1",
		back={ name="Andartia's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},
	}

	sets.aftercast.evasion = {
	    ammo="Yamarang",
		head="Malignance Chapeau",
		body="Malignance Tabard",
		hands="Malignance Gloves",
		legs="Malignance Tights",
		feet="Malignance Boots",
		neck="Combatant's Torque",
		waist="Nesanica Belt",
		left_ear="Infused Earring",
		right_ear="Eabani Earring",
		left_ring="Portus Annulet",
		right_ring="Chirich Ring +1",
		back={ name="Andartia's Mantle", augments={'AGI+20','Eva.+20 /Mag. Eva.+20','Mag. Evasion+10','"Fast Cast"+10','Damage taken-5%',}},
	}
	
	sets.aftercast.magicdef = {
	    ammo="Date Shuriken",
		head="Ken. Jinpachi +1",
		body="Ken. Samue +1",
		hands="Ken. Tekko +1",
		legs="Ken. Hakama +1",
		feet="Ken. Sune-Ate +1",
		neck="Twilight Torque",
		waist="Windbuffet Belt +1",
		left_ear="Odnowa Earring +1",
		right_ear="Brutal Earring",
		left_ring="Defending Ring",
		right_ring="Epona's Ring",
		back={ name="Andartia's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},
	}
	
	sets.aftercast.magiceva = {
	    ammo="Staunch Tathlum +1",
		head="Malignance Chapeau",
		body="Malignance Tabard",
		hands="Malignance Gloves",
		legs="Malignance Tights",
		feet="Malignance Boots",
		neck="Warder's Charm +1",
		waist="Engraved Belt",
		left_ear="Sanare Earring",
		right_ear="Eabani Earring",
		left_ring="Purity Ring",
		right_ring="Vengeful Ring",
		back={ name="Andartia's Mantle", augments={'AGI+20','Eva.+20 /Mag. Eva.+20','Mag. Evasion+10','"Fast Cast"+10','Damage taken-5%',}},
	}
end

-----------------------------------------------------------------------------------
  -- This is the precast section.  It is used for things you want to happen before you start to start to use the ability or spell.
  function precast(spell, act)

	if spell.english:startswith('Utsusemi') then
		equip(sets.precast.utsusemi)
	end

	if spell.english:startswith('Monomi') then
		equip (sets.precast.fc)
	end

	if spell.english:startswith('Tonko') then
		equip (sets.precast.fc)
	end
	
	if spell.english:startswith('Gekka') then
		equip (sets.precast.fc)
	end

	if spell.english:startswith('Yain') then
		equip (sets.precast.fc)
	end
	
	if spell.english:startswith('Kakka') then
		equip (sets.precast.fc)
	end

	if spell.english:startswith('Myoshu') then
		equip (sets.precast.fc)
	end

	if spell.english:startswith('Migawari') then
		equip (sets.precast.fc)
	end
	
	if spell.english:startswith('Yurin') then
		equip (sets.precast.fc)
	end
	
	if spell.english:startswith('Dokumori') then
		equip (sets.precast.fc)
	end

	if spell.english:startswith('Aisha') then
		equip (sets.precast.fc)
	end

	if spell.english:startswith('Kurayami') then
		equip (sets.precast.fc)
	end
	
	if spell.english:startswith('Hojo') then
		equip (sets.precast.fc)
	end

	if spell.english:startswith('Jubaku') then
		equip (sets.precast.fc)
	end

	if spell.english:startswith('Katon') then
		equip(sets.precast.fc)
	end

	if spell.english:startswith('Hyoton') then
		equip(sets.precast.fc)
	end
	
	if spell.english:startswith('Huton') then
		equip(sets.precast.fc)
	end

	if spell.english:startswith('Doton') then
		equip(sets.precast.fc)
	end

	if spell.english:startswith('Raiton') then
		equip(sets.precast.fc)
	end
	
	if spell.english:startswith('Suiton') then
		equip(sets.precast.fc)
	end
	
	if spell.type == "Trust" then
		equip(sets.precast.fc)
	end
	
end

-----------------------------------------------------------------------------------
  -- This is the midcast section.  It is used to designate gear that you want on as the ability or spell is used.
function midcast(spell, act)

	-- The below command is used to cancel old shadows if they can not be overwritten by the newly cased Utsusemi.
	if spell.english:startswith('Utsusemi') then
		if buffactive['Copy Image'] then
			send_command('cancel 66')
		elseif buffactive['Copy Image (2)'] then 
			send_command('cancel 444')
		elseif buffactive['Copy Image (3)'] then
			send_command('cancel 445')
		elseif buffactive['Copy Image (4+)'] then
			send_command('cancel 446')
		end
	end

	if spell.english:startswith('Utsusemi') then
		equip(sets.precast.utsusemi)
	end

	if spell.english == "Provoke" then
		equip (sets.midcast.enmity)
	end

	if spell.english == "Warcry" then
		equip (sets.midcast.enmity)
	end

	if spell.english == "Animated Flourish" then
		equip (sets.midcast.enmity)
	end

	if spell.english == "Violent Flourish" then
		equip (sets.midcast.enfnin)
	end

	if spell.english:startswith('Curing') then
		equip (sets.midcast.waltz)
	end

	if spell.english == "Divine Waltz" then
		equip (sets.midcast.waltz)
	end
	
	if spell.english:startswith('Migawari') then
		equip (sets.midcast.migawari)
	end
	
	if spell.english:startswith('Kurayami') then
		equip (sets.midcast.enfnin)
	end

	if spell.english:startswith('Hojo') then
		equip (sets.midcast.enfnin)
	end

	if spell.english:startswith('Jubaku') then
		equip (sets.midcast.enfnin)
	end

	if spell.english:startswith('Katon') then
		set = sets.midcast
		if set[mb_mode] then
			set = set[mb_mode]
		end
		equip(set)
	end

	if spell.english:startswith('Hyoton') then
		set = sets.midcast
		if set[mb_mode] then
			set = set[mb_mode]
		end
		equip(set)
	end

	if spell.english:startswith('Huton') then
		set = sets.midcast
		if set[mb_mode] then
			set = set[mb_mode]
		end
		equip(set)
	end

	if spell.english:startswith('Doton') then
		set = sets.midcast
		if set[mb_mode] then
			set = set[mb_mode]
		end
		equip(set)
	end

	if spell.english:startswith('Raiton') then
		set = sets.midcast
		if set[mb_mode] then
			set = set[mb_mode]
		end
		equip(set)
	end

	if spell.english:startswith('Suiton')then
		set = sets.midcast
		if set[mb_mode] then
			set = set[mb_mode]
		end
		equip(set)
	end
	
	if spell.english == "Blade: Hi" then
		equip (sets.midcast.bladehi)
	end

	if spell.english == "Blade: Metsu" then
		equip (sets.midcast.blademetsu)
	end

	if spell.english == "Blade: Shun" then
		equip (sets.midcast.bladeshun)
	end

	if spell.english == "Blade: Ten" then
		equip (sets.midcast.bladeten)
	end
	
	if spell.english == "Blade: Chi" then
		equip (sets.midcast.bladechi)
	end
	
	if spell.type == "Trust" then
		equip(sets.precast.fc)
	end
end

-----------------------------------------------------------------------------------

	-- This section is the aftercast section that makes it so that after any of the above abilities you get put back into the correct gearset.
	-- You can create tp_mode gearsets for ANY purpose.  Just make sure you label them correctly.  All must be in the sets.aftercast section.  For instance sets.aftercast.dw40.
	-- Don't forget to create a new gearset section defining the gear you want in it if you don't want to use my predefined sets.  Ie create a gearset for sets.aftercast.storetp.
function aftercast(spell, act, spellMap, eventArgs)
    set = sets.aftercast
	if set[tp_mode] then
		set = set[tp_mode]
	end
	equip(set)
end

 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2019-12-29 13:08:06
Link | Citer | R
 
I can't see anything incorrect. I'd put in some print statements to debug what's happening. I did load your script and each line seems to be executed as I expected.
 Phoenix.Logical
Offline
Serveur: Phoenix
Game: FFXI
Posts: 519
By Phoenix.Logical 2019-12-29 13:13:53
Link | Citer | R
 
Bismarck.Xurion said: »
I can't see anything incorrect. I'd put in some print statements to debug what's happening. I did load your script and each line seems to be executed as I expected.

Understood. I'll see where print statements lead. Thanks for looking it over!
[+]
 Phoenix.Logical
Offline
Serveur: Phoenix
Game: FFXI
Posts: 519
By Phoenix.Logical 2019-12-29 14:17:40
Link | Citer | R
 
Bismarck.Xurion said: »
I can't see anything incorrect. I'd put in some print statements to debug what's happening. I did load your script and each line seems to be executed as I expected.

Played with it a little more and did some print statements and parsers and it does appear to be working.

However in the process of doing that I've run into an alarming issue. The whole reason I was doing this was so that my fastcast set would be equipped for precast before my midcast elemental ninjutsu. However, in my initial test I'm showing that almost always not all of my precast fast cast gear is getting equipped before it switched to midcast. This makes it so my ninjutsu timers are anywhere from 33-45 seconds for San when it should be 30 seconds every time with my full set equipped. The same happens with my Ni and Ichi spells as well. I thought the whole point of gearswap was that it changed this gear through packets which made it so that it more reliably changed this gear, am I missing something here? Is this a normal behavior I'm witnessing?
 Phoenix.Uzugami
Offline
Serveur: Phoenix
Game: FFXI
user: SSJAV
By Phoenix.Uzugami 2020-01-05 17:00:22
Link | Citer | R
 
How do I setup an aftercast set? I'm trying to get Ask Sash to equip after using Boost, but it currently goes to an aftercast set, then equips the sash, is that how it should work or am I just missing the proper way to define an aftercast?
Here's the lua
Code
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job.  Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------

--Shamelessly lifted from GEO_Lib--
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

set_macros(1,1) -- Sheet, Book

-- Initialization function for this job file.
function get_sets()
    mote_include_version = 2
    
    -- Load and initialize the include file.
    include('Mote-Include.lua')
end


-- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
function job_setup()
    state.Buff.Footwork = buffactive.Footwork or false
    state.Buff.Impetus = buffactive.Impetus or false
	state.Buff.Boost = buffactive.Boost or false

    state.FootworkWS = M(false, 'Footwork on WS')

    info.impetus_hit_count = 0
    windower.raw_register_event('action', on_action_for_impetus)
end


-------------------------------------------------------------------------------------------------------------------
-- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
-------------------------------------------------------------------------------------------------------------------

-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
function user_setup()
    state.OffenseMode:options('Normal', 'SomeAcc', 'Acc', 'Fodder')
    state.WeaponskillMode:options('Normal', 'SomeAcc', 'Acc', 'Fodder')
    state.HybridMode:options('Normal', 'PDT', 'Counter')
    state.PhysicalDefenseMode:options('PDT', 'HP')

    update_combat_form()
    update_melee_groups()

    --select_default_macro_book()
end


-- Define sets and vars used by this job file.
function init_gear_sets()
    --------------------------------------
    -- Start defining the sets
    --------------------------------------
    
    -- Precast Sets
    
    -- Precast sets to enhance JAs on use
    sets.precast.JA['Hundred Fists'] = {legs="Hesychast's Hose +3"}
    sets.precast.JA['Boost'] = {hands="Anchorite's Gloves +3",waist="Ask Sash",}
    sets.precast.JA['Dodge'] = {feet="Anchorite's Gaiters +3"}
    sets.precast.JA['Focus'] = {head="Anchorite's Crown"}
    sets.precast.JA['Counterstance'] = {feet="Hesychast's Gaiters +1"}
    sets.precast.JA['Footwork'] = {feet="Tantra Gaiters +2"}
    sets.precast.JA['Formless Strikes'] = {body="Hesychast's Cyclas"}
    sets.precast.JA['Mantra'] = {feet="Hesychast's Gaiters +1"}

    sets.precast.JA['Chi Blast'] = {
        head="Melee Crown +2",
        body="Otronif Harness +1",hands="Hesychast's Gloves +1",
        back="Tuilha Cape",legs="Hesychast's Hose +3",feet="Anchorite's Gaiters +3"}

    sets.precast.JA['Chakra'] = {ammo="Iron Gobbet",
        head="Felistris Mask",
        body="Anchorite's Cyclas +3",hands="Melee Gloves +2",ring1="Spiral Ring",
        back="Iximulew Cape",waist="Caudata Belt",legs="Qaaxo Tights",feet="Thurandaut Boots +1"}

    -- Waltz set (chr and vit)
    sets.precast.Waltz = {ammo="Sonia's Plectrum",
        head="Felistris Mask",
        body="Otronif Harness +1",hands="Hesychast's Gloves +1",ring1="Spiral Ring",
        back="Iximulew Cape",waist="Caudata Belt",legs="Qaaxo Tights",feet="Otronif Boots +1"}
        
    -- Don't need any special gear for Healing Waltz.
    sets.precast.Waltz['Healing Waltz'] = {}

    sets.precast.Step = {waist="Chaac Belt"}
    sets.precast.Flourish1 = {waist="Chaac Belt"}


    -- Fast cast sets for spells
    
    sets.precast.FC = {ammo="Impatiens",head="Haruspex hat",ear2="Loquacious Earring",hands="Thaumas Gloves"}

    sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck="Magoraga Beads"})

       
    -- Weaponskill sets
    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS = {ammo="Knobkierrie",
		head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hiza. Hizayoroi +2",
		feet={ name="Herculean Boots", augments={'Accuracy+20','"Triple Atk."+4',}},
		neck="Fotia Gorget",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Moonshade Earring",
		left_ring="Epona's Ring",
		right_ring="Niqmaddu Ring",
		back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','"Dbl.Atk."+10',}},}
    sets.precast.WSAcc = {}
    --sets.precast.WSMod = {feet={ name="Herculean Boots", augments={'Accuracy+11','Crit. hit damage +3%','STR+5','Attack+13',}},}
	sets.precast.WSMod = {feet="Anchorite's Gaiters +3"}
    sets.precast.MaxTP = {ear1="Sherida Earring",ear2="Brutal Earring"}
    sets.precast.WS.Acc = set_combine(sets.precast.WS, sets.precast.WSAcc)
    sets.precast.WS.Mod = set_combine(sets.precast.WS, sets.precast.WSMod)

    -- Specific weaponskill sets.
    
    -- legs={name="Quiahuiz Trousers", augments={'Phys. dmg. taken -2%','Magic dmg. taken -2%','STR+8'}}}

    sets.precast.WS['Raging Fists']    = set_combine(sets.precast.WS,{neck="Monk's Nodowa +2",hands="Anchorite's Gloves +3",legs="Hiza. Hizayoroi +2",})
    sets.precast.WS['Howling Fist']    = set_combine(sets.precast.WS, {neck="Monk's Nodowa +2",hands="Anchorite's Gloves +3",legs="Hiza. Hizayoroi +2",right_ring="Ilabrat Ring"})
    sets.precast.WS['Asuran Fists']    = set_combine(sets.precast.WS, {neck="Monk's Nodowa +2",hands="Anchorite's Gloves +3",legs="Hiza. Hizayoroi +2",left_ring="Regal Ring"})
    sets.precast.WS["Ascetic's Fury"]  = set_combine(sets.precast.WS, {body="Anchorite's Cyclas +3",hands={ name="Ryuo Tekko +1", augments={'STR+12','DEX+12','Accuracy+20',}},legs="Hiza. Hizayoroi +2",left_ring="Begrudging Ring",feet={ name="Herculean Boots", augments={'Accuracy+11','Crit. hit damage +3%','STR+5','Attack+13',}},})
    sets.precast.WS["Victory Smite"]   = set_combine(sets.precast.WS, {body="Anchorite's Cyclas +3",neck="Monk's Nodowa +2",hands={ name="Ryuo Tekko +1", augments={'STR+12','DEX+12','Accuracy+20',}},legs="Hiza. Hizayoroi +2",left_ring="Begrudging Ring",feet={ name="Herculean Boots", augments={'Accuracy+11','Crit. hit damage +3%','STR+5','Attack+13',}},})
    sets.precast.WS['Shijin Spiral']   = set_combine(sets.precast.WS,{right_ear="Brutal Earring",hands="Anchorite's Gloves +3",left_ring="Ilabrat Ring",legs="Hiza. Hizayoroi +2",back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},})
    sets.precast.WS['Dragon Kick']     = set_combine(sets.precast.WS,{feet="Anchorite's Gaiters +3"})
    sets.precast.WS['Tornado Kick']    = set_combine(sets.precast.WS,{neck="Monk's Nodowa +2",feet="Anchorite's Gaiters +3"})
    sets.precast.WS['Spinning Attack'] = set_combine(sets.precast.WS)

    sets.precast.WS["Raging Fists"].Acc = set_combine(sets.precast.WS["Raging Fists"], sets.precast.WSAcc)
    sets.precast.WS["Howling Fist"].Acc = set_combine(sets.precast.WS["Howling Fist"], sets.precast.WSAcc)
    sets.precast.WS["Asuran Fists"].Acc = set_combine(sets.precast.WS["Asuran Fists"], sets.precast.WSAcc)
    sets.precast.WS["Ascetic's Fury"].Acc = set_combine(sets.precast.WS["Ascetic's Fury"], sets.precast.WSAcc)
    sets.precast.WS["Victory Smite"].Acc = set_combine(sets.precast.WS["Victory Smite"], sets.precast.WSAcc)
    sets.precast.WS["Shijin Spiral"].Acc = set_combine(sets.precast.WS["Shijin Spiral"], sets.precast.WSAcc)
    sets.precast.WS["Dragon Kick"].Acc = set_combine(sets.precast.WS["Dragon Kick"], sets.precast.WSAcc)
    sets.precast.WS["Tornado Kick"].Acc = set_combine(sets.precast.WS["Tornado Kick"], sets.precast.WSAcc)

    sets.precast.WS["Raging Fists"].Mod = set_combine(sets.precast.WS["Raging Fists"], sets.precast.WSMod)
    sets.precast.WS["Howling Fist"].Mod = set_combine(sets.precast.WS["Howling Fist"], sets.precast.WSMod)
    sets.precast.WS["Asuran Fists"].Mod = set_combine(sets.precast.WS["Asuran Fists"], sets.precast.WSMod)
    sets.precast.WS["Ascetic's Fury"].Mod = set_combine(sets.precast.WS["Ascetic's Fury"], sets.precast.WSMod)
    sets.precast.WS["Victory Smite"].Mod = set_combine(sets.precast.WS["Victory Smite"], sets.precast.WSMod)
    sets.precast.WS["Shijin Spiral"].Mod = set_combine(sets.precast.WS["Shijin Spiral"], sets.precast.WSMod)
    sets.precast.WS["Dragon Kick"].Mod = set_combine(sets.precast.WS["Dragon Kick"], sets.precast.WSMod)
    sets.precast.WS["Tornado Kick"].Mod = set_combine(sets.precast.WS["Tornado Kick"], sets.precast.WSMod)


    sets.precast.WS['Cataclysm'] = {
        ammo="Ginsen",
		head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Samnuha Tights",
		feet={ name="Herculean Boots", augments={'Accuracy+25','"Triple Atk."+4','DEX+10',}},
		neck="Fotia Gorget",
		waist="Moonbow Belt +1",
		left_ear="Brutal Earring",
		right_ear="Moonshade Earring",
		left_ring="Epona's Ring",
		right_ring="Rajas Ring",
		back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},}
    
    
    -- Midcast Sets
    sets.midcast.FastRecast = {
        ear2="Loquacious Earring",}
        
    -- Specific spells
    sets.midcast.Utsusemi = {
        ear2="Loquacious Earring",}
	sets.phalanx = {head={ name="Herculean Helm", augments={'Pet: STR+3','VIT+3','Phalanx +2','Accuracy+20 Attack+20','Mag. Acc.+16 "Mag.Atk.Bns."+16',}},
						feet={ name="Herculean Boots", augments={'Rng.Acc.+22 Rng.Atk.+22','Accuracy+2','Phalanx +5',}},}	

    
    -- Sets to return to when not performing an action.
    
    -- Resting sets
    sets.resting = {}
    

    -- Idle sets
    sets.idle = {ammo="Ginsen",
		head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Hermes' Sandals",
		neck="Sanctity Necklace",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Epona's Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}

    sets.idle.Town = {ammo="Ginsen",
		head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Hermes' Sandals",
		neck="Sanctity Necklace",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Epona's Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    
    sets.idle.Weak = {ammo="Ginsen",
		head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Hermes' Sandals",
		neck="Sanctity Necklace",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Epona's Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    
    -- Defense sets
    sets.defense.PDT = {ammo="Staunch Tathlum +1",
		head="Malignance Chapeau",
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet={ name="Herculean Boots", augments={'Accuracy+20','"Triple Atk."+4',}},
		neck="Twilight Torque",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Vocane Ring +1",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}

    sets.defense.HP = {ammo="Ginsen",
		head="Malignance Chapeau",
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet={ name="Herculean Boots", augments={'Accuracy+20','"Triple Atk."+4',}},
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Epona's Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}

    sets.defense.MDT = {ammo="Staunch Tathlum +1",
		head="Malignance Chapeau",
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet={ name="Herculean Boots", augments={'Accuracy+20','"Triple Atk."+4',}},
		neck="Twilight Torque",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Shadow Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}

    sets.Kiting = {feet="Hermes' Sandals"}

    sets.ExtraRegen = {}
	
	sets.Boost = {
		waist="Ask Sash",
	}

    -- Engaged sets

    -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
    -- sets if more refined versions aren't defined.
    -- If you create a set with both offense and defense modes, the offense mode should be first.
    -- EG: sets.engaged.Dagger.Accuracy.Evasion
    
    -- Normal melee sets
    sets.engaged = {ammo="Ginsen",
		head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Epona's Ring",
		right_ring="Niqmaddu Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.SomeAcc = {ammo="Ginsen",
		head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
		--body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Epona's Ring",
		right_ring="Niqmaddu Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Acc = {ammo="Falcon Eye",
		head="Malignance Chapeau",
		body="Anchorite's Cyclas +3",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Regal Ring",
		right_ring="Niqmaddu Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Mod = {ammo="Falcon Eye",
		head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
		--body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Ilabrat Ring",
		right_ring="Niqmaddu Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
	sets.engaged.Boost = {
		waist="Ask Sash",
	}
    -- Defensive melee hybrid sets
    sets.engaged.PDT = {ammo="Staunch Tathlum +1",
		head="Malignance Chapeau",
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Niqmaddu Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.SomeAcc.PDT = {ammo="Staunch Tathlum +1",
		head="Malignance Chapeau",
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Cessance Earring",
		left_ring="Niqmaddu Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Acc.PDT = {ammo="Staunch Tathlum +1",
		head="Malignance Chapeau",
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Cessance Earring",
		left_ring="Niqmaddu Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Counter = {ammo="Ginsen",
		head="Malignance Chapeau",
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Telos Earring",
		left_ring="Niqmaddu Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Acc.Counter = {ammo="Ginsen",
		head="Malignance Chapeau",
		body="Ken. Samue +1",
		hands="Adhemar Wrist. +1",
		legs="Hesychast's Hose +3",
		feet="Anchorite's Gaiters +3",
		neck="Monk's Nodowa +2",
		waist="Moonbow Belt +1",
		left_ear="Sherida Earring",
		right_ear="Cessance Earring",
		left_ring="Niqmaddu Ring",
		right_ring="Defending Ring",
		back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10','System: 1 ID: 640 Val: 4',}},}


    -- Hundred Fists/Impetus melee set mods
	sets.engaged.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
    sets.engaged.HF = set_combine(sets.engaged)
    sets.engaged.HF.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
    sets.engaged.Acc.HF = set_combine(sets.engaged.Acc)
    sets.engaged.Acc.HF.Impetus = set_combine(sets.engaged.Acc, {body="Bhikku Cyclas +1"})
    sets.engaged.Counter.HF = set_combine(sets.engaged.Counter)
    sets.engaged.Counter.HF.Impetus = set_combine(sets.engaged.Counter, {body="Bhikku Cyclas +1"})
    sets.engaged.Acc.Counter.HF = set_combine(sets.engaged.Acc.Counter)
    sets.engaged.Acc.Counter.HF.Impetus = set_combine(sets.engaged.Acc.Counter, {body="Bhikku Cyclas +1"})
	sets.engaged.Boost = set_combine(sets.engaged, {waist="Ask Sash"})


    -- Footwork combat form
    --sets.engaged.Footwork = {};
    --sets.engaged.Footwork.Acc = {};
        
    -- Quick sets for post-precast adjustments, listed here so that the gear can be Validated.
    sets.impetus_body = {body="Bhikku Cyclas +1"}
    sets.footwork_kick_feet = {feet="Anchorite's Gaiters +3"}
end

-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------

-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_precast(spell, action, spellMap, eventArgs)
    -- Don't gearswap for weaponskills when Defense is on.
    if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
        eventArgs.handled = true
    end
end

-- Run after the general precast() is done.

function job_post_precast(spell, action, spellMap, eventArgs)      
        -- Replace Moonshade Earring if we're at cap TP
        if player.tp == 3000 then
            equip(sets.precast.MaxTP)
        end
    end

function job_aftercast(spell, action, spellMap, eventArgs)
    if spell.type == 'WeaponSkill' and not spell.interrupted and state.FootworkWS and state.Buff.Footwork then
        send_command('cancel Footwork')
    end
end

-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------

-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
     --Set Footwork as combat form any time it's active and Hundred Fists is not.
    if buff == 'Footwork' and gain and not buffactive['hundred fists'] then
        state.CombatForm:set('Footwork')
    elseif buff == "Hundred Fists" and not gain and buffactive.footwork then
        state.CombatForm:set('Footwork')
    else
        state.CombatForm:reset()
    	end
    
    -- Hundred Fists and Impetus modify the custom melee groups
    if buff == "Hundred Fists" or buff == "Impetus" or buff == "Boost" then
        classes.CustomMeleeGroups:clear()
        
        if (buff == "Hundred Fists" and gain) or buffactive['hundred fists'] then
            classes.CustomMeleeGroups:append('HF')
        end
        if (buff == "Impetus" and gain) or buffactive.impetus then
            classes.CustomMeleeGroups:append('Impetus')
        end
		if (buff == "Boost" and gain) or buffactive.boost then
			classes.CustomMeleeGroups:append('Boost')
		end
    end

    -- Update gear if any of the above changed
    if buff == "Hundred Fists" or buff == "Impetus" or buff == "Footwork" or buff == "Boost" then
        handle_equipping_gear(player.status)
    end
end


-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------

function customize_idle_set(idleSet)
	if buffactive['boost'] then
		idleSet = set_combine(idleSet, sets.Boost)
	end
    if player.hpp < 75 then
        idleSet = set_combine(idleSet, sets.ExtraRegen)
    end
    
    return idleSet
end

-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
    update_combat_form()
    update_melee_groups()
end


-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------

function update_combat_form()
    if buffactive.footwork and not buffactive['hundred fists'] then
        state.CombatForm:set('Footwork')
    else
        state.CombatForm:reset()
    end
end

function update_melee_groups()
    classes.CustomMeleeGroups:clear()
    
    if buffactive['hundred fists'] then
        classes.CustomMeleeGroups:append('HF')
    end
    
    if buffactive.impetus then
        classes.CustomMeleeGroups:append('Impetus')
    end
	if buffactive['boost'] then
		classes.CustomMeleeGroups:append('Boost')
	end
end


-- Select default macro book on initial load or subjob change.
--[[function select_default_macro_book()
    -- Default macro set/book
    if player.sub_job == 'DNC' then
        set_macro_page(8, 1)
    elseif player.sub_job == 'NIN' then
        set_macro_page(2, 1)
    elseif player.sub_job == 'THF' then
        set_macro_page(4, 1)
    elseif player.sub_job == 'RUN' then
        set_macro_page(1, 1)
    else
        set_macro_page(3, 1)
    end
end]]--


-------------------------------------------------------------------------------------------------------------------
-- Custom event hooks.
-------------------------------------------------------------------------------------------------------------------

-- Keep track of the current hit count while Impetus is up.
function on_action_for_impetus(action)
    if state.Buff.Impetus then
        -- count melee hits by player
        if action.actor_id == player.id then
            if action.category == 1 then
                for _,target in pairs(action.targets) do
                    for _,action in pairs(target.actions) do
                        -- Reactions (bitset):
                        -- 1 = evade
                        -- 2 = parry
                        -- 4 = block/guard
                        -- 8 = hit
                        -- 16 = JA/weaponskill?
                        -- If action.reaction has bits 1 or 2 set, it missed or was parried. Reset count.
                        if (action.reaction % 4) > 0 then
                            info.impetus_hit_count = 0
                        else
                            info.impetus_hit_count = info.impetus_hit_count + 1
                        end
                    end
                end
            elseif action.category == 3 then
                -- Missed weaponskill hits will reset the counter.  Can we tell?
                -- Reaction always seems to be 24 (what does this value mean? 8=hit, 16=?)
                -- Can't tell if any hits were missed, so have to assume all hit.
                -- Increment by the minimum number of weaponskill hits: 2.
                for _,target in pairs(action.targets) do
                    for _,action in pairs(target.actions) do
                        -- This will only be if the entire weaponskill missed or was parried.
                        if (action.reaction % 4) > 0 then
                            info.impetus_hit_count = 0
                        else
                            info.impetus_hit_count = info.impetus_hit_count + 2
                        end
                    end
                end
            end
        elseif action.actor_id ~= player.id and action.category == 1 then
            -- If mob hits the player, check for counters.
            for _,target in pairs(action.targets) do
                if target.id == player.id then
                    for _,action in pairs(target.actions) do
                        -- Spike effect animation:
                        -- 63 = counter
                        -- ?? = missed counter
                        if action.has_spike_effect then
                            -- spike_effect_message of 592 == missed counter
                            if action.spike_effect_message == 592 then
                                info.impetus_hit_count = 0
                            elseif action.spike_effect_animation == 63 then
                                info.impetus_hit_count = info.impetus_hit_count + 1
                            end
                        end
                    end
                end
            end
        end
        
        --add_to_chat(123,'Current Impetus hit count = ' .. tostring(info.impetus_hit_count))
    else
        info.impetus_hit_count = 0
    end
    
end
	
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2020-01-06 01:57:02
Link | Citer | R
 
Phoenix.Logical said: »
I'm showing that almost always not all of my precast fast cast gear is getting equipped before it switched to midcast.

How are you validating this is the case? Is it with //gs showswaps ? Remember that showswaps mode only reports gear that changes from one piece to another - it does not report gear that is already equipped.

Phoenix.Logical said: »
This makes it so my ninjutsu timers are anywhere from 33-45 seconds for San when it should be 30 seconds every time with my full set equipped.

Do you mean spell recast? If so, precast does not effect the recast of a spell. That's the responsibility of the midcast set. Precast is responsible for fast cast and other casting time reductions.
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2020-01-06 02:11:57
Link | Citer | R
 
Phoenix.Uzugami said: »
I'm trying to get Ask Sash to equip after using Boost, but it currently goes to an aftercast set, then equips the sash, is that how it should work or am I just missing the proper way to define an aftercast?
Sechs & Chiaia have discussed this issue here recently:
https://www.ffxiah.com/forum/topic/36705/iipunch-monk-guide/307/
 Phoenix.Uzugami
Offline
Serveur: Phoenix
Game: FFXI
user: SSJAV
By Phoenix.Uzugami 2020-01-06 19:49:33
Link | Citer | R
 
Bismarck.Xurion said: »
Sechs & Chiaia have discussed this issue here recently:
https://www.ffxiah.com/forum/topic/36705/iipunch-monk-guide/307/
I saw this, but unfortunately I don't really understand what's being discussed there haha. I changed some things in the lua, but it's still being applied after a change to my normal aftercast set.
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2020-01-07 07:46:33
Link | Citer | R
 
Phoenix.Uzugami said: »
Bismarck.Xurion said: »
Sechs & Chiaia have discussed this issue here recently:
https://www.ffxiah.com/forum/topic/36705/iipunch-monk-guide/307/
I saw this, but unfortunately I don't really understand what's being discussed there haha. I changed some things in the lua, but it's still being applied after a change to my normal aftercast set.
From reading their posts, I think Gearswap struggles with updates to buffs - basically it's not quick enough to update based on an incoming buff, therefore you get the Moonbow equip right before Ask.

I'd have to test this myself (with a different buff as I don't play MNK) to see exactly how the issue affects the logic of an aftercast, but if I had not ready those posts, I'd suggest it'd look something like:
Code
function job_aftercast(spell, action, spellMap, eventArgs)
  if state.Buff.Boost then
    equip(sets.Boost)
  end
end


I wonder if pulling the buffs manually would be quicker, albeit, more resource heavy:
Code
function job_aftercast(spell, action, spellMap, eventArgs)
  local buffs = windower.ffxi.get_player().buffs
  local boost = false
  for _, buff_id in pairs(buffs) do
    if buff_id == 45 then
      boost = true
      break
    end
  end
  if boost then
    equip(sets.Boost)
  end
end


Probably more sophisticated and concise ways of doing it. I can't test it right now because RL agro.
 Leviathan.Draugo
Offline
Serveur: Leviathan
Game: FFXI
Posts: 2775
By Leviathan.Draugo 2020-01-07 18:03:09
Link | Citer | R
 
Hello, Tried to search this thread for an answer, but I am going cross eyed.

I would like to know how to setup a non cycling toggle with a g510 keyboard binding?

function keys are all well and good but I've got 18x3 sets of extra keys I would love to use instead.

I am using a friends include library that has set swaps written in somewhat, but I want much more idle control than cycling through different sets.

I play ninja so having one button push to change my TP sets is godly.

Ill post my code later when I get home. Any help is much appreciated, GS is crazy good, but the lines of code can get tricky to digest. My programming experience basically stopped @ basic haha.
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2020-01-08 02:08:24
Link | Citer | R
 
Leviathan.Draugo said: »
I would like to know how to setup a non cycling toggle with a g510 keyboard binding?
I don't have a G keyboard, but the Binder plugin supports your keyboard.

Using Binder, it appears you could do something like:
Code
alias g510_m1g1 gs c tpmode normal


Edit: the above alias obviously triggers the self_command in Gearswap to set tp mode to normal, rather than cycling through tp modes.
 Phoenix.Uzugami
Offline
Serveur: Phoenix
Game: FFXI
user: SSJAV
By Phoenix.Uzugami 2020-01-08 03:09:54
Link | Citer | R
 
Bismarck.Xurion said: »
I'd have to test this myself (with a different buff as I don't play MNK) to see exactly how the issue affects the logic of an aftercast, but if I had not ready those posts, I'd suggest it'd look something like
Thanks, will give that a shot!
[+]
 Leviathan.Draugo
Offline
Serveur: Leviathan
Game: FFXI
Posts: 2775
By Leviathan.Draugo 2020-01-08 09:29:15
Link | Citer | R
 
Bismarck.Xurion said: »
Leviathan.Draugo said: »
I would like to know how to setup a non cycling toggle with a g510 keyboard binding?
I don't have a G keyboard, but the Binder plugin supports your keyboard.

Using Binder, it appears you could do something like:
Code
alias g510_m1g1 gs c tpmode normal


Edit: the above alias obviously triggers the self_command in Gearswap to set tp mode to normal, rather than cycling through tp modes.

Thanks, I'll try and see if I can make that work, I assume I can alias all of my buttons like that through my NIN lua?
 Bismarck.Xurion
Offline
Serveur: Bismarck
Game: FFXI
user: Xurion
Posts: 694
By Bismarck.Xurion 2020-01-08 11:33:56
Link | Citer | R
 
I can't vouch for the Binder plugin having no experience with it, but that command is taken from the docs so it should be fine.

You'll need to wrap it in the send_command function:
Code
send_command('alias g510_m1g1 gs c tpmode normal')
Offline
Posts: 46
By kaiju9 2020-01-16 18:37:41
Link | Citer | R
 
I've been having a sporadic issue for awhile now with Gearswap. Usually takes being logged in anywhere from a couple days, to over a week to appear. Basically, it stops detecting "engaged" status, so my engaged gear sets stop equipping (before this issue kicks in, they equip fine). Once this starts, I've been unable to fix it without /shutdown & re-login from scratch.

1. I'm idle, GS equips idle gear correctly
2. I engage, nothing happens (still idle gear)
3. I use a WS, WS gear equips correctly
4a. Mob dies, I go idle, idle gear equips
4b. Mob lives (or I whiff the WS), I'm still wearing WS gear

Has some fun consequences on DRK with a bunch of mobs on me, after whiffing a Scythe weaponskill, leaving me tanking in a bunch of Ratri gear.

Reloading GS, or unloading, and then loading, does NOT fix this. As mentioned, if I /shutdown and re-login from scratch, it starts working fine. I've never really tested whether zoning or changing jobs has any impact. Anyone else experienced this?
Offline
Posts: 8
By zinonffxi 2020-01-17 10:30:18
Link | Citer | R
 
hello guys!
can someone please help me with my mnk.lua
i'v been trying to fix my VS-WS under Impetus but it doesn't work.!
much appreciated
best regards.

Here is my mnk_lua
Code
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job.  Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------

-- Initialization function for this job file.
function get_sets()
    mote_include_version = 2
    
    -- Load and initialize the include file.
    include('Mote-Include.lua')
end


-- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
function job_setup()
    state.Buff.Footwork = buffactive.Footwork or false
    state.Buff.Impetus = buffactive.Impetus or false

    state.FootworkWS = M(false, 'Footwork on WS')

    info.impetus_hit_count = 0
    windower.raw_register_event('action', on_action_for_impetus)
end


-------------------------------------------------------------------------------------------------------------------
-- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
-------------------------------------------------------------------------------------------------------------------

-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
function user_setup()
    state.OffenseMode:options('Normal', 'SomeAcc', 'Acc', 'Fodder')
    state.WeaponskillMode:options('Normal', 'SomeAcc', 'Acc', 'Fodder')
    state.HybridMode:options('Normal', 'PDT', 'Counter')
    state.PhysicalDefenseMode:options('PDT', 'HP')

    update_combat_form()
    update_melee_groups()

    select_default_macro_book()
	send_command('@wait 5; input /lockstyleset 36')
end


-- Define sets and vars used by this job file.
function init_gear_sets()
    --------------------------------------
    -- Start defining the sets
    --------------------------------------
    
    -- Precast Sets
    
    -- Precast sets to enhance JAs on use
    sets.precast.JA['Hundred Fists'] = {legs="Hesychast's Hose +3"}
    sets.precast.JA['Boost'] = {hands="Anchorite's Gloves +3"}
    sets.precast.JA['Dodge'] = {feet="Anchorite's Gaiters +3"}
    sets.precast.JA['Focus'] = {head="Anchorite's Crown +1"}
    sets.precast.JA['Counterstance'] = {feet="Hesychast's Gaiters +3"}
    sets.precast.JA['Footwork'] = {feet="Anch. Gaiters +3"}
    sets.precast.JA['Formless Strikes'] = {body="Hesychast's Cyclas +3"}
    sets.precast.JA['Mantra'] = {feet="Hesychast's Gaiters +3"}

    sets.precast.JA['Chi Blast'] = {
        head="",
        body="",hands="Hesychast's Gloves +3",
        back="",legs="Hesychast's Hose +3",feet="Anchorite's Gaiters +3"}

    sets.precast.JA['Chakra'] = {head="Dampening Tam",
		body="Anch. Cyclas +3",hands="Hesychast's Gloves +3",
		legs="Hes. Hose +1",feet="Anch. Gaiters +3"}

    -- Waltz set (chr and vit)
    sets.precast.Waltz = {ammo="",
        head="",
        body="",hands="Hesychast's Gloves +3",ring1="",
        back="",waist="",legs="",feet=""}
        
    -- Don't need any special gear for Healing Waltz.
    sets.precast.Waltz['Healing Waltz'] = {}

    sets.precast.Step = {waist="Chaac Belt"}
    sets.precast.Flourish1 = {waist="Chaac Belt"}


    -- Fast cast sets for spells
    
    sets.precast.FC = {ammo="Impatiens",head="",ear2="Loquacious Earring",hands=""}

    sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck=""})

       
    -- Weaponskill sets
    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS = {ammo="Knobkierrie",
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body={ name="Herculean Vest", augments={'Rng.Atk.+19','Weapon skill damage +5%','DEX+10',}},
    hands={ name="Herculean Gloves", augments={'STR+13','Pet: AGI+15','Weapon skill damage +5%','Accuracy+7 Attack+7',}},
    legs="Hiza. Hizayoroi +2",
    feet={ name="Herculean Boots", augments={'Weapon skill damage +4%','STR+10','Attack+7',}},
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear="Telos Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Ilabrat Ring",
    right_ring="Epaminondas's Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},}
    sets.precast.WSAcc = {ammo="",body="",back="",feet=""}
    sets.precast.WSMod = {ammo="",head="",legs="Hesychast's Hose +3",feet=""}
    sets.precast.MaxTP = {ear1="",ear2=""}
    sets.precast.WS.Acc = set_combine(sets.precast.WS, sets.precast.WSAcc)
    sets.precast.WS.Mod = set_combine(sets.precast.WS, sets.precast.WSMod)

    -- Specific weaponskill sets.
    
    -- legs={name="Quiahuiz Trousers", augments={'Phys. dmg. taken -2%','Magic dmg. taken -2%','STR+8'}}}
	

    sets.precast.WS['Raging Fists']    = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}},
    body={ name="Adhemar Jacket +1", augments={'STR+12','DEX+12','Attack+20',}},
    hands={ name="Adhemar Wrist. +1", augments={'STR+12','DEX+12','Attack+20',}},
    legs={ name="Hes. Hose +3", augments={'Enhances "Hundred Fists" effect',}},
    feet="Ken. Sune-Ate +1",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','"Dbl.Atk."+10',}},})
    sets.precast.WS['Howling Fist']    = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}},
    body="Ken. Samue +1",
    hands={ name="Herculean Gloves", augments={'STR+13','Pet: AGI+15','Weapon skill damage +5%','Accuracy+7 Attack+7',}},
    legs="Ken. Hakama +1",
    feet={ name="Herculean Boots", augments={'Weapon skill damage +4%','STR+10','Attack+7',}},
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Weapon skill damage +10%',}},})
    sets.precast.WS['Asuran Fists']    = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head="Ken. Jinpachi +1",
    body={ name="Herculean Vest", augments={'Rng.Atk.+19','Weapon skill damage +5%','DEX+10',}},
    hands={ name="Herculean Gloves", augments={'STR+13','Pet: AGI+15','Weapon skill damage +5%','Accuracy+7 Attack+7',}},
    legs="Hiza. Hizayoroi +2",
    feet={ name="Herculean Boots", augments={'Weapon skill damage +4%','STR+10','Attack+7',}},
	neck="Caro Necklace",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},})
    sets.precast.WS["Ascetic's Fury"]  = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body="Ken. Samue +1",
    hands={ name="Ryuo Tekko +1", augments={'STR+12','DEX+12','Accuracy+20',}},
    legs="Ken. Hakama +1",
    feet="Ken. Sune-Ate +1",
    neck="Fotia Gorget",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Crit.hit rate+10',}},})
    sets.precast.WS["Victory Smite"]   = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body="Ken. Samue +1",
    hands={ name="Ryuo Tekko +1", augments={'STR+12','DEX+12','Accuracy+20',}},
    legs="Ken. Hakama +1",
    feet={ name="Herculean Boots", augments={'Accuracy+29','Crit. hit damage +4%','STR+12',}},
    neck="Fotia Gorget",
    waist="Moonbow Belt +1",
    left_ear="Odr Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Crit.hit rate+10',}},})
    sets.precast.WS['Shijin Spiral']   = set_combine(sets.precast.WS, { ammo="Knobkierrie",
    head="Ken. Jinpachi +1",
    body={ name="Adhemar Jacket +1", augments={'STR+12','DEX+12','Attack+20',}},
    hands="Ken. Tekko +1",
    legs="Ken. Hakama +1",
    feet="Ken. Sune-Ate +1",
    neck="Fotia Gorget",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Mache Earring +1",
    left_ring="Niqmaddu Ring",
    right_ring="Regal Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10',}},})
    sets.precast.WS['Dragon Kick']     = set_combine(sets.precast.WS, { ammo="Knobkierrie",
    head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}},
    body={ name="Herculean Vest", augments={'Rng.Atk.+19','Weapon skill damage +5%','DEX+10',}},
    hands="Anchor. Gloves +3",
    legs="Ken. Hakama +1",
    feet="Anch. Gaiters +3",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},})
    sets.precast.WS['Tornado Kick']    = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}},
    body={ name="Herculean Vest", augments={'Rng.Atk.+19','Weapon skill damage +5%','DEX+10',}},
    hands="Anchor. Gloves +3",
    legs="Ken. Hakama +1",
    feet="Anch. Gaiters +3",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},})
    sets.precast.WS['Spinning Attack'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Cataclysm'] = {ammo="Dosis Tathlum",
		neck="Baetyl Pendant",ear1="Friomisi Earring",ear2="Crematio Earring",
		hands=gear.herculean_dt_hands,ring1="Shiva Ring +1",
		back="Toro Cape",legs="Nahtirah Trousers"}
    sets.precast.WS['Victory Smite'].Impetus = set_combine(sets.precast.WS["Victory Smite"], {body="Bhikku Cyclas +1",})
    
    -- Midcast Sets
    sets.midcast.FastRecast = {
        head="",ear2="Loquacious Earring",
        body="",hands="",
        waist="",feet=""}
        
    -- Specific spells
    sets.midcast.Utsusemi = {
        head="",ear2="Loquacious Earring",
        body="",hands="",
        waist="",legs="",feet=""}

    
    -- Sets to return to when not performing an action.
    
    -- Resting sets
    sets.resting = {head="",neck="Wiglen Gorget",
        body="Hesychast's Cyclas +3",ring2="Sheltered Ring",ring1=""}
    

    -- Idle sets
    sets.idle = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Ashera Harness",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Hermes' Sandals",
    neck="Bathy choker +1",
    waist="Moonbow Belt +1",
    left_ear="Odnowa Earring +1",
    right_ear="Genmei Earring",
    left_ring="Karieyh ring +1",
    right_ring="Sheltered ring",
    back="Moonlight Cape",}

    sets.idle.Town = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Ashera Harness",
    hands="Regal Cpt. Gloves",
    legs="Malignance Tights",
    feet="Hermes' Sandals",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Odnowa Earring +1",
    right_ear="Genmei Earring",
    left_ring="Karieyh Ring +1",
    right_ring="Defending Ring",
    back="Moonlight Cape",}
    
    sets.idle.Weak = {}
    
    -- Defense sets
    sets.defense.PDT = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},}

    sets.defense.HP = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},}

    sets.defense.MDT = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},}

    sets.Kiting = {feet="Hermes' Sandals"}

    sets.ExtraRegen = {head=""}

    -- Engaged sets

    -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
    -- sets if more refined versions aren't defined.
    -- If you create a set with both offense and defense modes, the offense mode should be first.
    -- EG: sets.engaged.Dagger.Accuracy.Evasion
    
    -- Normal melee sets
    sets.engaged = {ammo="Ginsen",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body="Ken. Samue +1",
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    legs={ name="Hes. Hose +3", augments={'Enhances "Hundred Fists" effect',}},
    feet="Anch. Gaiters +3",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10',}},}
    sets.engaged.SomeAcc = { ammo="Ginsen",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body="Ken. Samue +1",
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    legs={ name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
    feet={ name="Herculean Boots", augments={'Accuracy+28','"Triple Atk."+3','DEX+1','Attack+3',}},
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Brutal Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10',}},}
    sets.engaged.Acc = {ammo="Falcon Eye",
    head="Ken. Jinpachi +1",
    body="Ken. Samue +1",
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    legs="Ken. Hakama +1",
    feet="Ken. Sune-Ate +1",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Ilabrat Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Store TP"+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Mod = {}

    -- Defensive melee hybrid sets
    sets.engaged.PDT = {ammo="Ginsen",
    head="Ken. Jinpachi +1",
    body="Ashera Harness",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Ken. Sune-Ate +1",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Brutal Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Defending Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},}
    sets.engaged.SomeAcc.PDT = {}
    sets.engaged.Acc.PDT = {}
    sets.engaged.Counter = {ammo="Amar Cluster",
    head={ name="Rao Kabuto +1", augments={'VIT+12','Attack+25','"Counter"+4',}},
    body={ name="Hes. Cyclas +3", augments={'Enhances "Formless Strikes" effect',}},
    hands="Malignance Gloves",
    legs={ name="Hes. Hose +3", augments={'Enhances "Hundred Fists" effect',}},
    feet="Malignance Boots",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Cryptic Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Store TP"+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Acc.Counter = {}


    -- Hundred Fists/Impetus melee set mods
    sets.engaged.HF = set_combine(sets.engaged)
    sets.engaged.HF.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
	sets.engaged.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
    sets.engaged.Acc.HF = set_combine(sets.engaged.Acc) 
    sets.engaged.Acc.HF = set_combine(sets.engaged.Acc) 
    sets.engaged.Acc.HF.Impetus = set_combine(sets.engaged.Acc, {body="Bhikku Cyclas +1"})
    sets.engaged.Counter.HF = set_combine(sets.engaged.Counter)
    sets.engaged.Counter.HF.Impetus = set_combine(sets.engaged.Counter, {body="Bhikku Cyclas +1"})
    sets.engaged.Acc.Counter.HF = set_combine(sets.engaged.Acc.Counter)
    sets.engaged.Acc.Counter.HF.Impetus = set_combine(sets.engaged.Acc.Counter, {body="Bhikku Cyclas +1"})


    -- Footwork combat form
    sets.engaged.Footwork = {ammo="Ginsen",
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body="Ken. Samue +1",
    hands={ name="Adhemar Wrist. +1", augments={'STR+12','DEX+12','Attack+20',}},
    legs={ name="Hes. Hose +1", augments={'Enhances "Hundred Fists" effect',}},
    feet="Anch. Gaiters +3",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Dedition Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Epona's Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Store TP"+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Footwork.Acc = {}
        
    -- Quick sets for post-precast adjustments, listed here so that the gear can be Validated.
	sets.engaged.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
    sets.impetus_body = {body="Bhikku Cyclas +1",}
    sets.footwork_kick_feet = {feet="Anchorite's Gaiters +3"}
end

-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------

-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_precast(spell, action, spellMap, eventArgs)
    -- Don't gearswap for weaponskills when Defense is on.
    if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
        eventArgs.handled = true
    end
end

-- Run after the general precast() is done.
function job_post_precast(spell, action, spellMap, eventArgs)
    if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
        if state.Buff.Impetus and (spell.english == "Ascetic's Fury" or spell.english == "Victory Smite") then
            -- Need 6 hits at capped dDex, or 9 hits if dDex is uncapped, for Bhikku to tie or win.
            if (state.OffenseMode.current == 'Fodder' and info.impetus_hit_count > 5) or (info.impetus_hit_count > 8) then
                equip(sets.impetus_body)
            end
        elseif state.Buff.Footwork and (spell.english == "Dragon's Kick" or spell.english == "Tornado Kick") then
            equip(sets.footwork_kick_feet)
        end
        
        -- Replace Moonshade Earring if we're at cap TP
        if player.tp == 3000 then
            equip(sets.precast.MaxTP)
        end
    end
end

function job_aftercast(spell, action, spellMap, eventArgs)
    if spell.type == 'WeaponSkill' and not spell.interrupted and state.FootworkWS and state.Buff.Footwork then
        send_command('cancel Footwork')
    end
end

-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------

-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
    -- Set Footwork as combat form any time it's active and Hundred Fists is not.
    if buff == 'Footwork' and gain and not buffactive['hundred fists'] then
        state.CombatForm:set('Footwork')
    elseif buff == "Hundred Fists" and not gain and buffactive.footwork then
        state.CombatForm:set('Footwork')
    else
        state.CombatForm:reset()
    end
    
    -- Hundred Fists and Impetus modify the custom melee groups
    if buff == "Hundred Fists" or buff == "Impetus" then
        classes.CustomMeleeGroups:clear()
        
        if (buff == "Hundred Fists" and gain) or buffactive['hundred fists'] then
            classes.CustomMeleeGroups:append('HF')
        end
        
        if (buff == "Impetus" and gain) or buffactive.impetus then
            classes.CustomMeleeGroups:append('Impetus')
        end
    end

    -- Update gear if any of the above changed
    if buff == "Hundred Fists" or buff == "Impetus" or buff == "Footwork" then
        handle_equipping_gear(player.status)
    end
end


-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------

function customize_idle_set(idleSet)
    if player.hpp < 75 then
        idleSet = set_combine(idleSet, sets.ExtraRegen)
    end
    
    return idleSet
end

-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
    update_combat_form()
    update_melee_groups()
end


-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------

function update_combat_form()
    if buffactive.footwork and not buffactive['hundred fists'] then
        state.CombatForm:set('Footwork')
    else
        state.CombatForm:reset()
    end
end

function update_melee_groups()
    classes.CustomMeleeGroups:clear()
    
    if buffactive['hundred fists'] then
        classes.CustomMeleeGroups:append('HF')
    end
    
    if buffactive.impetus then
        classes.CustomMeleeGroups:append('Impetus')
    end
end


-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
    -- Default macro set/book
    if player.sub_job == 'DNC' then
        set_macro_page(1, 2)
    elseif player.sub_job == 'NIN' then
        set_macro_page(1, 2)
    elseif player.sub_job == 'THF' then
        set_macro_page(1, 2)
    elseif player.sub_job == 'RUN' then
        set_macro_page(1, 2)
    else
        set_macro_page(1, 2)
    end
end


-------------------------------------------------------------------------------------------------------------------
-- Custom event hooks.
-------------------------------------------------------------------------------------------------------------------

-- Keep track of the current hit count while Impetus is up.
function on_action_for_impetus(action)
    if state.Buff.Impetus then
        -- count melee hits by player
        if action.actor_id == player.id then
            if action.category == 1 then
                for _,target in pairs(action.targets) do
                    for _,action in pairs(target.actions) do
                        -- Reactions (bitset):
                        -- 1 = evade
                        -- 2 = parry
                        -- 4 = block/guard
                        -- 8 = hit
                        -- 16 = JA/weaponskill?
                        -- If action.reaction has bits 1 or 2 set, it missed or was parried. Reset count.
                        if (action.reaction % 4) > 0 then
                            info.impetus_hit_count = 0
                        else
                            info.impetus_hit_count = info.impetus_hit_count + 1
                        end
                    end
                end
            elseif action.category == 3 then
                -- Missed weaponskill hits will reset the counter.  Can we tell?
                -- Reaction always seems to be 24 (what does this value mean? 8=hit, 16=?)
                -- Can't tell if any hits were missed, so have to assume all hit.
                -- Increment by the minimum number of weaponskill hits: 2.
                for _,target in pairs(action.targets) do
                    for _,action in pairs(target.actions) do
                        -- This will only be if the entire weaponskill missed or was parried.
                        if (action.reaction % 4) > 0 then
                            info.impetus_hit_count = 0
                        else
                            info.impetus_hit_count = info.impetus_hit_count + 2
                        end
                    end
                end
            end
        elseif action.actor_id ~= player.id and action.category == 1 then
            -- If mob hits the player, check for counters.
            for _,target in pairs(action.targets) do
                if target.id == player.id then
                    for _,action in pairs(target.actions) do
                        -- Spike effect animation:
                        -- 63 = counter
                        -- ?? = missed counter
                        if action.has_spike_effect then
                            -- spike_effect_message of 592 == missed counter
                            if action.spike_effect_message == 592 then
                                info.impetus_hit_count = 0
                            elseif action.spike_effect_animation == 63 then
                                info.impetus_hit_count = info.impetus_hit_count + 1
                            end
                        end
                    end
                end
            end
        end
        
        --add_to_chat(123,'Current Impetus hit count = ' .. tostring(info.impetus_hit_count))
    else
        info.impetus_hit_count = 0
    end
    
end
 Quetzalcoatl.Orestes
Offline
Serveur: Quetzalcoatl
Game: FFXI
user: Orestes78
Posts: 430
By Quetzalcoatl.Orestes 2020-01-17 12:03:52
Link | Citer | R
 
zinonffxi said: »
hello guys!
can someone please help me with my mnk.lua
i'v been trying to fix my VS-WS under Impetus but it doesn't work.!
much appreciated
best regards.

Here is my mnk_lua
Code
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job.  Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------

-- Initialization function for this job file.
function get_sets()
    mote_include_version = 2
    
    -- Load and initialize the include file.
    include('Mote-Include.lua')
end


-- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
function job_setup()
    state.Buff.Footwork = buffactive.Footwork or false
    state.Buff.Impetus = buffactive.Impetus or false

    state.FootworkWS = M(false, 'Footwork on WS')

    info.impetus_hit_count = 0
    windower.raw_register_event('action', on_action_for_impetus)
end


-------------------------------------------------------------------------------------------------------------------
-- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
-------------------------------------------------------------------------------------------------------------------

-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
function user_setup()
    state.OffenseMode:options('Normal', 'SomeAcc', 'Acc', 'Fodder')
    state.WeaponskillMode:options('Normal', 'SomeAcc', 'Acc', 'Fodder')
    state.HybridMode:options('Normal', 'PDT', 'Counter')
    state.PhysicalDefenseMode:options('PDT', 'HP')

    update_combat_form()
    update_melee_groups()

    select_default_macro_book()
	send_command('@wait 5; input /lockstyleset 36')
end


-- Define sets and vars used by this job file.
function init_gear_sets()
    --------------------------------------
    -- Start defining the sets
    --------------------------------------
    
    -- Precast Sets
    
    -- Precast sets to enhance JAs on use
    sets.precast.JA['Hundred Fists'] = {legs="Hesychast's Hose +3"}
    sets.precast.JA['Boost'] = {hands="Anchorite's Gloves +3"}
    sets.precast.JA['Dodge'] = {feet="Anchorite's Gaiters +3"}
    sets.precast.JA['Focus'] = {head="Anchorite's Crown +1"}
    sets.precast.JA['Counterstance'] = {feet="Hesychast's Gaiters +3"}
    sets.precast.JA['Footwork'] = {feet="Anch. Gaiters +3"}
    sets.precast.JA['Formless Strikes'] = {body="Hesychast's Cyclas +3"}
    sets.precast.JA['Mantra'] = {feet="Hesychast's Gaiters +3"}

    sets.precast.JA['Chi Blast'] = {
        head="",
        body="",hands="Hesychast's Gloves +3",
        back="",legs="Hesychast's Hose +3",feet="Anchorite's Gaiters +3"}

    sets.precast.JA['Chakra'] = {head="Dampening Tam",
		body="Anch. Cyclas +3",hands="Hesychast's Gloves +3",
		legs="Hes. Hose +1",feet="Anch. Gaiters +3"}

    -- Waltz set (chr and vit)
    sets.precast.Waltz = {ammo="",
        head="",
        body="",hands="Hesychast's Gloves +3",ring1="",
        back="",waist="",legs="",feet=""}
        
    -- Don't need any special gear for Healing Waltz.
    sets.precast.Waltz['Healing Waltz'] = {}

    sets.precast.Step = {waist="Chaac Belt"}
    sets.precast.Flourish1 = {waist="Chaac Belt"}


    -- Fast cast sets for spells
    
    sets.precast.FC = {ammo="Impatiens",head="",ear2="Loquacious Earring",hands=""}

    sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck=""})

       
    -- Weaponskill sets
    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS = {ammo="Knobkierrie",
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body={ name="Herculean Vest", augments={'Rng.Atk.+19','Weapon skill damage +5%','DEX+10',}},
    hands={ name="Herculean Gloves", augments={'STR+13','Pet: AGI+15','Weapon skill damage +5%','Accuracy+7 Attack+7',}},
    legs="Hiza. Hizayoroi +2",
    feet={ name="Herculean Boots", augments={'Weapon skill damage +4%','STR+10','Attack+7',}},
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear="Telos Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Ilabrat Ring",
    right_ring="Epaminondas's Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},}
    sets.precast.WSAcc = {ammo="",body="",back="",feet=""}
    sets.precast.WSMod = {ammo="",head="",legs="Hesychast's Hose +3",feet=""}
    sets.precast.MaxTP = {ear1="",ear2=""}
    sets.precast.WS.Acc = set_combine(sets.precast.WS, sets.precast.WSAcc)
    sets.precast.WS.Mod = set_combine(sets.precast.WS, sets.precast.WSMod)

    -- Specific weaponskill sets.
    
    -- legs={name="Quiahuiz Trousers", augments={'Phys. dmg. taken -2%','Magic dmg. taken -2%','STR+8'}}}
	

    sets.precast.WS['Raging Fists']    = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}},
    body={ name="Adhemar Jacket +1", augments={'STR+12','DEX+12','Attack+20',}},
    hands={ name="Adhemar Wrist. +1", augments={'STR+12','DEX+12','Attack+20',}},
    legs={ name="Hes. Hose +3", augments={'Enhances "Hundred Fists" effect',}},
    feet="Ken. Sune-Ate +1",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','"Dbl.Atk."+10',}},})
    sets.precast.WS['Howling Fist']    = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}},
    body="Ken. Samue +1",
    hands={ name="Herculean Gloves", augments={'STR+13','Pet: AGI+15','Weapon skill damage +5%','Accuracy+7 Attack+7',}},
    legs="Ken. Hakama +1",
    feet={ name="Herculean Boots", augments={'Weapon skill damage +4%','STR+10','Attack+7',}},
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Weapon skill damage +10%',}},})
    sets.precast.WS['Asuran Fists']    = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head="Ken. Jinpachi +1",
    body={ name="Herculean Vest", augments={'Rng.Atk.+19','Weapon skill damage +5%','DEX+10',}},
    hands={ name="Herculean Gloves", augments={'STR+13','Pet: AGI+15','Weapon skill damage +5%','Accuracy+7 Attack+7',}},
    legs="Hiza. Hizayoroi +2",
    feet={ name="Herculean Boots", augments={'Weapon skill damage +4%','STR+10','Attack+7',}},
	neck="Caro Necklace",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},})
    sets.precast.WS["Ascetic's Fury"]  = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body="Ken. Samue +1",
    hands={ name="Ryuo Tekko +1", augments={'STR+12','DEX+12','Accuracy+20',}},
    legs="Ken. Hakama +1",
    feet="Ken. Sune-Ate +1",
    neck="Fotia Gorget",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Crit.hit rate+10',}},})
    sets.precast.WS["Victory Smite"]   = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body="Ken. Samue +1",
    hands={ name="Ryuo Tekko +1", augments={'STR+12','DEX+12','Accuracy+20',}},
    legs="Ken. Hakama +1",
    feet={ name="Herculean Boots", augments={'Accuracy+29','Crit. hit damage +4%','STR+12',}},
    neck="Fotia Gorget",
    waist="Moonbow Belt +1",
    left_ear="Odr Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Crit.hit rate+10',}},})
    sets.precast.WS['Shijin Spiral']   = set_combine(sets.precast.WS, { ammo="Knobkierrie",
    head="Ken. Jinpachi +1",
    body={ name="Adhemar Jacket +1", augments={'STR+12','DEX+12','Attack+20',}},
    hands="Ken. Tekko +1",
    legs="Ken. Hakama +1",
    feet="Ken. Sune-Ate +1",
    neck="Fotia Gorget",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Mache Earring +1",
    left_ring="Niqmaddu Ring",
    right_ring="Regal Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10',}},})
    sets.precast.WS['Dragon Kick']     = set_combine(sets.precast.WS, { ammo="Knobkierrie",
    head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}},
    body={ name="Herculean Vest", augments={'Rng.Atk.+19','Weapon skill damage +5%','DEX+10',}},
    hands="Anchor. Gloves +3",
    legs="Ken. Hakama +1",
    feet="Anch. Gaiters +3",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},})
    sets.precast.WS['Tornado Kick']    = set_combine(sets.precast.WS, {ammo="Knobkierrie",
    head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}},
    body={ name="Herculean Vest", augments={'Rng.Atk.+19','Weapon skill damage +5%','DEX+10',}},
    hands="Anchor. Gloves +3",
    legs="Ken. Hakama +1",
    feet="Anch. Gaiters +3",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},})
    sets.precast.WS['Spinning Attack'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Cataclysm'] = {ammo="Dosis Tathlum",
		neck="Baetyl Pendant",ear1="Friomisi Earring",ear2="Crematio Earring",
		hands=gear.herculean_dt_hands,ring1="Shiva Ring +1",
		back="Toro Cape",legs="Nahtirah Trousers"}
    sets.precast.WS['Victory Smite'].Impetus = set_combine(sets.precast.WS["Victory Smite"], {body="Bhikku Cyclas +1",})
    
    -- Midcast Sets
    sets.midcast.FastRecast = {
        head="",ear2="Loquacious Earring",
        body="",hands="",
        waist="",feet=""}
        
    -- Specific spells
    sets.midcast.Utsusemi = {
        head="",ear2="Loquacious Earring",
        body="",hands="",
        waist="",legs="",feet=""}

    
    -- Sets to return to when not performing an action.
    
    -- Resting sets
    sets.resting = {head="",neck="Wiglen Gorget",
        body="Hesychast's Cyclas +3",ring2="Sheltered Ring",ring1=""}
    

    -- Idle sets
    sets.idle = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Ashera Harness",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Hermes' Sandals",
    neck="Bathy choker +1",
    waist="Moonbow Belt +1",
    left_ear="Odnowa Earring +1",
    right_ear="Genmei Earring",
    left_ring="Karieyh ring +1",
    right_ring="Sheltered ring",
    back="Moonlight Cape",}

    sets.idle.Town = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Ashera Harness",
    hands="Regal Cpt. Gloves",
    legs="Malignance Tights",
    feet="Hermes' Sandals",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Odnowa Earring +1",
    right_ear="Genmei Earring",
    left_ring="Karieyh Ring +1",
    right_ring="Defending Ring",
    back="Moonlight Cape",}
    
    sets.idle.Weak = {}
    
    -- Defense sets
    sets.defense.PDT = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},}

    sets.defense.HP = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},}

    sets.defense.MDT = {ammo="Staunch Tathlum +1",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},}

    sets.Kiting = {feet="Hermes' Sandals"}

    sets.ExtraRegen = {head=""}

    -- Engaged sets

    -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
    -- sets if more refined versions aren't defined.
    -- If you create a set with both offense and defense modes, the offense mode should be first.
    -- EG: sets.engaged.Dagger.Accuracy.Evasion
    
    -- Normal melee sets
    sets.engaged = {ammo="Ginsen",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body="Ken. Samue +1",
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    legs={ name="Hes. Hose +3", augments={'Enhances "Hundred Fists" effect',}},
    feet="Anch. Gaiters +3",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10',}},}
    sets.engaged.SomeAcc = { ammo="Ginsen",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body="Ken. Samue +1",
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    legs={ name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
    feet={ name="Herculean Boots", augments={'Accuracy+28','"Triple Atk."+3','DEX+1','Attack+3',}},
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Brutal Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Dbl.Atk."+10',}},}
    sets.engaged.Acc = {ammo="Falcon Eye",
    head="Ken. Jinpachi +1",
    body="Ken. Samue +1",
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    legs="Ken. Hakama +1",
    feet="Ken. Sune-Ate +1",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Ilabrat Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Store TP"+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Mod = {}

    -- Defensive melee hybrid sets
    sets.engaged.PDT = {ammo="Ginsen",
    head="Ken. Jinpachi +1",
    body="Ashera Harness",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Ken. Sune-Ate +1",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Brutal Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Defending Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},}
    sets.engaged.SomeAcc.PDT = {}
    sets.engaged.Acc.PDT = {}
    sets.engaged.Counter = {ammo="Amar Cluster",
    head={ name="Rao Kabuto +1", augments={'VIT+12','Attack+25','"Counter"+4',}},
    body={ name="Hes. Cyclas +3", augments={'Enhances "Formless Strikes" effect',}},
    hands="Malignance Gloves",
    legs={ name="Hes. Hose +3", augments={'Enhances "Hundred Fists" effect',}},
    feet="Malignance Boots",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Cryptic Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Store TP"+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Acc.Counter = {}


    -- Hundred Fists/Impetus melee set mods
    sets.engaged.HF = set_combine(sets.engaged)
    sets.engaged.HF.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
	sets.engaged.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
    sets.engaged.Acc.HF = set_combine(sets.engaged.Acc) 
    sets.engaged.Acc.HF = set_combine(sets.engaged.Acc) 
    sets.engaged.Acc.HF.Impetus = set_combine(sets.engaged.Acc, {body="Bhikku Cyclas +1"})
    sets.engaged.Counter.HF = set_combine(sets.engaged.Counter)
    sets.engaged.Counter.HF.Impetus = set_combine(sets.engaged.Counter, {body="Bhikku Cyclas +1"})
    sets.engaged.Acc.Counter.HF = set_combine(sets.engaged.Acc.Counter)
    sets.engaged.Acc.Counter.HF.Impetus = set_combine(sets.engaged.Acc.Counter, {body="Bhikku Cyclas +1"})


    -- Footwork combat form
    sets.engaged.Footwork = {ammo="Ginsen",
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body="Ken. Samue +1",
    hands={ name="Adhemar Wrist. +1", augments={'STR+12','DEX+12','Attack+20',}},
    legs={ name="Hes. Hose +1", augments={'Enhances "Hundred Fists" effect',}},
    feet="Anch. Gaiters +3",
    neck="Mnk. Nodowa +2",
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Dedition Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Epona's Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','"Store TP"+10','System: 1 ID: 640 Val: 4',}},}
    sets.engaged.Footwork.Acc = {}
        
    -- Quick sets for post-precast adjustments, listed here so that the gear can be Validated.
	sets.engaged.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
    sets.impetus_body = {body="Bhikku Cyclas +1",}
    sets.footwork_kick_feet = {feet="Anchorite's Gaiters +3"}
end

-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------

-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_precast(spell, action, spellMap, eventArgs)
    -- Don't gearswap for weaponskills when Defense is on.
    if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
        eventArgs.handled = true
    end
end

-- Run after the general precast() is done.
function job_post_precast(spell, action, spellMap, eventArgs)
    if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
        if state.Buff.Impetus and (spell.english == "Ascetic's Fury" or spell.english == "Victory Smite") then
            -- Need 6 hits at capped dDex, or 9 hits if dDex is uncapped, for Bhikku to tie or win.
            if (state.OffenseMode.current == 'Fodder' and info.impetus_hit_count > 5) or (info.impetus_hit_count > 8) then
                equip(sets.impetus_body)
            end
        elseif state.Buff.Footwork and (spell.english == "Dragon's Kick" or spell.english == "Tornado Kick") then
            equip(sets.footwork_kick_feet)
        end
        
        -- Replace Moonshade Earring if we're at cap TP
        if player.tp == 3000 then
            equip(sets.precast.MaxTP)
        end
    end
end

function job_aftercast(spell, action, spellMap, eventArgs)
    if spell.type == 'WeaponSkill' and not spell.interrupted and state.FootworkWS and state.Buff.Footwork then
        send_command('cancel Footwork')
    end
end

-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------

-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
    -- Set Footwork as combat form any time it's active and Hundred Fists is not.
    if buff == 'Footwork' and gain and not buffactive['hundred fists'] then
        state.CombatForm:set('Footwork')
    elseif buff == "Hundred Fists" and not gain and buffactive.footwork then
        state.CombatForm:set('Footwork')
    else
        state.CombatForm:reset()
    end
    
    -- Hundred Fists and Impetus modify the custom melee groups
    if buff == "Hundred Fists" or buff == "Impetus" then
        classes.CustomMeleeGroups:clear()
        
        if (buff == "Hundred Fists" and gain) or buffactive['hundred fists'] then
            classes.CustomMeleeGroups:append('HF')
        end
        
        if (buff == "Impetus" and gain) or buffactive.impetus then
            classes.CustomMeleeGroups:append('Impetus')
        end
    end

    -- Update gear if any of the above changed
    if buff == "Hundred Fists" or buff == "Impetus" or buff == "Footwork" then
        handle_equipping_gear(player.status)
    end
end


-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------

function customize_idle_set(idleSet)
    if player.hpp < 75 then
        idleSet = set_combine(idleSet, sets.ExtraRegen)
    end
    
    return idleSet
end

-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
    update_combat_form()
    update_melee_groups()
end


-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------

function update_combat_form()
    if buffactive.footwork and not buffactive['hundred fists'] then
        state.CombatForm:set('Footwork')
    else
        state.CombatForm:reset()
    end
end

function update_melee_groups()
    classes.CustomMeleeGroups:clear()
    
    if buffactive['hundred fists'] then
        classes.CustomMeleeGroups:append('HF')
    end
    
    if buffactive.impetus then
        classes.CustomMeleeGroups:append('Impetus')
    end
end


-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
    -- Default macro set/book
    if player.sub_job == 'DNC' then
        set_macro_page(1, 2)
    elseif player.sub_job == 'NIN' then
        set_macro_page(1, 2)
    elseif player.sub_job == 'THF' then
        set_macro_page(1, 2)
    elseif player.sub_job == 'RUN' then
        set_macro_page(1, 2)
    else
        set_macro_page(1, 2)
    end
end


-------------------------------------------------------------------------------------------------------------------
-- Custom event hooks.
-------------------------------------------------------------------------------------------------------------------

-- Keep track of the current hit count while Impetus is up.
function on_action_for_impetus(action)
    if state.Buff.Impetus then
        -- count melee hits by player
        if action.actor_id == player.id then
            if action.category == 1 then
                for _,target in pairs(action.targets) do
                    for _,action in pairs(target.actions) do
                        -- Reactions (bitset):
                        -- 1 = evade
                        -- 2 = parry
                        -- 4 = block/guard
                        -- 8 = hit
                        -- 16 = JA/weaponskill?
                        -- If action.reaction has bits 1 or 2 set, it missed or was parried. Reset count.
                        if (action.reaction % 4) > 0 then
                            info.impetus_hit_count = 0
                        else
                            info.impetus_hit_count = info.impetus_hit_count + 1
                        end
                    end
                end
            elseif action.category == 3 then
                -- Missed weaponskill hits will reset the counter.  Can we tell?
                -- Reaction always seems to be 24 (what does this value mean? 8=hit, 16=?)
                -- Can't tell if any hits were missed, so have to assume all hit.
                -- Increment by the minimum number of weaponskill hits: 2.
                for _,target in pairs(action.targets) do
                    for _,action in pairs(target.actions) do
                        -- This will only be if the entire weaponskill missed or was parried.
                        if (action.reaction % 4) > 0 then
                            info.impetus_hit_count = 0
                        else
                            info.impetus_hit_count = info.impetus_hit_count + 2
                        end
                    end
                end
            end
        elseif action.actor_id ~= player.id and action.category == 1 then
            -- If mob hits the player, check for counters.
            for _,target in pairs(action.targets) do
                if target.id == player.id then
                    for _,action in pairs(target.actions) do
                        -- Spike effect animation:
                        -- 63 = counter
                        -- ?? = missed counter
                        if action.has_spike_effect then
                            -- spike_effect_message of 592 == missed counter
                            if action.spike_effect_message == 592 then
                                info.impetus_hit_count = 0
                            elseif action.spike_effect_animation == 63 then
                                info.impetus_hit_count = info.impetus_hit_count + 1
                            end
                        end
                    end
                end
            end
        end
        
        --add_to_chat(123,'Current Impetus hit count = ' .. tostring(info.impetus_hit_count))
    else
        info.impetus_hit_count = 0
    end
    
end

I took a quick look. You'll have to forgive my ignorance on MNK, as it's not a job I play.

This looks like it's based on Mote's default MNK.lua. His MNK.lua has a CustomMeleeGroup defined for Impetus. This is what allows your melee sets like sets.engaged.Impetus to work. However, CustomMeleeGroups do not work with precast or weaponskill sets. (only engaged)

If you want to use sets.precast.WS["Victory Smite"].Impetus, then you'll have to setup a custom "wsmode". Add this somewhere close to your update_combat_form() function.
Code
function get_custom_wsmode(spell, spellMap, defaut_wsmode)
    local wsmode

    if state.Buff.Impetus then
        wsmode = 'Impetus'
    end

    return wsmode
end

This should make the WS set work.

I noticed something else though. I think Mote's MNK.lua has a mistake in job_post_precast(). The following code only executes when DefenseMode is enabled. I think he intended state.DefenseMode.current == 'None'
Code
function job_post_precast(spell, action, spellMap, eventArgs)
    if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
        if state.Buff.Impetus and (spell.english == "Ascetic's Fury" or spell.english == "Victory Smite") then
            -- Need 6 hits at capped dDex, or 9 hits if dDex is uncapped, for Bhikku to tie or win.
            if (state.OffenseMode.current == 'Fodder' and info.impetus_hit_count > 5) or (info.impetus_hit_count > 8) then
                equip(sets.impetus_body)
            end
        elseif state.Buff.Footwork and (spell.english == "Dragon's Kick" or spell.english == "Tornado Kick") then
            equip(sets.footwork_kick_feet)
        end
         
        -- Replace Moonshade Earring if we're at cap TP
        if player.tp == 3000 then
            equip(sets.precast.MaxTP)
        end
    end
end

The custom wsmode should make the Impetus set work, so you may not need that. (unless you care about the DefenseMode consieration). There's also the impetus_hit_count to consider. Your call.
First Page 2 3 ... 155 156 157 ... 183 184 185
Log in to post.