WoWInterface

WoWInterface (http://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (http://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Possible Simple Question (http://www.wowinterface.com/forums/showthread.php?t=45818)

crzywhiteskata 02-13-13 05:58 PM

Possible Simple Question
 
Hey all, first time posting here. I have a possibly simple question that I'm trying to figure out. So I use losecontrol to watch for important dispellable cc, and I used to use the normal wow raid frames. I would set the losecontrol to show up on top of the frames, and it would cover it whenever someone got cc'd making it easy to see. However, because of the nature of joining arenas, the parties can get mixed up, causing the lc blocks to appear in the wrong place (actually the player bar is in the wrong place, but you know what I mean).
So, I already used shadow unit frames, and decided to just mod the party bars to look like the normal wow raid ui to keep the parties in the correct order. However, SUF is technically "in front of" lose control on the ui screen, not allowing it to appear over the bars and instead goes behind. Is there a way to mod the lua so that either I move suf back, or losecontrol forward so I can make it like it was before?

Thanks for any help.

Aanson 02-15-13 12:02 PM

Quote:

Originally Posted by crzywhiteskata (Post 272993)
Hey all, first time posting here. I have a possibly simple question that I'm trying to figure out. So I use losecontrol to watch for important dispellable cc, and I used to use the normal wow raid frames. I would set the losecontrol to show up on top of the frames, and it would cover it whenever someone got cc'd making it easy to see. However, because of the nature of joining arenas, the parties can get mixed up, causing the lc blocks to appear in the wrong place (actually the player bar is in the wrong place, but you know what I mean).
So, I already used shadow unit frames, and decided to just mod the party bars to look like the normal wow raid ui to keep the parties in the correct order. However, SUF is technically "in front of" lose control on the ui screen, not allowing it to appear over the bars and instead goes behind. Is there a way to mod the lua so that either I move suf back, or losecontrol forward so I can make it like it was before?

Thanks for any help.


Hia.

I take it losecontrol is an addon yeah? I wouldn't recommend changing the code within either of the addons; whenever they are updated, you'd lose your changes.

You could use the function Raise() to do what you're looking for.

What you'd need to do first is find out the name of the losecontrol frame(s), and the name of the SUF frames that appear/exist for each party member. I am not familiar with the makeup of either.

It would be a little simpler if losecontrol was contained within 1 frame (with up to 25 frames parented to that frame to serve for each raid member). If that's the case then the following code would do the trick (with the assumption that the losecontrol frame is called 'loseControl':

Lua Code:
  1. loseControl:HookScript("OnShow", function(self)
  2.     self:SetFrameStrata(SUFFrame:GetFrameStrata()); -- sets losecontrol to the same draw layer
  3.     self:Raise() -- raises losecontrol above all other frames within the same draw layer
  4. end

If it wasn't just 1 frame, and losecontrol consists of up to 25 frames individually parented to UIParent, you will find that they will likely be named in the following way: <frameName><partyMemberNumber> ( ie loseControlFrame1 ). If that's the case, the previous code works in the same way as follows:

Lua Code:
  1. for i = 1, 25 do
  2.     if _G["loseControlFrame"..i] then
  3.         _G["loseControlFrame"..i]:HookScript("OnShow", function(self)
  4.             self:SetFrameStrata(SUFFrame:GetFrameStrata()); -- sets losecontrol to the same draw layer
  5.             self:Raise() -- raises losecontrol above all other frames within the same draw layer
  6.         end
  7.     end
  8. end

Once you've worked out the frame names and what code you'll need, you could create a small addon of your own with 1 frame.

Create a local variable like this at the top of the addon:

Lua Code:
  1. local loseControlHooksAssigned = false;

RegisterEvent("ADDON_LOADED"), RegisterEvent("PLAYER_LOGIN") to the frame.

If "ADDON_LOAD" fires and the addon is losecontrol, use the code above, and loseControlHooksAssigned = true.

When "PLAYER_LOGIN" fires:

Lua Code:
  1. if ( event == "PLAYER_LOGIN" ) then
  2.     if ( ( not loseControlHooksAssigned ) and IsAddOnLoaded("whateverLoseControlsOfficialNameIs") ) then
  3.         for i = 1, 25 do
  4.             if _G["loseControlFrame"..i] then
  5.                 _G["loseControlFrame"..i]:HookScript("OnShow", function(self)
  6.                 self:SetFrameStrata(SUFFrame:GetFrameStrata()); -- sets losecontrol to the same draw layer
  7.                 self:Raise() -- raises losecontrol above all other frames within the same draw layer
  8.             end
  9.         end
  10.     end
  11. end


If you'd rather not create your own addon, you can download an addon called kgPanels. Create a panel, and hide it using the UI options menu. You will find an option called 'scripts' for the panel that you've created and you can stick your code in there.

In the kgPanels 'OnLoad' box, put:

Lua Code:
  1. self.loseControlHooksAssigned = false;
  2. self:RegisterEvent("ADDON_LOADED");
  3. self:RegisterEvent("PLAYER_LOGIN");


In the kgPanels 'OnEvent' box, put:

Lua Code:
  1. if ( not self.loseControlHooksAssigned ) then
  2.     if ( ( event == "ADDON_LOADED" ) and ( name == "whateverLoseControlsOfficialNameIs") ) then
  3.         -- put the HookScript code in here
  4.     elseif ( ( event == "PLAYER_LOGIN" ) and IsAddOnLoaded("whateverLoseControlsOfficialNameIs") ) then
  5.         -- put the HookScript code in here
  6.     end
  7.     self.loseControlHooksAssigned = true;
  8. end


This all assumes that losecontrol creates all it's frames when it's loaded and doesn't create it's frames dynamically (ie it might create 1 frame for 'player' at OnLoad, 4 more frames for party members if it detects that your'e in a party etc etc). If this is the case then let me know, because it can still be done, but the code will be different. If the addon uses a 'parent' frame which holds all player frames then it will still be okay if you HookScript that parent frame. If all individual frames are parented to UIParent, however, you'll notice that there is a problem if only your frame (ie the 'player' frame) works correctly, while others continue to behave in the way that you described.


I hope this helps. Any other questions, feel free to ask and I'll help as best as I can.

pelf 02-22-13 10:11 PM

Isn't the functionality of LoseControl now in the game? Or did they not implement all of it?


All times are GMT -6. The time now is 10:00 PM.

vBulletin © 2014, Jelsoft Enterprises Ltd
©2012 ZAM Network LLC