Hooking a hooked function (tooltips specifically)
I've seen a few posts on hooking and such and they have all worked just fine. Unfortunately, I haven't seen any covering or how to deal with functions that are already hooked by another mod. What I'm trying to do is hook the UnitFrame_OnEnter function, so that I can let my mod have some TipBuddy support. The mod I'm working on is a unit frame mod so I need to have a custom UnitFrame_OnEnter for each frame (such as target, party1, party2, etc) unless there is a simple way of sending the UnitFrame_OnEnter function a specific this.unit value, in which case, screw the hooking. My most recent attempt looks like this.
Code:
local Original_UnitFrame_OnEnter = nil; |
You will have to call
Original_UnitFrame_OnEnter() in your replacement to get it to work. other options would be to chance tipbuddy's TOC file to make your's a dependency, which would be all in all a fairly bad idea if you plan to distrubite this. Only thing else that comes to mind is to add support for TipBuddy, where if its present that you hook its funciton instead of the default one. IE's TipBuddy's Original UnitFrame OnEnter. |
See, the thing is, I don't want to call the original ever because i need to set this:
this.unit = "target"; If i could somehow set this.unit in the unitframe_onenter i'd be gold. Without setting that value I just get the unit is not set error. I know it's possible since other unit frames like discord can do it, but it's hard to dig through all the more complicated code to find the few lines that do it. |
well you could actually hook the script using Set/GetScript()
problem is tha tunless you call the parent hook, you're going to have the incompatibiliity problem, or your going to have to have special code for eveything else. |
I'm not familiar with Set/GetScript() so I'll have to take a look at it and get back to you. :)
|
All times are GMT -6. The time now is 05:55 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI