
Originally Posted by
viperkc
What do i need to change in this Moten:
1) A simpler way of determining if you're using spells (and need echo drops) is:
Code:
if spell.action_type == 'Magic' and buffactive.silence then
This also works for bard songs, which your code won't.
2) Instead of calling get_ability_recasts() multiple times, just call it once and assign it to a variable. You can also do just a single check for amnesia at the top level, rather than checking it on every single conditional.
Code:
elseif spell.english == 'Ranged' and not buffactive.amnesia then -- Auto WS/Decoy Shot/Double Shot --
if player.tp >= 100 and AutoMode == 'ON' then
cancel_spell()
autoWS()
else
local recasts = windower.ffxi.get_ability_recasts()
if recasts[52] < 1 then
cancel_spell()
send_command('DecoyShot')
elseif recasts[126] < 1 then
cancel_spell()
send_command('DoubleShot')
elseif recasts[129] < 1 then
cancel_spell()
send_command('VelocityShot')
end
end
end
3) This one is a clumsy mess. I'd break it down into individual tests, even if the resulting actions are redundant.
Code:
elseif (spell.english == 'Ranged' and spell.target.distance > 24.9) or
(player.status == 'Engaged' and
((ranged_ws:contains(spell.english) and spell.target.distance > 16+target_distance) or
(spell.type == "WeaponSkill" and not ranged_ws:contains(spell.english) and spell.target.distance > target_distance))) then
cancel_spell()
add_to_chat(123, spell.name..' Canceled: [Out of Range]')
return
Note: I'm not sure about the player.status == 'Engaged' bit. Not entirely sure what your intent there is. As originally written, it will give you the distance warning if you're engaged, but won't warn you if you're not engaged. This does the same thing.
Code:
elseif spell.english == 'Ranged' and spell.target.distance > 24.9 then
cancel_spell()
add_to_chat(123, spell.name..' Canceled: [Out of Range]')
return
elseif spell.type == 'WeaponSkill' and player.status == 'Engaged' then
if spell.skill == 'Archery' or spell.skill == 'Marksmanship' then
if spell.target.distance > 16+target_distance then
cancel_spell()
add_to_chat(123, spell.name..' Canceled: [Out of Range]')
return
end
else
if spell.target.distance > target_distance
cancel_spell()
add_to_chat(123, spell.name..' Canceled: [Out of Range]')
return
end
end
~~