-
Posted by Drae on Sat, 26 Jun 2010 21:16:55
I have found the Global String:
OPTION_TOOLTIP_SHOW_FULLSCREEN_STATUS
That appears to be able to flash the red warning around the edges of the screen. I have no idea how to implement it to do so.
I have an addon. It checks certain conditions when the player enters combat. If certain conditions are achieved, I want the addon to flash the screen with the red warning around the edges until an action is taken to change the conditions being monitored.
How do I cause the screen to flash the red warning around the screen?
-
Posted by jnwhiteh on Sat, 26 Jun 2010 21:57:21
You need to find that frame, and manipulate it. The global string has nothing to do with that.
-
Posted by Drae on Sat, 26 Jun 2010 22:01:23
The frame would be the main UI. The Wow Window.
I suppose I could create a full screen Message Frame in the background using: SetupFullscreenScale(Frame) Frame:SetBackdropColor(red, green, blue [, alpha]) Frame::SetFrameStrata("BACKGROUND") Frame:Hide();
And then use: UIFrameFlash(frame, fadeInTime, fadeOutTime, flashDuration, showWhenDone, flashInHoldTime, flashOutHoldTime)
To flash it. Does that sound reasonable?
-
Posted by jnwhiteh on Sat, 26 Jun 2010 23:04:28
... no. The frame that has the full screen flash. Or the textures that make up the flash, depending on how it's defined. Regardless, I don't know what your question really is.. I can't write the addon for you. You need to find the place that the full screen flash frame is defined in the FrameXML, and then show it.
-
Posted by Drae on Sat, 26 Jun 2010 23:06:35
I was editing the previous response when you posted. I had an idea listed there.
-
Posted by jnwhiteh on Sat, 26 Jun 2010 23:08:49
Not sure why you need a message frame to do that, if you're not going to be sending messages to it. Also, a backdrop at that scale is probably going to look pretty ridiculous, but it's a place to start. I'd suggesting using a 'Frame', no need to initialize another widget when it's not necessary. Then you should be able to flash it once you've got it all set up.
The two textures used by WoW are:
http://wowprogramming.com/utils/artbrowser/FullScreenTextures.list
Better to use them than a backdrop, imo.
-
Posted by Drae on Sat, 26 Jun 2010 23:17:51
Thank you, I'll check them out.
-
Posted by Drae on Sat, 26 Jun 2010 23:31:29
To set those textures would I use "OutofControl", or will I need a path like "FullScreen Textures\\OutofControl.blp" ?
"Interface\\FullScreen Textures\\OutofControl"
-
Posted by Drae on Sun, 27 Jun 2010 00:16:03
I just added a texture to the Main XML frame of the addon, using:
Texture
name="AspectWarning"
file="Interface\FullScreenTextures\OutOfControl"
alphaMode="ADD"
hidden="true"
-
Posted by Drae on Thu, 01 Jul 2010 21:09:15
I finally did it with a script. This is the routine used. The control variables (Aspect.###) are from elsewhere in the addon.
function AspectFlashScreen()
if(not Aspect.StopFlash) then local r = 1; local g = 0; local b = 0; local a = .50; ASPECT_CurrentSound = ASPECT_HawkSound; if (Aspect.Current == "Viper") then r = 0; b=1; a=.50; ASPECT_CurrentSound = ASPECT_HissSound; end if not flasher then flasher = CreateFrame("Frame", "AWFlash", UIParent) flasher:SetFrameStrata("BACKGROUND") flasher:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",}) flasher:SetAllPoints(UIParent) flasher:SetScript("OnShow", function(self) self.elapsed = 0 self:SetAlpha(0) end) flasher:SetScript("OnUpdate", function(self, elapsed) elapsed = self.elapsed + elapsed AspectFlasherSound(); if (Aspect.StopFlash or UnitIsDead("player")) then self:Hide() self:SetAlpha(0) flashcount = 0; Printcount = true; return end local alpha = elapsed % 0.4 if elapsed > 0.2 then alpha = 0.4 - alpha end self:SetAlpha(alpha * 5) self.elapsed = elapsed end) flasher:Hide() end if(Aspect.Flash) then flasher:SetBackdropColor(r, g, b, a) flasher:Show() end end
end
The textures you gave me would have worked better, but they are not transparent in "black" regions. If you could tell me how to use them instead of "Interface\Tooltips\UI-Tooltip-Background", and not have them black out the center of the screen, that would be helpful.
-
Posted by jnwhiteh on Thu, 01 Jul 2010 21:47:28
You'd need to set the blend mode of the texture using SetBlendMode.
-
Posted by Drae on Sun, 04 Jul 2010 01:44:18
I could simply change the bgfile to the OutofControl background, but then I am operating with a frame. SetBlendMode only works with textures. How would I maintain the functionality of this routine and adjust the blend mode of the frame?
-
Posted by Drae on Sun, 04 Jul 2010 05:49:13
flashedge = CreateFrame("Frame", "AWFlash", UIParent) flashedge:SetFrameStrata("BACKGROUND") flashedge.texture = flashedge:CreateTexture(); flashedge.texture:SetAllPoints(flashedge); flashedge.texture:SetTexture("Interface\\FullScreenTextures\\OutofControl"); flashedge:SetBlendMode("ADD");
I get this error:
Interface\AddOns\Aspect\Aspect.lua:445: attempt to call method 'SetBlendMode' (a nil value) Count: 1
-
Posted by jnwhiteh on Sun, 04 Jul 2010 08:37:23
As the documentation pretty clearly states, it's a method on a texture.. not a frame.
-
Posted by Drae on Sat, 10 Jul 2010 07:19:18
Indeed it does. Final flasher frame that uses the blend method:
function Aspect_CreateFlasher(color) local frameImage = "None"; if(color == "Blue") then frameImage = "Interface\\FullScreenTextures\\OutofControl"; elseif(color == "Red") then frameImage = "Interface\\FullScreenTextures\\LowHealth"; else frameImage = nil; end local frameName = "Aspect"..color.."WarningFrame"; if not ((Flasher[color]) and (frameImage)) then local flasher = CreateFrame("Frame", frameName) flasher:SetToplevel(true) flasher:SetFrameStrata("FULLSCREEN_DIALOG") flasher:SetAllPoints(UIParent) flasher:EnableMouse(false) flasher.texture = flasher:CreateTexture(nil, "BACKGROUND") flasher.texture:SetTexture(frameImage) flasher.texture:SetAllPoints(UIParent) flasher.texture:SetBlendMode("ADD") flasher:Hide() flasher:SetScript("OnShow", function(self) self.elapsed = 0 self:SetAlpha(0) end) flasher:SetScript("OnUpdate", function(self, elapsed) elapsed = self.elapsed + elapsed if Aspect_FlasherSound(sound) then self:Hide() self:SetAlpha(0) flashcount = 0; Printcount = true; Control.PrintAspect = "Dragonhawk"; return end local alpha = elapsed % 0.4 if elapsed > 0.2 then alpha = 0.4 - alpha end self:SetAlpha(alpha * 5) self.elapsed = elapsed end) Flasher[color] = flasher; end end
-
Posted by jnwhiteh on Sat, 10 Jul 2010 07:51:48
Awesome, looks great!