Right now I am trying to figure out how to make a very fast bit of code to broadcast my targetoftarget to a frame or chat message.
The goal here is to catch boss target swaps that are faster then my UI can update visually(pitbull3 is a bit slow, gonna try 4 next week) so I can heal incoming damage faster. Originally I wanted to dump the target swaps into my focus frame for x seconds... but yeah, protected. =[ Dealing with that is way above me.
How do I poll for target of target changes very fast, I understand there is no event for this?
How do I deal with the protected issues?
targetoftarget's will always be players in the raid... so I could create a 'recently targeted by my target' frame for units in raid? Ideas?
There's no way you can automatically set your target's target as your focus unless you constantly press a button that does it. That's what "protected" means. Addons cannot call protected functions, period. You don't "deal with it".
As for checking your target's target and notifying you when it changes, yes, that's possible. Your unit frame addon likely throttles this check to avoid excessive CPU usage, but you can easily write your own check that isn't throttled. There is no event, correct, but that's what OnUpdate is for. Every time a new video frame is drawn, OnUpdate scripts on all UI frames are run. So, if you're running at 10 FPS, OnUpdate handlers will be called 10 times per second. At 60 FPS, 60 OnUpdates per second. It's important to make sure OnUpdate scripts do as little processing as possible, to avoid performance degradation.
Here is a quick drycoded example, with basic optimizations to only run the check while you have a hostile non-player target: http://paste.wowace.com/544/
UNIT_TARGET only fires for player, pet, partyN, partypetN, raidN, raidpetN, and maybe focus (though I haven't tested that). It does not fire when your target's target changes, any more than it fires when raid14's target's target changes. Blizzard's code and all unit frame addons use OnUpdate to track the target-of-target... addons sometimes throttle their OnUpdate, which is why they can seem slow in this regard.
Well, Banzai doesn't necessarily tell you if a specific mob's target has changed, so that probably won't work. The code I posted is a minimal version of what Blizzard does for their ToT display in the default UI.