Here's a new method of checking your position relative to your target (sort of). Basically, it'll parse an error frame, and when the message "You must be behind your target" fires it'll run your code (or return true or false if you want).
Rogue example:
Code:
if not behindCheck then
behindCheck = CreateFrame("Frame")
end
local frame = behindCheck
frame:RegisterEvent("UI_ERROR_MESSAGE")
frame:SetScript("OnEvent", function(self, event, ...)
if (select(1,...):find("behind") ~= nil) then
CastSpellByName("Gouge") --do stuff here
end
end)
CastSpellByName("Backstab");
It may be useful to add a timer function to this as well.