• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Targeting Mode

Status
Not open for further replies.
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.
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
 
Level 40
Joined
Feb 27, 2007
Messages
5,078
I’m pretty excited about this. Been working on a system that allows multiple point targeting for spells and I’ve been stuck trying to detect if they’re still in targeting mode trying to use periodic timers that force hotkeys.
 
Status
Not open for further replies.
Top