long-standing issue, with the crumbs from this thread and DejaPRFader i've managed to consolidate the functionality.
for anyone interested, here it is.
https://legacy.curseforge.com/wow/ad...idframemanager
source code for people just wanting a quick understanding for their own implementations:
Lua Code:
-- ingame instructions
local enterColor = "|cFF"
local exitColor = "|r"
local colorOrange = "DF9F1F"
local colorRed = "FF3F1F"
local function MoveCRFM_instructions()
print(enterColor .. colorOrange .. "Use /movecrfm followed by either the Y coordinate, or whether to fade it out on mouseover, or frame strata 1-8 (ascending priority)." .. exitColor)
print(enterColor .. colorOrange .. "Example: " .. exitColor .. "/movecrfm -234.5")
print(enterColor .. colorOrange .. "Example: " .. exitColor .. "/movecrfm yes")
print(enterColor .. colorOrange .. "Example: " .. exitColor .. "/movecrfm strata 6")
end
-- strata database/array
local MoveCRFM_stratas = {
[1] = "BACKGROUND",
[2] = "LOW",
[3] = "MEDIUM",
[4] = "HIGH",
[5] = "DIALOG",
[6] = "FULLSCREEN",
[7] = "FULLSCREEN_DIALOG",
[8] = "TOOLTIP",
}
-- main functionality
local function MoveCRFM_move()
local anchorMyselfAt, anchorTo, anchorToAt, coordX, coordY = CompactRaidFrameManager:GetPoint()
CompactRaidFrameManager:SetPoint(anchorMyselfAt, anchorTo, anchorToAt, coordX, Move_CompactRaidFrameManager.y)
end
local function MoveCRFM_fade()
if not Move_CompactRaidFrameManager or not Move_CompactRaidFrameManager.fade then
CompactRaidFrameManager:SetAlpha(1)
elseif CompactRaidFrameManager:IsMouseOver() or not CompactRaidFrameManager.collapsed then
CompactRaidFrameManager:SetAlpha(1)
else
CompactRaidFrameManager:SetAlpha(0)
end
end
local function MoveCRFM_strata()
CompactRaidFrameManager:SetFrameStrata(MoveCRFM_stratas[Move_CompactRaidFrameManager.strata])
end
local function MoveCRFM_set()
MoveCRFM_move()
MoveCRFM_fade()
MoveCRFM_strata()
end
-- persist through sessions functionality
local function MoveCRFM_loaded(self, event, arg1)
if event == "ADDON_LOADED" and arg1 == "Move_CompactRaidFrameManager" then
if not Move_CompactRaidFrameManager then
MoveCRFM_instructions()
Move_CompactRaidFrameManager = {
y = -100,
fade = false,
strata = 4,
}
end
MoveCRFM_set()
-- append ourselves into blizzard's frames
hooksecurefunc("CompactRaidFrameManager_Toggle", function()
MoveCRFM_move()
MoveCRFM_fade()
end)
end
end
-- event triggers
local MoveCRFM = CreateFrame("Frame")
MoveCRFM:RegisterEvent("ADDON_LOADED")
MoveCRFM:SetScript("OnEvent", MoveCRFM_loaded)
CompactRaidFrameManager:HookScript("OnShow", MoveCRFM_fade)
CompactRaidFrameManager:HookScript("OnEnter", MoveCRFM_fade)
CompactRaidFrameManager:HookScript("OnLeave", MoveCRFM_fade)
-- slash command functionality
SLASH_MOVECRFM1 = "/movecrfm"
function SlashCmdList.MOVECRFM(msg, editbox)
local msgY = tonumber(string.match(msg, "^(-?%d+\.?%d?)$")) or nil
local msgFade = (string.match(string.lower(msg), "^yes$") or string.match(string.lower(msg), "^no$")) or nil
local msgStrata = tonumber(string.match(string.lower(msg), "^strata ([1-8])$")) or nil
if msgY then
Move_CompactRaidFrameManager.y = msgY
MoveCRFM_move()
elseif msgFade then
if msgFade == "yes" then
Move_CompactRaidFrameManager.fade = true
else
Move_CompactRaidFrameManager.fade = false
end
MoveCRFM_fade()
elseif msgStrata then
Move_CompactRaidFrameManager.strata = msgStrata
MoveCRFM_strata()
else
print(enterColor .. colorRed .. "Incorrect usage of " .. exitColor .. "/movecrfm")
MoveCRFM_instructions()
end
end