I cannot figure out what the issue is but I'm receiving this error repeatedly...
Error 1
> GearSwap: Lua error (runtime) - ...gram Files (x86)/Windower4//addons/GearSwap/flow.lua:288: > GearSwap has detected an error in the user function pretarget: > ...(x86)\Windower4\/addons/GearSwap/data/Player_THF.lua:298: attempt to compare number with nil
This is line 298
elseif (spell.english == 'Ranged' and spell.target.distance > 24.0) or (spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged') then
The full function of 298 is
function pretarget(spell,action) if (spell.type:endswith('Magic') or spell.type == "Ninjutsu") and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced -- cancel_spell() send_command('input /item "Echo Drops" <me>') elseif spell.english == "Berserk" and buffactive.Berserk then -- Change Berserk To Aggressor If Berserk Is On -- cancel_spell() send_command('Aggressor') elseif (spell.english == 'Ranged' and spell.target.distance > 24.0) or (spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged') then -- Cancel Ranged Attack or WS If You Are Out Of Range -- cancel_spell() add_to_chat(123, spell.name..' Canceled: [Out of Range]') return end end
I think it's related to this at the beginning of the file but I'm not certain.
-- Set Default Distance Here -- target_distance = 6
Error 2
> GearSwap: Lua error (runtime) - ...gram Files (x86)/Windower4//addons/gearswap/flow.lua:288: > GearSwap has detected an error in the user function precast: > ...(x86)\Windower4\/addons/gearswap/data/Player_THF.lua:575: attempt to call global 'find_player_in_alliance' (a nil value)
The function line 575 is "local target = find_player_in_alliance(spell.target.name)"
function refine_waltz(spell,action) if spell.type ~= 'Waltz' then return end if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then return end local newWaltz = spell.english local waltzID local missingHP if spell.target.type == "SELF" then missingHP = player.max_hp - player.hp elseif spell.target.isallymember then local target = find_player_in_alliance(spell.target.name) local est_max_hp = target.hp / (target.hpp/100) missingHP = math.floor(est_max_hp - target.hp) end if missingHP ~= nil then if player.sub_job == 'DNC' then if missingHP < 40 and spell.target.name == player.name then add_to_chat(123,'Full HP!') cancel_spell() return elseif missingHP < 150 then newWaltz = 'Curing Waltz' waltzID = 190 elseif missingHP < 300 then newWaltz = 'Curing Waltz II' waltzID = 191 else newWaltz = 'Curing Waltz III' waltzID = 192 end else return end end local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50, ['Curing Waltz IV'] = 65, ['Curing Waltz V'] = 80} local tpCost = waltzTPCost[newWaltz] local downgrade if player.tp < tpCost and not buffactive.trance then if player.tp < 20 then add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.') cancel_spell() return elseif player.tp < 35 then newWaltz = 'Curing Waltz' elseif player.tp < 50 then newWaltz = 'Curing Waltz II' elseif player.tp < 65 then newWaltz = 'Curing Waltz III' elseif player.tp < 80 then newWaltz = 'Curing Waltz IV' end downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.' end if newWaltz ~= spell.english then send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw)) if downgrade then add_to_chat(158, downgrade) end cancel_spell() return end if missingHP > 0 then add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.') end end
Any help with this would be appreciated. It's getting to be very annoying seeing these errors so often in console log. Is it better to just remove the function pretarget(spell,action) and waltz altogether being a THF?
Thanks for your time and help