→Lua Questions
(Initial first draft, needs lots more contributions! :)) |
|||
| Line 45: | Line 45: | ||
;Q) What is Lua? | ;Q) What is Lua? | ||
:A) See the [[Lua]] page for some basic details. | :A) See the [[Lua]] page for some basic details. | ||
;Q) Why doesn't [[API UnitDebuff|UnitDebuff]] accurately report the spell I just cast? | |||
:A) There is a ~0.5 second gap between the end of a spell being cast and its associated debuff texture showing up on the unit upon which it was cast. This gap causes problems for "Smart Cast" scripts which try to prevent a spell like Immolate from being run when the target already has the debuff on it. If there is a pause between casting, the script would work; however, if the script is triggered rapidly then it is likely to try to cast Immolate twice (since it does not yet see the debuff on the target unit). The workaround for this problem is to subscribe to the SPELLCAST_STOP event. Every time that event is triggered, store the [[API GetTime|current time]] in a variable. From then on, whenever you subtract the [[API GetTime|current time]] from the stored time of the last SPELLCAST_STOP event, you get the time (in seconds) since the last spell stopped. If that time is greater than 0.5, you can proceed to cast your spell. If not, do not cast your spell. Note: this is not an issue for instant cast spells (their debuffs seem to be immediately noticeable), therefore it would be inefficient to do this check on them. | |||
==XML Questions== | ==XML Questions== | ||