Tried to remove my "modified" version of your original code (thanks for the clarification btw, I understand the need of putting it into midcast now) and put this new version inside.
But I still get the old error I used to get with the original one on this line:
coroutine.schedule(function () casting = false end, (spell.cast_time/4+.5))
Error is: "filename: linexxx: attempt to perform arithmetic on field 'cast_time' (a nil value)"
I think this is because there's a line that you created that's not working, this one:
if not windower.wc_match(spell.type, 'JobAbility|WeaponSkill') then
It was a line to exclude the following line from being executed unless the spell.type was NOT a Jobability or Weaponskill.
Well, for some reason it seems it's not working, and that's why I get the arithmetic error.
How can I fix this line to make it correctly exclude JAs and WSs?
EDIT:
nevermind found a way to fix it.
It wasn't working on Runes because their spell.type is "rune", not "JobAbility".
I changed spell.type to spell.prefix and created the following line
if spell.prefix ~= '/jobability' and spell.prefix ~= '/weaponskill' then
now it seems to be working
