Thread Tools Display Modes
04-13-13, 09:55 PM   #1
Stantious
A Murloc Raider
Join Date: Apr 2013
Posts: 6
Run a command on login help

I've been having strata issues with my party frames, but found a command that will drop it to low strata:

CompactRaidFrameManager:SetFrameStrata(LOW)

I've been looking into a way to fire this command when I log in, using templates I've found from two sources:

http://www.wowinterface.com/forums/s...ad.php?t=34526

http://us.battle.net/wow/en/forum/topic/2743811324

What I've come up with so far:

local frame=CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN")

frame:SetScript("OnEvent",function(...)

CompactRaidFrameManager:SetFrameStrata(LOW)

end)
No dice. Is there a simple answer I'm missing? This is the first time I've ever experimented with this stuff, and I'm completely lost as to why this wouldn't work. Thank you for your time.
  Reply With Quote
04-13-13, 10:01 PM   #2
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Stantious View Post
I've been having strata issues with my party frames, but found a command that will drop it to low strata:

CompactRaidFrameManager:SetFrameStrata(LOW)

I've been looking into a way to fire this command when I log in, using templates I've found from two sources:

http://www.wowinterface.com/forums/s...ad.php?t=34526

http://us.battle.net/wow/en/forum/topic/2743811324

What I've come up with so far:



No dice. Is there a simple answer I'm missing? This is the first time I've ever experimented with this stuff, and I'm completely lost as to why this wouldn't work. Thank you for your time.
I've never used them before, so not sure what will work or not, but the CRFs are Load On Demand.

Try something like:
Lua Code:
  1. local frame=CreateFrame("Frame")
  2. frame:RegisterEvent("PLAYER_LOGIN")
  3. frame:SetScript("OnEvent",function()
  4.     LoadAddOn("Blizzard_CompactRaidFrames")  
  5.     CompactRaidFrameManager:SetFrameStrata(LOW)
  6. end)
  Reply With Quote
04-13-13, 10:29 PM   #3
Stantious
A Murloc Raider
Join Date: Apr 2013
Posts: 6
Unfortunately that did not work.
  Reply With Quote
04-13-13, 11:21 PM   #4
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
SetFrameStrata takes a string argument so it would be:
Code:
CompactRaidFrameManager:SetFrameStrata('LOW')
  Reply With Quote
04-13-13, 11:30 PM   #5
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Vrul View Post
SetFrameStrata takes a string argument so it would be:
Code:
CompactRaidFrameManager:SetFrameStrata('LOW')
God, I totally missed that

Where's my head at? Ack!
  Reply With Quote
04-13-13, 11:57 PM   #6
Stantious
A Murloc Raider
Join Date: Apr 2013
Posts: 6
I was able to get the following to work once:

Lua Code:
  1. local frame=CreateFrame("Frame")
  2. frame:RegisterEvent("VARIABLES_LOADED")
  3. frame:SetScript("OnEvent",function()
  4.     LoadAddOn("Blizzard_CompactRaidFrames")
  5.     CompactRaidFrameManager:SetFrameStrata('LOW')
  6. end)

But was greeted with an error:

Message: Interface\FrameXML\TargetFrame.lua:1051: attempt to compare number with nil
Time: 04/14/13 01:58:47
Count: 1
Stack: Interface\FrameXML\TargetFrame.lua:1051: in function `Target_Spellbar_AdjustPosition'
Interface\FrameXML\TargetFrame.lua:596: in function `TargetFrame_UpdateAuras'
Interface\FrameXML\TargetFrame.lua:1094: in function `TargetFrame_UpdateBuffsOnTop'
Interface\FrameXML\TargetFrame.lua:244: in function `TargetFrame_OnVariablesLoaded'
Interface\FrameXML\UIParent.lua:711: in function <Interface\FrameXML\UIParent.lua:678>

Locals: self = TargetFrameSpellBar {
barSpark = TargetFrameSpellBarSpark {
}
updateEvent = "PLAYER_TARGET_CHANGED"
barFlash = TargetFrameSpellBarFlash {
}
holdTime = 0
text = TargetFrameSpellBarText {
}
border = TargetFrameSpellBarBorder {
}
unit = "target"
showCastbar = true
borderShield = TargetFrameSpellBarBorderShield {
}
showTradeSkills = false
showShield = true
icon = TargetFrameSpellBarIcon {
}
0 = <userdata>
}
parentFrame = <unnamed> {
0 = <userdata>
}
(*temporary) = nil
(*temporary) = <unnamed> {
0 = <userdata>
}
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to compare number with nil"
EDIT: I am unable to consistently recreate this result. It has worked twice so far.

Last edited by Stantious : 04-14-13 at 12:03 AM.
  Reply With Quote
