
Originally Posted by
Cambion
Hey Mote,
Spoke to Byrth about this in Dnc forums, but didn't quite get it resolved, know you're both busy.
Was looking for the proper way to include an automatic Presto Macro for Steps, that triggers when Finishing moves are below 3.
I'm using your Dnc.Lua, with a sidecar for gear as recommended by Fiv.
All right.

Originally Posted by
Cambion
Byrth offered me the following code:
Code:
if windower.wcmatch(spell.name,'*step') and not buffactive.presto and player.main_job_level > 77 and (not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5']) then
cast_delay('2')
send_command('input /ja "Presto" <me>')
end
And told me, "Also, this code should be in the pretarget function, but your gear changes for Steps should be in the precast function."
Issue I ran into was neither his Dnc.lua nor yours appears to have a pretarget section.
There's no pretarget function in the provided files because nothing is being done that needs to go in the pretarget function. If you need to add something to pretarget (or any other function not explicitly provided), obviously you need to add that function. For mine, check the Template.lua file, as it should have all (or at least most) of all possible functions for use within a job file.

Originally Posted by
Cambion
So, I searched around and pulled one from another gearswap and inserted:
Code:
function job_pretarget(spell, action, spellMap, eventArgs)
if windower.wcmatch(spell.name,'*step') and not buffactive.presto and player.main_job_level > 77 and (not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5']) then
cast_delay('2')
send_command('input /ja "Presto" <me>')
end
end
but couldn't get it to work, was getting (a nil value) error at the wcmatch line.
Wildcard matches (wcmatch() function) are almost never a good idea. They're there solely for those who have no idea how to do comparisons outside of what they learned in Spellcast.
For this purpose, what you want is:
Code:
if spell.type == 'Step' then
...
end
The main job level check is probably irrelevant, but if you do any level capped stuff might as well leave it in. Beyond that, we also want to check Presto's recast time, since you can try another step while Presto is still on cooldown.
So, before doing this, we need to check:
Are we trying to use a step?
Are we at a level appropriate for using Presto?
Is Presto available to use? (this also duplicates the check for if we have the buff active, since if we do then cooldown will also be above 0)
Do we have fewer than 3 finishing moves?
Code:
function job_pretarget(spell, action, spellMap, eventArgs)
if spell.type == 'Step' then
local allRecasts = windower.ffxi.get_ability_recasts()
local prestoCooldown = allRecasts[236]
local under3FMs = not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5']
if player.main_job_level >= 77 and prestoCooldown < 1 and under3FMs then
cast_delay(1.1)
send_command('input /ja "Presto" <me>')
end
end
end
There were a couple bugs in Gearswap that prevented this from working properly before. They've been fixed now, so this should be fine.

Originally Posted by
Cambion
Second request is far less important, and probably more simple.
For Waltz 3, I'd like to use Set A if engauged. (Anwig Salade)
Set B if I'm idle. (Tiara+2)
Since you're using my includes, I'd do this:
Sets:
Code:
sets.precast.Waltz = {standard waltz gear with Salade}
sets.precast.Waltz.Idle = set_combine(sets.precast.Waltz, {head="Etoile Tiara +2"})
sets.precast.Waltz['Healing Waltz'] = {head="Anwig Salade"}
Rules:
Code:
function job_precast(spell, action, spellMap, eventArgs)
if spell.type == 'Waltz' and player.status == 'Idle' then
classes.CustomClass = 'Idle'
end
end
Note: Need to update to the latest Mote-Include to be sure it handles custom classes on ability types. I'd been messing with this off and on, so might as well settle on a final form.

Originally Posted by
Cambion
:/ and there's a third thing.
Mote, your Dnc.lua doesn't have auto cancels for Saber/Fan Dance's based on Waltz/Sambs's respectively.
Byrth's does, so I tried inserting his rules into your .lua as follows:
Code:
function precast(spell,act)
cast_delay(0)
if sets.JA[spell.name] then
if spell.name == 'Trance' and buffactive['saber dance'] then
send_command('cancel 410')
end
equip(sets.JA[spell.name])
elseif sets.WS[spell.name] then
if sets.WS[spell.name][atk_lvl] then
equip(sets.WS[spell.name][atk_lvl])
end
elseif spell.type=='Jig' then
equip(sets.JA.Jig)
if spell.name == 'Spectral Jig' and buffactive.sneak then
send_command('cancel 71')
end
elseif spell.type=='Samba' then
if buffactive['fan dance'] then
send_command('cancel 411')
end
equip(sets.JA.Samba)
elseif spell.type=='Waltz' then
if buffactive['saber dance'] then
send_command('cancel 410')
end
equip(sets.JA.Waltz)
elseif spell.type=='Step' then
equip(sets.JA.Step)
elseif string.find(spell.name,'Utsusemi') then
equip(sets.MA.Utsusemi)
elseif string.find(spell.name,'Monomi') then
send_command('@wait 1.7;cancel 71')
end
But that wouldn't work either.
Thanks/sorry/etc
First: don't set cast_delay to 0. That will override what you did to make automatic Presto work.
Second: Take out every one of those equip() commands. They're all handled automatically by the include.
Third: Don't make your conditionals depend on the set existing; that's handled by the main include. You should only ever be checking spell info.
Fourth: All these cancels should go in their own function, rather than be a direct part of precast().
Fifth: You shouldn't have inserted precast(); it should be job_precast().
Since you're combining it with the above request on waltzes, it should be something like this:
Code:
function job_precast(spell, action, spellMap, eventArgs)
if spell.type == 'Waltz' and player.status == 'Idle' then
classes.CustomClass = 'Idle'
end
cancel_conflicting_buffs(spell, action, spellMap, eventArgs)
end
function cancel_conflicting_buffs(spell, action, spellMap, eventArgs)
if spell.name == 'Spectral Jig' and buffactive.sneak then
send_command('cancel sneak')
elseif (spell.name == 'Trance' or spell.type=='Waltz') and buffactive['saber dance'] then
send_command('cancel saber dance')
elseif spell.type=='Samba' and buffactive['fan dance'] then
send_command('cancel fan dance')
elseif spell.name:startswith('Monomi') then
send_command('@wait 1.7;cancel sneak')
elseif spell.name == 'Utsusemi: Ichi' then
send_command('@wait 1.7;cancel copy image*')
end
end
Note: assuming use of the cancel addon, which lets you specify buffs by name. Also, not entirely sure on the utsusemi rule.
I'll actually add this as a utility function for general use.