- Joined
- Jul 18, 2010
- Messages
- 2,377
After I saw how TriggerHappy uses BlzFrameIsVisible to know, if a game is a replay. I had the idea that one could use a similar technique to know, if the local player is selecting a target for his current command.
That Technique in not sync on itself and might be not 100% safe.
In Targeting mode all command Buttons except the last (cancel) are hidden -> Means when only the 11. Button is visible the player is probably in Targeting Mode.
When one runs that function frequently one should be able to detect it.
That Technique in not sync on itself and might be not 100% safe.
In Targeting mode all command Buttons except the last (cancel) are hidden -> Means when only the 11. Button is visible the player is probably in Targeting Mode.
When one runs that function frequently one should be able to detect it.
Lua:
function isInTargetingMode()
local index = 0
repeat
if BlzFrameIsVisible(BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, index)) then break end
index = index + 1
until index == 12 --when 12 is reached no button is visible
return index == 11 --when the loop broke in index == 11 its targeting mode
end