Nameplates
Quote:
(typical for nameplate addons looking for nameplates) Note: Pulled these posts from MoP beta topic as they're no longer MoP specific. - Haleth |
Quote:
|
You still need to use WorldFrame:GetChildren() to actually iterate through potential frames. Then you can check them by name.
It would be much better if we could hook into the function that creates nameplates, but we don't have access to it. |
Quote:
Lua Code:
|
Quote:
might have to poach it for a couple addons that I've had to keep disabled in beta. :p Edit: Scratch that, a while loop won't work sadly, nameplate frames are reused for one so you don't always have a nice collection of sequential frames from 1 to n. Even if we did have that, it would still need to wrap around to index 1 when it exits the while loop. It's food for thought definitely... And another function that hard crashes the client (no addons present) GetDestinationReforgeStats() (build 15882) |
Okay, p3lim, that's clever. Should be quite a bit more efficient :p
|
Quote:
Lua Code:
|
Quote:
The OnShow handler ensures that the next time the frame is reused, we can handle updating the frame again. |
Quote:
|
Quote:
Unlike most frames, the nameplates are written (or wrapped) in C, and will not reload like the rest of the UI does. Here is a way to counter this: Lua Code:
|
Wouldn't that loop run 'forever' and keep bumping index if you happen to reload in an area with no nameplates?
|
I'd still prefer to limit the while loop to run only, say, 10 times per second, rather than every new frame. Comparing two numbers (to check if enough time has elapsed) is likely far more efficient CPU-wise than looking up a frame in _G.
Btw, I pulled these posts from the MoP topic. |
Quote:
A possible solution instead of the previous would be using a combination of an event and function that only works on a login (not reload) to reset a SV containing a variable that is set on PLAYER_LOGOUT to keep counting properly. It would lead into a monstrosity though. |
Quote:
|
Perhaps we should just request on the official forums that they add a better way for addons to do this. Since it's handled outside of lua, perhaps there could be an event like NAMEPLATE_CREATED, passing the frame as a parameter.
They listened to the request for new macro conditionals. Worth a shot, or? |
Quote:
Also, frame name or id would be enough, don't think they'd go for passing the whole frame table. Remember, I am not trying to replace the current method we are using, this is just a temporary thing to work around the issues on the beta client, and perhaps find something nice while we're at it. I agree that the nameplates should be easier to do anything with, but blizzard is avoiding showing the code, most likely to counter potential bots. |
Here we go, PLAYER_LOGOUT event saving the last index to a savedvariable, two OnUpdate scripts iterating either a new index or the savedvariable, and either of them shuts down the savedvariable one.
Lua Code:
|
Also, move this to the proper MoP discussion sub-forum, as it is not related to live clients.
|
Quote:
|
All times are GMT -6. The time now is 06:11 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI