Ah, so it works like this:
1) It notices that you're trying to cast a spell/etc.
2) It deletes your attempt (saves it) and calls your precast function.
3) You use equip() commands in your precast function, which assemble a gearset to be equipped.
4) It leaves your user function, checks whether the thing can be equipped, and sends the appropriate packets to equip it.
5) It sends the command to the game immediately if there is no verify_equip or cast_delay.
6) There's a pretty good chance that your equip commands are going out in the same chunk as the action command, so whether or not you're swapped when the server interprets your action command is just down to luck.
For me with No Foot Rise and AF2+2 body, it worked fine once without any delay. Other times it might not work, I don't know. I know it essentially always works with 0.2 seconds delay in low-lag areas. I can probably push that down. This is not something that I intend to compensate for in the addon itself. I have given addon writers all the available tools to deal with the problem and they're just going to have to pick the solution they want.
This also allows users to make rules that check whether a spell is worth precasting if you have to wait 0.2 seconds to do so:
Code:
if spell.casttime*(1-percent_FC) > 0.2 then
cast_delay(0.2)
end
...or rules that force precasts on very long spells regardless how long it takes:
Code:
if string.find(spell.name,'Reraise') then
verify_equip()
end
Not including cast_delay or verify_equip is also an option, if it's something like Steps where I couldn't really give two shits whether or not my Acc gear swaps before they go off.