Alright, thanks again.
Alright, thanks again.
Having trouble getting this bit of code to work... currently does nothing. I'm wondering if my syntax is incorrect
Trying to make it activate presto automatically every time the buff is available and when a step is used.
Code:if spell.type == '*step' and not buffactive['Presto'] then if not buffactive['Finishing Move*'] or buffactive['Finishing Move 2'] then cancell_spell() send_command('input /ja "Presto" <me>;wait 1.5;input /ja "'..spell.name..'" <t>;') end end
spell.type for steps is going to be JobAbility, so the condition above is never valid, which is why it's not doing anything. (I haven't looked to see if it has other problems).
you'd want spell.name there. I'm also not sure that wildcards are valid in string literals in lua. you might need to use if string.find(spell.name:lower,'step') if spell.name=='*Step' doesn't work.
Any of these will work fine:
Code:spell.name:match('.*Step') windower.wc_match(spell.name, '*Step') spell.name:wcmatch('*Step') windower.regex.match(spell.name, '.*Step')
Thanks for the help guys!! :D Appreciate it.
This ends up working but another issue has appeared. I think it has something to do with my second if statement:Code:if string.find(spell.name:lower(), 'step') and not buffactive['Presto'] then if not buffactive['Finishing Move*'] or buffactive['Finishing Move 2'] then cancel_spell() send_command('input /ja "Presto" <me>;wait 1.5;input /ja "'..spell.name..'" <t>;') end end
It will try to activate Presto even when there's more than 2 finishing moves.Code:if not buffactive['Finishing Move*'] or buffactive['Finishing Move 2'] then
You can't lookup by wildcard. 'Finishing Move*' is looking for the entry keyed to the literal string 'Finishing Move*'.
Thanks that always gets me when coding..
Changing it to this made it work correctly:
Final code looks like this:Code:if (not buffactive['Finishing Move']) or buffactive['Finishing Move 2'] then
Yeah I ended up figuring that out the hard way >.<Code:-- Activates Presto when a step is used. if string.find(spell.name:lower(), 'step') and not buffactive['Presto'] then if (not buffactive['Finishing Move']) or buffactive['Finishing Move 2'] then cancel_spell() send_command('input /ja "Presto" <me>;wait 2;input /ja "'..spell.name..'" <t>;') end end
Tried to do another spell table for NIN but some how mucked it up.
Code:-- Maps Ninja spell nukes for the midcast function, can change mapping as needed ninjaSpells = T{'Doton: Ichi', 'Huton: Ichi', 'Hyoton: Ichi', 'Katon: Ichi', 'Raiton: Ichi', 'Suiton: Ichi', 'Doton: Ni', 'Huton: Ni', 'Hyoton: Ni', 'Katon: Ni', 'Raiton: Ni', 'Suiton: Ni', 'Doton: San', 'Huton: San', 'Hyoton: San', 'Katon: San', 'Raiton: San', 'Suiton: San'}I am certain it is an easy fix but for the life of me I cant seem to get it.Code:if spell.skill == 'Ninjutsu' then if ninjaSpells[spell.english] then equip(sets.midcast.Ninjutsu.Nuke) else equip(sets.midcast.Ninjutsu) end end
Please help.
Instead of this
do thisCode:if ninjaSpells[spell.english] then
Code:if ninjaSpells:contains(spell.english) then
If you use table literal creation and do not specify keys, you are doing this:
ninjaSpells[spell.english] will never exist because you're checking for a key as a spell name while your keys just enumerate from 1. You can use table.contains(ninjaSpells, spell.english) or construct your table differently.Code:T{'Doton: Ichi', 'Huton: Ichi', 'Hyoton: Ichi', 'Katon: Ichi', 'Raiton: Ichi', 'Suiton: Ichi', ... } --Is the same as T{[1] = 'Doton: Ichi', [2] = 'Huton: Ichi', [3] = 'Hyoton: Ichi', [4] = 'Katon: Ichi', [5] = 'Raiton: Ichi', [6] = 'Suiton: Ichi', ... }
Using S{...} instead of T{...} should automatically do what you want, and it is the equivalent of doing
tl;dr --Code:T{ ['Doton: Ichi'] = true, [Huton: Ichi'] = true, ['Hyoton: Ichi'] = true, ...}
Change to
Code:ninjaSpells = S{'Doton: Ichi', 'Huton: Ichi', 'Hyoton: Ichi', 'Katon: Ichi', 'Raiton: Ichi', 'Suiton: Ichi', 'Doton: Ni', 'Huton: Ni', 'Hyoton: Ni', 'Katon: Ni', 'Raiton: Ni', 'Suiton: Ni', 'Doton: San', 'Huton: San', 'Hyoton: San', 'Katon: San', 'Raiton: San', 'Suiton: San'}
I hope one day to really grasp this stuff, til then thank you all again for the help.
Amazing people the whole lot of you!
question regarding cancelling sneak for jig, i copied this snippet from byrth's example dnc file but am not getting it to work:
i put it into motenten's pup file right after all the sets are defined, below this part:Code:function precast(spell,act) cast_delay(0) if spell.name == 'Spectral Jig' and buffactive.sneak then send_command('cancel 71') end end
edit: figured it out, i think. pasted it into the mote-include at this section and it seems to work now:Code:-- Called when this job file is unloaded (eg: job change) function file_unload() --spellcast_binds_on_unload() end
Code:-- Perform default equips if the job didn't handle it. if not eventArgs.handled then equip(get_default_precast_set(spell, action, spellMap, eventArgs)) end if spell.name == 'Spectral Jig' and buffactive.sneak then send_command('cancel 71') end -- Allow followup code to add to what was done here if job_post_precast then job_post_precast(spell, action, spellMap, eventArgs) end
You shouldn't be modifying Mote-Include like that if you can help it. From where you put it, you could create a job_post_precast() function in your job lua and put it in there. Though really, putting it in job_precast() should also work.
I was wondering is there a way to modify your refine_waltz function in your dnc lua into it's own .lua that can be called/included by other job.lua files.. similar to how you did MoteInclude?
For Example say I have a WAR, PUP, and MNK lua files and instead of copying the function into each lua I just call or load a seperate .lua with just that refine_waltz function.
i don't really understand the language or structure well enough yet to do much other than copy+paste and cross my fingers, so will see if i can make sense of that later today if it will be an issue at some point.
@Gaira: Basically, you shouldn't be changing Mote-Include at all (except maybe a few variables up at the top). Ideally, when a new Include comes out with bug fixes or enhancements, you can just drop it in as a replacement for your own version and have everything continue to work. Everything it does, it allows the job files to override, so if you need anything to work differently from the default, just modify it in the job file.
@Treize: yes, that would be doable. I can just add an extra check for if dnc is the subjob to prevent it from trying to change to waltz 4/5. Since it's just one function, I can probably put it in Mote-Include; however I may want to still keep it as an outside library for other stuff. Hmm. Will see.
I think keeping it separate in it's own file would be the better way than placing it in Mote-Include. I just tried doing it myself but I kept getting error: Bad Argument #1 in Pairs (table expected, got nil). Keeping coming up for user_functions.lua line 217.
I dunno.. thought it was a good idea but implementing it is something else lol.
Please post all errors that you guys get in the GearSwap files to my issue tracker so I can add error handling for them. I tried to anticipate all possible errors but doubtlessly missed some.
Any examples for checking to see if you have 3 runes or maneuvers up of the same type up?