it needs to be
sets.precast.FC["Blue Magic"]
it needs to be
sets.precast.FC["Blue Magic"]
dlsmd and moten thanks for the help it works like a charm i would have liked to have it do like a counter thing were if i was paralyzed but i really had to use that ja to win the fight i could try it and on the third time it would unlock and do it but that seams like alot of work so i wont bother >.> thanks again
then would
if spell.name == "Ranged"
then be better off
if spell:contains(spell.english, 'Ranged') then
?
No. What you wrote -- spell:contains(spell.english, 'Ranged') -- will never work. It's not looking at the right thing in remotely the right way.
spell.name == "Ranged" is... 'adequate', but well down the list of the way I would do it.
In order of preference, I'd use one of:
if spell.action_type == "Ranged Attack" then
if spell.english == "Ranged" then
if spell.name == "Ranged" then
so would there be a faster way of doing
if spell.type == 'WeaponSkill' then
Motenten so you saying that i have to do this
like thisCode:Waltz.debuff = S{'Max HP Down','Max MP Down','Magic Evasion Down','Max TP Down','Magic Atk. Down','Magic Acc. Down','Magic Def. Down','Defense Down','Evasion Down','Attack Down','Accuracy Down','CHR Down','AGI Down','DEX Down','VIT Down','MND Down','INT Down','STR Down','Bane','Bio','Blind','Curse','Dia','Disease','Shock','Rasp','Choke','Frost','Burn','Drown','Flash','Paralyze','Plague','Poison','Silence','Slow','Weight'} Waltz.debuff[buffactive]
Code:(buffactive['Max HP Down'] or buffactive['Max MP Down'] or buffactive['Magic Evasion Down'] or buffactive['Max TP Down'] or buffactive['Magic Atk. Down'] or buffactive['Magic Acc. Down'] or buffactive['Magic Def. Down'] or buffactive['Defense Down'] or buffactive['Evasion Down'] or buffactive['Attack Down'] or buffactive['Accuracy Down'] or buffactive['CHR Down'] or buffactive['AGI Down'] or buffactive['DEX Down'] or buffactive['VIT Down'] or buffactive['MND Down'] or buffactive['INT Down'] or buffactive['STR Down'] or buffactive.bane or buffactive.Bio or buffactive.blindness or buffactive.curse or buffactive.Dia or buffactive.disease or buffactive.Shock or buffactive.Rasp or buffactive.Choke or buffactive.Frost or buffactive.Burn or buffactive.Drown or buffactive.Flash or buffactive.paralysis or buffactive.plague or buffactive.poison or buffactive.silence or buffactive.slow or buffactive.weight)
@dlsmd: That would be the long way of doing it, yes. And yes, the second would be correct, while the first would not work.
However a better way to do it would be to use certain functions:
Code:buffs_to_check = S{'Max HP Down','Max MP Down','Magic Evasion Down','Max TP Down','Magic Atk. Down','etc...'} ~ function precast(spell) if has_any_buff_of(buffs_to_check) then -- do whatever end end -- utility functions to make using this call as simple as possible: -- buff_set is a set of buffs in a library table (any of S{}, T{} or L{}). -- This function checks if any of those buffs are present on the player. function has_any_buff_of(buff_set) return buff_set:any(has_buff()) end -- Helper function to return the evaluation function used by has_any_buff_of. function has_buff() return function (b) return buffactive[b] end end
i dont see how that works can you explain it to me??
i think that
has_any_buff_of(buffs_to_check)
sends the buffs i want to check to
function has_any_buff_of
if im thinking correctly
creates a table with all of my current buffs in itCode:function has_buff() return function (b) return buffactive[b] end end
and
checks to see if any of my buffs to check are in the table of the buffs i haveCode:function has_any_buff_of(buff_set) return buff_set:any(has_buff()) end
im not sure if this is correct
May I ask what you wanna do? Coz IMO would be easier just to list the debuff healing waltz can't remove...
Correct.
Not correct.
Sort of correct, but not entirely.
This just lists the buffs you're checking for:
Code:buffs_to_check = S{'Max HP Down','Max MP Down','Magic Evasion Down','Max TP Down','Magic Atk. Down','etc...'}
This calls the utility function, passing it the above list as the parameter to check.
This uses the :any() function that's defined for all library tables (S/L/T). The :any() function iterates over the list and calls the function you pass as the parameter on each one. If at any time the result of using the function on one of the values of the list is true, :any() returns true. Otherwise, once it goes through the entire list, it returns false.Code:function precast(spell) if has_any_buff_of(buffs_to_check) then -- do whatever end end
Code:function has_any_buff_of(buff_set) return buff_set:any(has_buff()) end
This provides the function that's being passed as a parameter to :any(). I set it as a separate function to make things a little bit less of a garbled mess.
The function that gets passed to :any() takes a single parameter (the value of the list to be checked) and tests to see whether a buff of that name is active on the player. If so, it returns true; otherwise false.
Code:function has_buff() return function (b) return buffactive[b] end end
So the overall logic, if written entirely in the precast() function, expands out so that:
becomes:Code:function precast(spell) if has_any_buff_of(buffs_to_check) then -- do whatever end end
Though there's some extra stuff in :any() that handles the differences between the different types of library tables as well.Code:function precast(spell) local has_buff = false for val in buffs_to_check do if buffactive[val] then has_buff = true break end end if has_buff then -- do whatever end end
thx mote that explains it for me
I seem to have trouble with the Black Mage lua that is in the shop thread, the one by Kinematics.
It doesn't seem to actually swap between the low tier nuking (default nuking set in it's case) and high tier nuking at all. It only uses the default set no matter what nuke I cast.
Everything else seems to work fine, curing, enfeebles, etc, it's only the high tier gear swap that it's not doing. Even with no edits to the lua, it's still not swapping to high tier.
I have all the motes if that's relevant.
If you have not updated from the github repository recently, make sure that all sets that have skills in their name are changed from .ElementalMagic to ['Elemental Magic'], etc.
I used the exact one that's on github right now (the one that your signature links point to.) I tried it not even a few hours ago. So it's as recent as it can be. Which is why I'm wondering if it's a fault in the script.
Ok, I'd missed some additional instances that needed to be fixed. Updated and pushed to master branch on github.
Awesome. Works perfectly now. Thanks a bunch. What was it that you fixed?
Can I use a variable in place of an equipment name inside of a set?
Example:
set.Test = {head=Var}
Somewhere else, presumably before I define that set, I'd define Var = 'Equip Name'.
Yes, but only if you use Var = {name="Equip Name"}
If Var is a string, it will undergo static assignment when set.Test is first defined. If it is a table, the table ID will be assigned to set.Test.head, and then you're free to change set.Test.head.name to be whatever you want.