04-14-13, 12:49 AM   #7
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
I think it makes more sense to wait for the addon to load, rather than forcing it to load as soon as you log in. It may help your error as well:

Lua Code:
  1. local frame = CreateFrame("frame")
  2. frame:RegisterEvent("ADDON_LOADED")
  3. frame:SetScript("OnEvent", function(self, event, addon)
  4.     if addon == "Blizzard_CompactRaidFrames" then
  5.          CompactRaidFrameManager:SetFrameStrata("LOW")
  6.          self:UnregisterEvent("ADDON_LOADED")
  7.     end
  8. end)

(Edit: fixed).

Last edited by Akryn : 04-14-13 at 02:00 AM.
  Reply With Quote
04-14-13, 12:52 AM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Almost, Akryn.

lua Code:
  1. frame:SetScript("OnEvent",function(self, event, addon)

/edit: and yes, this is a better method
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-14-13, 12:54 AM   #9
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Seerah View Post
Almost, Akryn.

lua Code:
  1. frame:SetScript("OnEvent",function(self, event, addon)

/edit: and yes, this is a better method
Thanks for catching that.
  Reply With Quote
04-14-13, 01:22 AM   #10
Stantious
A Murloc Raider
Join Date: Apr 2013
Posts: 6
Originally Posted by Akryn View Post
Lua Code:
  1. local frame = CreateFrame("frame")
  2. frame:RegisterEvent("ADDON_LOADED")
  3. frame:SetScript("OnEvent", function(self, event, addon)
  4.     if addon == "Blizzard_CompactRaidFrames" then
  5.     CompactRaidFrameManager:SetFrameStrata("LOW")
  6.     self:UnregisterEvent("ADDON_LOADED")
  7. end)
Using this code, no effect, receiving this error:

Message: Interface\AddOns\RaidFrameStrata\core.lua:7: unexpected symbol near ')'
Time: 04/14/13 03:17:40
Count: 1
Stack:
Locals:
Not sure what symbol it is getting mad at.
  Reply With Quote
04-14-13, 01:37 AM   #11
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
It's missing the function end.

Put another end after the end

Code:
    local frame = CreateFrame("frame")
    frame:RegisterEvent("ADDON_LOADED")
    frame:SetScript("OnEvent", function(self, event, addon)
        if addon == "Blizzard_CompactRaidFrames" then
            CompactRaidFrameManager:SetFrameStrata("LOW")
            self:UnregisterEvent("ADDON_LOADED")
        end
    end)
  Reply With Quote
04-14-13, 01:43 AM   #12
Stantious
A Murloc Raider
Join Date: Apr 2013
Posts: 6
Corrected the error Dridzt, but still no effect.
  Reply With Quote
04-14-13, 01:47 AM   #13
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Dridzt View Post
It's missing the function end.

Put another end after the end
I heard you like functions, so I gave you more ends to put after your ends for the functions you can now place inside your functions.
  Reply With Quote
04-14-13, 02:09 AM   #14
Stantious
A Murloc Raider
Join Date: Apr 2013
Posts: 6
I've had great success with changing the following:
Lua Code:
  1. if addon == "Blizzard_CompactRaidFrames" then
to
Lua Code:
  1. if addon == "Blizzard_RaidUI" then

The only issues are a minor graphical glitch that can be cleared or caused by reloading the UI:

http://imgur.com/66laHKC

And while in a raid group (as opposed to being in a party with the raid frames as party) logging in sets the strata to low, but reloading the UI will not run the command, resetting the strata to high. Which really isn't a problem, I can just hit a macro in the very rare situation, while having my strata lowed automatically otherwise. If somehow anyone can throw some incite into that particular situation it'd be appreciated, but definitely not required! Thank you all for walking me through this, it's been a very eye opening learning experience. Cheers!
  Reply With Quote
04-14-13, 08:42 AM   #15
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
As best I can tell Blizzard_CompactRaidFrames is loaded along with the default UI and not in response to anything. That is why checking for Blizzard_RaidUI was showing results since Blizzard_CompactRaidFrames would not trigger the ADDON_LOADED event.

I would suggest the following to account for Blizzard_CompactRaidFrames already being loaded when your addon runs but also allow for that to change in the future:
Code:
if CompactRaidFrameManager then
    CompactRaidFrameManager:SetFrameStrata("LOW")
else
    local frame = CreateFrame("Frame")
    frame:SetScript("OnEvent", function(self, event, addonName)
        if addonName == "Blizzard_CompactRaidFrames" then
            self:UnregisterEvent(event)
            self:SetScript("OnEvent", nil)
            CompactRaidFrameManager:SetFrameStrata("LOW")
        end
    end)
    frame:RegisterEvent("ADDON_LOADED")
end
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Run a command on login help


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