I am hoping to find a quick explanation for how to cycle through gear sets using a keybind. I've tried using the guide here and here, but have been unable to create anything that works. Below is my code I've been using. I apologize as it is extremely basic and I am still learning how to use .lua. I only want to cycle between sets.engaged.Tank and sets.engaged.Tank.Safe using the keybind (I think F9 is the popular choice).
function get_sets() sets.aftercast = {} sets.aftercast.Resting = {body="",waist="",neck=""} sets.idle = {} sets.idle.Town = {ammo="", head="Panther mask +1",neck="Spike Necklace",ear1="Brutal Earring",ear2="Fowling earring",neck="Spike Necklace", body="Royal Guard Livery",hands="Gothic gauntlets",ring1="San D'Orian Ring",ring2="Bastokan ring", back="Fourth Mantle",waist="Ninurta's sash",Feet="Hermes' Sandals +1"} sets.precast = {} sets.precast.RNG = {} sets.precast.STR = {} sets.precast.Provoke = {head="Iron Ram Sallet",waist="Warwolf Belt",body="Fighter's lorica",ring1="Mermaid's ring",ring2="Hercules' ring", ear1="Hades earring +1",ear2="Hades earring +1",hands="Gothic gauntlets",back="Toreador's cape",legs="Iron Ram Hose",feet="Hermes' Sandals +1"} sets.precast.WS = {main="",sub="", head="Ares' Mask",neck="Bull Necklace",ear1="Brutal Earring",ear2="Fowling Earring", body="Ares's cuirass",hands="Ares' Gauntlets",ring1="Flame Ring",ring2="Flame Ring", back="Amemet Mantle +1",waist="Grenadier Belt",legs="Hachiryu Haidate",feet="Fighter's Calligae"} sets.precast.WSpm = {main="",sub="", head="Ares' Mask",neck="Bull Necklace",ear1="Brutal Earring",ear2="Vampire Earring", body="Ares's cuirass",hands="Ares' Gauntlets",ring1="Flame Ring",ring2="Flame Ring", back="Amemet Mantle +1",waist="Grenadier Belt",legs="Hachiryu Haidate",feet="Fighter's Calligae"} sets.engaged = {} sets.engaged.Tank = {sub="", head="Walahra turban",neck="Berserker's Torque",ear1="Brutal Earring",ear2="Fowling Earring", body="Hachiryu haramaki",hands="Ares' Gauntlets",ring1="Soldier's ring",ring2="Headsman's ring", back="Fourth Division Mantle",waist="Ninurta's sash",legs="Byakko's Haidate",feet="Fighter's Calligae"} sets.engaged.Tank.Safe = set_combine(sets.engaged.Tank, {neck="Spike Necklace",ring1="Mars's Ring"}) end function status_change(new,old) if new=='Engaged' then equip(sets.engaged.Tank) elseif new=='Resting' then equip(sets.aftercast.Resting) elseif new=='Idle' then idle() end end function precast(spell) if spell.english == 'Provoke' then equip(sets.precast.Provoke) elseif spell.english == 'Warcry' then equip(sets.precast.Provoke) elseif spell.english == 'Hasso' then equip(sets.precast.Provoke) elseif spell.english == 'Aggressor' then equip(sets.precast.Provoke) elseif spell.english == 'Retaliation' then equip(sets.precast.Provoke) elseif spell.english == 'Defender' then equip(sets.precast.Provoke) elseif spell.english == 'Warding Circle' then equip(sets.precast.Provoke) end if spell.action_type == 'Ranged Attack' then equip(sets.precast.RNG) elseif spell.type == 'WeaponSkill' and world.time >= 17*60 or world.time < 7*60 then equip(sets.precast.WSpm) elseif spell.type == 'WeaponSkill' then equip(sets.precast.WS) end end function midcast(spell) if spell.english=='Provoke' then equip(sets.precast.Provoke) elseif spell.english == 'Warcry' then equip(sets.precast.Provoke) elseif spell.english == 'Hasso' then equip(sets.precast.Provoke) elseif spell.english == 'Aggressor' then equip(sets.precast.Provoke) elseif spell.english == 'Retaliation' then equip(sets.precast.Provoke) elseif spell.english == 'Defender' then equip(sets.precast.Provoke) elseif spell.english == 'Warding Circle' then equip(sets.precast.Provoke) end if spell.action_type == 'Ranged Attack' then equip(sets.precast.RNG) elseif spell.type == 'WeaponSkill' and world.time >= 17*60 or world.time < 7*60 then equip(sets.precast.WSpm) elseif spell.type == 'WeaponSkill' then equip(sets.precast.WS) end end function aftercast(spell) if spell.english~='Spirit Link' and player.status == 'Engaged' then equip(sets.engaged.Tank) else equip(sets.idle.Town) end if spell.action_type=='Ranged Attack' then equip(sets.engaged.Tank) end if spell.type == 'WeaponSkill' then equip(sets.engaged.Tank) end end function idle() equip(sets.idle.Town) end