GearSwa: Lua error (unknown: 1) /windowerdirectory//addons/gearswap/statics.lua:61 bad argument #1 to 'pairs' (table expected, got nil)
Whenever I start up or try to load gearswap, I've tried a fresh gearswap (deleting and re-downloading the addon), any help would be appreciated, won't load even without a job lua file.
if spell.english == 'Light Arts' then
if buffactive['light arts'] or buffactive['addendum: white'] then
cancel_spell()
send_command('input /ja "Dark Arts" <me>')
end
end
if spell.english == 'Addendum: white' then
if buffactive['dark arts'] or buffactive['addendum: black'] then
cancel_spell()
send_command('input /ja "Addendum: black" <me>')
end
end
if spell.english == 'Penury' then
if buffactive['dark arts'] or buffactive['addendum: black'] then
cancel_spell()
send_command('input /ja "Parsimony" <me>')
end
end
if spell.english == 'Celerity' then
if buffactive['dark arts'] or buffactive['addendum: black'] then
cancel_spell()
send_command('input /ja "Alacrity" <me>')
end
end
if spell.english == 'Accession' then
if buffactive['dark arts'] or buffactive['addendum: black'] then
cancel_spell()
send_command('input /ja "Manifestation" <me>')
end
end
if spell.english == 'Rapture' then
if buffactive['dark arts'] or buffactive['addendum: black'] then
cancel_spell()
send_command('input /ja "Ebullience" <me>')
end
end
if spell.english == 'Perpetuance' then
if buffactive['dark arts'] or buffactive['addendum: black'] then
cancel_spell()
send_command('input /ja "Immanence" <me>')
end
end
Getting a error as of tonight, guessing its a resource error ? Gearswap not even loading. Any ideas would be appreciated.
Gearswap: Lua errorr (unknown: 1) - Gearswap/statics.lua:61: bad argument #1 to 'pairs' (table expected,got nil)
Getting a error as of tonight, guessing its a resource error ? Gearswap not even loading. Any ideas would be appreciated.
Gearswap: Lua errorr (unknown: 1) - Gearswap/statics.lua:61: bad argument #1 to 'pairs' (table expected,got nil)
Seems so, there's a direct link somewhere on one of these Gearswap threads (there's 3) that has the link.
Idk how to get in touch with the author of the Kinematics Files but I was curious about something with the BRD one.
When Nightingale is active, does it adjust accordingly to instant cast by skipping the usual precast set and instead precasting in midcast set for full potency? It doesnt seem so... I understand this is dependent on whether a player 5/5s nightingale though.
If someone could explain how exactly to make a rule here atleast, it would be appreciated. I'm kind of confused among the rules still... Especially with all the mote/include files going on.
I also was wondering what the command was to check what swaps are being made so next time with such a case I can find out for sure what is going before I inquire. (seen the command somewhere before couldnt find it again.)
Another thing, IDK if its coincidence but he seems to have adopted the organization style of rules that I suggested for someone complaining about how lua looks in the recent spellcast thread. *thumbs up* :P
It always equips precast-gear, but it's not an issue. GearSwap will even swap midcast-gear correctly on instant spells, such as job abilities, weapon skills and quick casting procs.
The command you're looking for is //gs showswaps I think, but not entirely sure.
It always equips precast-gear, but it's not an issue. GearSwap will even swap midcast-gear correctly on instant spells, such as job abilities, weapon skills and quick casting procs.
The command you're looking for is //gs showswaps I think, but not entirely sure.
I am writing my first lua file. I am basing it off of Motenten's template and am making it for RNG. I am thinking about the logic for EES. EES is a job ability but I would like to be able to toggle to specific accuracy sets as needed. My modes are set up as follows:
Am I correct in thinking I cannot do it this way as I don't have a "JA mode". If so, any suggestions how I can code this to keep it consistent with how Motenten has coded these awesome scripts?
I am writing my first lua file. I am basing it off of Motenten's template and am making it for RNG. I am thinking about the logic for EES. EES is a job ability but I would like to be able to toggle to specific accuracy sets as needed. My modes are set up as follows:
Am I correct in thinking I cannot do it this way as I don't have a "JA mode". If so, any suggestions how I can code this to keep it consistent with how Motenten has coded these awesome scripts?
Thanks!
You should be able to add this function near the bottom of your file to make the above sets work. (haven't tested it)
Code
function job_get_spell_map(spell, default_spell_map)
if spell.english == 'Eagle Eye Shot' then
if state.RangedMode == 'MedAcc' then
return 'MedAcc'
elseif state.RangedMode == 'FullAcc' then
return 'FullAcc'
end
end
end
Valid point. I've added a small thing for situations such as this.
There's now a classes.JAMode variable. It's like classes.CustomClass in that it resets after each action. It only applies to non-weaponskill abilities (and, despite it having JA in the name, it applies to other spell.type values, such as CorsairShot, Rune, etc).
For your purposes, what you'd want is something like this:
Code
function job_precast(spell, ...)
if spell.english == 'Eagle Eye Shot' then
classes.JAMode = state.RangedMode
end
end
Orestes' suggestion would also work, though you'd probably want to set the spell map to something like EES_MedAcc, and then create the set as sets.precast.EES_MedAcc.
Hello, I'm getting back to the game after a hiatus and trying to convert my spellcasts to gearswap. I had this function in AutoExec that stopped working a while back, but I'd like to try and implement it in GearSwap now.
It's for Summoner, I want it to check if I've been slept and if I have an avatar out, if I do, I want it to kill my stoneskin and swap in my Sacrifice Torque for a tic to wake me up. Swapping it back out again after would be ideal, but I can always just take another action to fix it, if needed.
This is what I have so far:
Code
function auto_awake(buff, gain)
if buff == 'Sleep' then
if pet.isvalid then
cancel 'Stoneskin'
idleSet = set_combine(idleSet, 'Sacrifice Torque')
return idleSet
end
end
end
Hello, I'm getting back to the game after a hiatus and trying to convert my spellcasts to gearswap. I had this function in AutoExec that stopped working a while back, but I'd like to try and implement it in GearSwap now.
It's for Summoner, I want it to check if I've been slept and if I have an avatar out, if I do, I want it to kill my stoneskin and swap in my Sacrifice Torque for a tic to wake me up. Swapping it back out again after would be ideal, but I can always just take another action to fix it, if needed.
Code
function buff_change(buff, gain)
if buff == 'Sleep' then
if gain and pet.isvalid then
send_command('cancel stoneskin')
equip({neck="Sacrifice Torque"})
elseif player.equipment.neck == "Sacrifice Torque" then
equip({neck="whatever default gear"})
end
end
end
This requires that you have the Cancel addon loaded as well.
Orestes' suggestion would also work, though you'd probably want to set the spell map to something like EES_MedAcc, and then create the set as sets.precast.EES_MedAcc.
I'll have to re-read Mote-Include. I had it in my head that spellMap was appended after sets.precast.JA, allowing sets.precast.JA['Eagle Eye Shot'].MidAcc, etc. to work. Thanks for the clarification.
JAMode sounds really nice, and much more intuitive to use.
Orestes' suggestion would also work, though you'd probably want to set the spell map to something like EES_MedAcc, and then create the set as sets.precast.EES_MedAcc.
I'll have to re-read Mote-Include. I had it in my head that spellMap was appended after sets.precast.JA, allowing sets.precast.JA['Eagle Eye Shot'].MidAcc, etc. to work. Thanks for the clarification.
JAMode sounds really nice, and much more intuitive to use.
Thanks
Sorry, was a typo. Meant that if you used the spell map, that replaces the spell name. So you couldn't reference it using ['Eagle Eye Shot'], but would instead use sets.precast.JA.EES_MedAcc.
But yeah, JAMode should work better for what you want.
Hi new to gearswap and using Mote's files. I'm trying to make a DRG one, and was hoping to set it up so I could switch between weapons with //polearm or //staff via:
alias polearm input /console gs c set CombatWeapon Polearm
alias staff input /console gs c set CombatWeapon Staff
In an init file.
As such I've coded some set.engaged.Polearm sets and set.engaged.Staff sets.
I can seem to figure out how to make the state.CombatWeapon work for me though I keep getting DRG.lua:88: attempt index field 'Polearm' (a nil value)
Line 88 is this:
sets.engaged.Polearm.Normal = set_combine(sets.engaged, {main="Gungnir", sub="Pole Grip",ammo="Potestas Bomblet"})
-------------------------------------------------------------------------------------------------------------------
-- Initialization function that defines sets and variables to be used.
-------------------------------------------------------------------------------------------------------------------
-- IMPORTANT: Make sure to also get the Include.lua file to go with this.
-- Initialization function for this job file.
function get_sets()
-- Load and initialize the include file.
include('Include.lua')
end
-- Setup vars that are user-independent.
function job_setup()
determine_groups()
end
-- Setup vars that are user-dependent. Can override this function in a sidecar file.
function user_setup()
-- Options: Override default values
options.OffenseModes = {'Normal', 'Acc', 'Att', 'Crit', 'DA', 'Haste', 'Skill', 'sTP', 'STR'}
options.DefenseModes = {'Normal', 'Evasion', 'PDT', 'Reraise'}
options.WeaponskillModes = {'Normal', 'Acc', 'Att', 'Mod'}
options.CastingModes = {'Normal'}
options.IdleModes = {'Normal'}
options.RestingModes = {'Normal'}
options.PhysicalDefenseModes = {'PDT', 'Reraise'}
options.MagicalDefenseModes = {'MDT'}
state.Defense.PhysicalMode = 'PDT'
state.CombatWeapon = 'Polearm'
select_default_macro_book()
end
-- Called when this job file is unloaded (eg: job change)
function file_unload()
if binds_on_unload then
binds_on_unload()
end
end
function init_gear_sets()
--------------------------------------
-- Start defining the sets
--------------------------------------
-- Sets to return to when not performing an action.
-- Resting sets
sets.resting = {head="Yaoyotl Helm",neck="Wiglen Gorget",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Ares' cuirass +1",hands="Cizin Mufflers",ring1="Sheltered Ring",ring2="Paguroidea Ring",
back="Letalis Mantle",waist="Goading Belt",legs="Crimson Cuisses",feet="Ejekamal Boots"}
-- Idle sets
sets.idle = {}
-- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
sets.idle.Town = {main="Gungnir", sub="Pole Grip",ammo="Potestas Bomblet",
head="Twilight Helm",neck="Twilight Torque",ear1="Ethereal Earring",ear2="Moonshade Earring",
body="Twlight Mail",hands="Buremte Gloves",ring1="Rajas Ring",ring2="Ulthalam's Ring",
back="Updraft Mantle",waist="Zoran's Belt",legs="Crimson Cuisses",feet="Ejekamal Boots"}
sets.idle.Field = {
head="Twilight Helm",neck="Twilight Torque",ear1="Ethereal Earring",ear2="Moonshade Earring",
body="Twlight Mail",hands="Buremte Gloves",ring1="Rajas Ring",ring2="Ulthalam's Ring",
back="Updraft Mantle",waist="Zoran's Belt",legs="Crimson Cuisses",feet="Ejekamal Boots"}
sets.idle.Weak = {
head="Twilight Helm",neck="Wiglen Gorget",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Twilight Mail",hands="Buremte Gloves",ring1="Sheltered Ring",ring2="Paguroidea Ring",
back="Letalis Mantle",waist="Goading Belt",legs="Cizin Breeches",feet="Ejekamal Boots"}
-- 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 group
sets.engaged = {ammo="Potestas Bomblet",
head="Yaoyotl Helm",neck="Ganesha's Mala",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Vishap Mail",hands="Miki. Gauntlets",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Atheling Mantle",waist="Zoran's Belt",legs="Phorcys Dirs",feet="Ejekamal Boots"}
sets.engaged.Polearm.Normal = set_combine(sets.engaged, {main="Gungnir", sub="Pole Grip",ammo="Potestas Bomblet"})
sets.engaged.Polearm.Normal.Refresh = set_combine(sets.engaged, {ear1="Ethereal Earring",ear2="Brutal Earring",
body="Ares' Cuirass"})
sets.engaged.Polearm.Acc = set_combine(sets.engaged.Polearm.Normal, {main="Gungnir", sub="Pole Grip",ammo="Potestas Bomblet",
head="Ares' Mask",neck="Agasaya's Collar",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Vishap Mail",hands="Miki. Gauntlets",ring1="Rajas Ring",ring2="Ulthalam's Ring",
back="Atheling Mantle",waist="Nu Sash",legs="Lncr. Cuissots +2",feet="Wym. Greaves +2"})
sets.engaged.Polearm.Att = set_combine(sets.engaged.Polearm.Normal, {main="Gungnir", sub="Pole Grip",ammo="Potestas Bomblet",
head="Mekira-oto +1",neck="Agasaya's Collar",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Rheic Korazin +3",hands="Lncr. Vmbrc. +2",ring1="Excelsis Ring",ring2="Ulthalam's Ring",
back="Atheling Mantle",waist="Wanion Belt",legs="Miki. Cuisses",feet="Wym. Greaves +2"})
-- Melee sets for in Adoulin, which has an extra 2% Haste from Ionis.
sets.engaged.Adoulin = set_combine(sets.engaged, {})
sets.engaged.Assault = set_combine(sets.engaged, {ring2="Ulthalam's Ring"})
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)
end
-- 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)
if spell.action_type == 'Magic' then
equip(sets.precast.FC)
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)
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)
if player.hpp < 51 then
classes.CustomClass = "Breath" -- This would cause it to look for sets.midcast.Breath
end
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)
-- if state.DefenseMode == 'Reraise' or
-- (state.Defense.Active and state.Defense.Type == 'Physical' and state.Defense.PhysicalMode == 'Reraise') then
-- equip(sets.Reraise)
-- end
end
-- Runs when a pet initiates an action.
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_pet_midcast(spell, action, spellMap, eventArgs)
if spell.english:startswith('Healing Breath') or spell.english == 'Restoring Breath' then
equip(sets.HB.Mid)
end
end
-- Run after the default pet midcast() is done.
-- eventArgs is the same one used in job_pet_midcast, in case information needs to be persisted.
function job_pet_post_midcast(spell, action, spellMap, eventArgs)
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.DefenseMode == 'Reraise' or
(state.Defense.Active and state.Defense.Type == 'Physical' and state.Defense.PhysicalMode == 'Reraise') then
end
end
-- Run after the default aftercast() is done.
-- eventArgs is the same one used in job_aftercast, in case information needs to be persisted.
function job_post_aftercast(spell, action, spellMap, eventArgs)
end
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_pet_aftercast(spell, action, spellMap, eventArgs)
end
-- Run after the default pet aftercast() is done.
-- eventArgs is the same one used in job_pet_aftercast, in case information needs to be persisted.
function job_pet_post_aftercast(spell, action, spellMap, eventArgs)
end
-------------------------------------------------------------------------------------------------------------------
-- Customization hooks for idle and melee sets, after they've been automatically constructed.
-------------------------------------------------------------------------------------------------------------------
-- Called before the Include starts constructing melee/idle/resting sets.
-- Can customize state or custom melee class values at this point.
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_handle_equipping_gear(status, eventArgs)
end
-- Return a customized weaponskill mode to use for weaponskill sets.
-- Don't return anything if you're not overriding the default value.
function get_custom_wsmode(spell, action, spellMap)
end
-- Modify the default idle set after it was constructed.
function customize_idle_set(idleSet)
return idleSet
end
-- Modify the default melee set after it was constructed.
function customize_melee_set(meleeSet)
return meleeSet
end
-------------------------------------------------------------------------------------------------------------------
-- General hooks for other events.
-------------------------------------------------------------------------------------------------------------------
-- Called when the player's status changes.
function job_status_change(newStatus, oldStatus, eventArgs)
end
-- Called when the player's pet's status changes.
function job_pet_status_change(newStatus, oldStatus, eventArgs)
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)
end
function job_update(cmdParams, eventArgs)
--state.CombatForm = get_combat_form()
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements self-commands.
-------------------------------------------------------------------------------------------------------------------
-- Called for custom player commands.
function job_self_command(cmdParams, eventArgs)
end
--function get_combat_form()
-- if areas.Adoulin:contains(world.area) and buffactive.ionis then
-- return 'Adoulin'
-- end
--end
-- 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)
classes.CustomMeleeGroups:clear()
if areas.Adoulin:contains(world.area) and buffactive.ionis then
classes.CustomMeleeGroups:append('Adoulin')
end
if areas.Assault:contains(world.area) then
classes.CustomMeleeGroups:append('Assault')
end
end
-- Job-specific toggles.
function job_toggle(field)
end
-- Request job-specific mode lists.
-- Return the list, and the current value for the requested field.
function job_get_mode_list(field)
end
-- Set job-specific mode values.
-- Return true if we recognize and set the requested field.
function job_set_mode(field, val)
end
-- Handle auto-targetting based on local setup.
function job_auto_change_target(spell, action, spellMap, eventArgs)
end
-- Handle notifications of user state values being changed.
function job_state_change(stateField, newValue)
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 determine_groups()
classes.CustomMeleeGroups:clear()
-- If sub job has MP then set refresh groups for refresh gear
if player.sub_job == 'WHM' or player.sub_job == 'BLM' or player.sub_job == 'RDM' or player.sub_job == 'PLD' or player.sub_job == 'DRK' or player.sub_job == 'BLU' or player.sub_job == 'SCH' or player.sub_job == 'SMN' or player.sub_job == 'GEO' or player.sub_job == 'RUN' then
classes.CustomMeleeGroups:append('Refresh')
end
-- for groups that may vary if food is used
if buffactive.food then
classes.CustomMeleeGroups:append('Food')
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 == 'WAR' then
set_macro_page(2, 1)
elseif player.sub_job == 'NIN' then
set_macro_page(4, 1)
elseif player.sub_job == 'SAM' then
set_macro_page(1, 1)
elseif player.sub_job == 'WHM' then
set_macro_page(3, 1)
else
set_macro_page(1, 1)
end
end
-- Examine equipment to determine what our current TP weapon is.
--function pick_tp_weapon()
-- if drg_polearms:contains(player.equipment.main) then
-- state.CombatWeapon = 'Polearm'
-- else
-- state.CombatWeapon = nil
-- state.CombatForm = nil
-- end
-- end
Just looking for someone to explain this addon a bit for me. It looks like it is an alternative to Spellcast.
Is it going to be replacing Spellcast? In which ways is it better or worse. I don't know any programming but I've slowly learned more and more about spellcast and the 'language' used in gearswap is confusing to me.
It says it uses packets so it potentially could be more detectable? but does that also eliminate any lag that spellcast may encounter?
I plan on redoing my PUP xml to include pet casting sets thanks to the new addon petschool. I'm just not sure if it's worth it to just wait until gearswap gets more popular or to go ahead and do it in spellcast.
If anyone could give me more info I'd greatly appreciate it.