Thread Tools Display Modes
12-22-11, 12:22 AM   #1
litesung
A Flamescale Wyrmkin
 
litesung's Avatar
Join Date: Aug 2010
Posts: 130
Question Modifying InteruptBar's display behavior

Hello, I'm new to .lua editing and was wondering if I could modify the behavior of InteruptBar by only showing the frame in PVP (Arenas, Battlegrounds, and possibly when flagged for PVP), similar to how Spy has the options to only show the frame in Arenas & BGs.

Is it possible for me to hard-code it into the .lua file?

Can anyone help me out? Thanks
  Reply With Quote
12-22-11, 09:51 AM   #2
jasje
A Chromatic Dragonspawn
 
jasje's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 150
Lua Code:
  1. local instanceType = select(2, IsInInstance())
  2. if instanceType == "pvp" or instanceType == "arena" then
  3.     self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  4. else
  5.     self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  6. end

Not pro at coding but it's something like that
__________________

Tukui | Github
  Reply With Quote
12-22-11, 03:27 PM   #3
litesung
A Flamescale Wyrmkin
 
litesung's Avatar
Join Date: Aug 2010
Posts: 130
I tried adding that to .lua in many forms, and I can't seem to get it right. Anymore help?
  Reply With Quote
12-23-11, 06:24 AM   #4
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Just an idea:

Code:
local f = ? -- FrameReference not sure of the name

f:RegisterEvent("PLAYER_ENTERING_WORLD") -- register the event to run after each loading screen

f:HookScript("OnEvent", function(f, event) -- we only add this to the current function, instead of replacing it entirely (then we match the event to be what we expect, before we run our code)
  if event == "PLAYER_ENTERING_WORLD" then
    local instanceType = select(2, IsInInstance())
    if instanceType == "pvp" or instanceType == "arena" then
      f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    else
      f:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    end
  end
end)
  Reply With Quote
12-23-11, 12:17 PM   #5
litesung
A Flamescale Wyrmkin
 
litesung's Avatar
Join Date: Aug 2010
Posts: 130
I'll test out that second code today. Hopefully it works this time x)

& btw thanks for the explanations of how each line works it will be easier for me to mess around with it now
  Reply With Quote
12-26-11, 02:57 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
InterruptBar does not give its frame a global name, so you cannot (easily) access it from outside of the addon's own Lua file. The following simple modification to InterruptBar.lua should work.

Find this line, near the end of the file:
Code:
	["COMBAT_LOG_EVENT_UNFILTERED"] = function(self,...) InterruptBar_COMBAT_LOG_EVENT_UNFILTERED(...) end,
After it, add:
Code:
	["ZONE_CHANGED_NEW_AREA"] = function(self)
		local _, instanceType = IsInInstance()
		if instanceType == "arena" or instanceType == "pvp" or (instanceType == "none" and GetZonePVPInfo() == "combat") then
			self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
			self:Show()
		else
			self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
			InterruptBar_ResetAllTimers()
			self:Hide()
		end
	end,
  Reply With Quote
12-30-11, 05:34 AM   #7
litesung
A Flamescale Wyrmkin
 
litesung's Avatar
Join Date: Aug 2010
Posts: 130
Originally Posted by Phanx View Post
InterruptBar does not give its frame a global name, so you cannot (easily) access it from outside of the addon's own Lua file. The following simple modification to InterruptBar.lua should work.

Find this line, near the end of the file:
Code:
	["COMBAT_LOG_EVENT_UNFILTERED"] = function(self,...) InterruptBar_COMBAT_LOG_EVENT_UNFILTERED(...) end,
After it, add:
Code:
	["ZONE_CHANGED_NEW_AREA"] = function(self)
		local _, instanceType = IsInInstance()
		if instanceType == "arena" or instanceType == "pvp" or (instanceType == "none" and GetZonePVPInfo() == "combat") then
			self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
			self:Show()
		else
			self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
			InterruptBar_ResetAllTimers()
			self:Hide()
		end
	end,
This worked perfectly

I typed "/ib hidden" to show the frame, and positioned it where I wanted it, then I hid it again by typing "/ib hidden". When I tested it, the frame was not showing, but the spell icons appear when they are being used!

This actually turned out better than I ever wanted! THANKS!!!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Modifying InteruptBar's display behavior

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off