Hmm, I thought Scott had already added that to the /nui movers system already.
Although looking at both nUI5 and nUI6 folders I can't see it mentioned at all.
Time to hunt down my mini movers file ..
Edit:
I haven't fully tested this yet since renaming the folder/project but code wise it should still be working as I envisioned.
I have set up PlayerPowerBarAlt and the TutorialAlertFrame ( or however it was spelt ) by default. The addon however lets you create movers on the fly if nUI isn't already creating them.
It works in a similar way to MoveAnything except it uses nUI's mover system to do all the work so that using /nui movers will allow you to move the frame once it has been added to the system.
It is not intended to be a permanent project, at least at the moment anyway, but it will allow people that are hitting these problems now to move that frame outta the way so they can continue playing.
The PlayerPowerBarAlt is the same bar used in the twilight highlands quest that shows how much stomach acid you are being affected by.
Hopefully the zip file attached doesn't still cause problems like before but below is the full code in the lua file.
Code:
------------------------------------------------------------------------------------
-- Name : nUI_Plugin_CustomMovers
-- Copyright : Tina Kirby AKA Xrystal (C) 2009/2010 All Rights Reserved
-- Contact : [email protected]
-- Download Sites :
-- Version : 1.01.00 - New
------------------------------------------------------------------------------------
--[[ Use Addon Wide Data Table ]]--
local addonName,addonData = ...
local f = CreateFrame("Frame","PCM_Frame",UIParent);
f:SetParent(UIParent);
f:SetPoint("CENTER");
-- Savable list of frames we want to be able to move within the nUI interface
MovableFrames = {
[1] = "TutorialFrameAlertButton",
[2] = "PlayerPowerBarAlt",
};
-- Temporary list of frames removed from the above list
backupList = {
};
local function InitialiseList(self)
for i,v in ipairs(MovableFrames) do
local f = _G[v];
local n = v.."_Mover";
f:SetParent(nil);
f:SetParent(self);
f:SetPoint("CENTER");
nUI_Movers:lockFrame(f,true,n);
end
end
local function AddFrameToList(f)
-- If this isn't a valid frame then don't go any further
local frame = _G[f];
if ( not frame ) then return end
DEFAULT_CHAT_FRAME:AddMessage("Adding ", f, " to list of controlled frames");
tinsert(MovableFrames,f);
end
local function RemoveFrameFromList(f)
-- Add frame to remove to backupList just in case
tinsert(backupList,f);
-- Remove frame from movable list
tremove(MovableFrames,f);
end
local function DisplayList()
print("Currently controlled frames")
for i,v in ipairs(MovableFrames) do
print(v);
end
end
local function RefreshList()
-- List of frames that need to be removed
local removalList = {};
-- Validate contents of list
for i,v in ipairs(MovableFrames) do
local f = _G[v];
if ( not f ) then
tinsert(removalList,v);
end
end
-- Remove invalid frames from MovableFrames list
for i,v in ipairs(removalList) do
tremove(MovableFrames,v);
end
end
local function ClearList()
-- Fill Backup List with Movable List contents - just in case
for i,v in ipairs(MovableFrames) do
tinsert(backupList,v);
end
-- Empty Movable Frame List
MovableFrames = {};
end
local function RestoreList()
-- Fill Movable List with Backup List contents
for i,v in ipairs(backupList) do
tinsert(MovableFrames,v);
end
-- Empty Backup List
backupList = {};
end
local function ToggleMoverFrames(show)
for i,v in ipairs(MovableFrames) do
local f = _G[v];
local n = _G[v.."_Mover"];
if ( n ) then
if ( not show ) then
n:Hide();
else
n:Show();
end
elseif ( f ) then
if ( not show ) then
f:Hide();
else
f:Show();
end
else
print(v.."_Mover"," doesn't exist at present");
end
end
end
local function ListCommands()
DEFAULT_CHAT_FRAME:AddMessage("nUI: Plugin (Custom Movers) slash commands");
DEFAULT_CHAT_FRAME:AddMessage("/pcm list - List frames currently controlled by this addon");
DEFAULT_CHAT_FRAME:AddMessage("/pcm show - Shows the display of frames currently controlled by this addon");
DEFAULT_CHAT_FRAME:AddMessage("/pcm hide - Hides the display of frames currently controlled by this addon");
DEFAULT_CHAT_FRAME:AddMessage("/pcm add FrameName - Adds FrameName to the controlled list");
DEFAULT_CHAT_FRAME:AddMessage("/pcm remove FrameName - Removes FrameName from the controlled list");
DEFAULT_CHAT_FRAME:AddMessage("/pcm clear - Empties the movable frames list entirely");
DEFAULT_CHAT_FRAME:AddMessage("/pcm restore - Reverts the last clear and remove actions");
DEFAULT_CHAT_FRAME:AddMessage("/pcm refresh - Removes frames no longer in existence");
end
local function SlashCommands(msg)
-- Separate msg into argument list
local args = {};
for word in string.gmatch(msg,"[^%s]+") do
table.insert(args,word);
end
-- Turn command into lower case
if ( args[1] ) then args[1] = string.lower(args[1]); end
if ( args[1] == "list" ) then
DisplayList();
elseif ( args[1] == "toggle" ) then
ToggleMoverFrames();
elseif ( args[1] == "refresh" ) then
RefreshList();
elseif ( args[1] == "clear" ) then
ClearList();
elseif ( args[1] == "restore" ) then
RestoreList();
elseif ( args[1] == "add" and args[2] ~= nil ) then
AddFrameToList(args[2]);
elseif ( args[1] == "remove" and args[2] ~= nil ) then
RemoveFrameFromList(args[2]);
else
ListCommands();
end
end
local function InitialiseAddon(self)
SLASH_PTMCmd1 = '/pcm';
SlashCmdList['PCMCmd'] = SlashCommands;
DEFAULT_CHAT_FRAME:AddMessage("nUI: Plugin (Custom Movers) loaded. Use /pcm to list options available");
end
local function OnEvent(self,event,...)
local arg1,arg2,arg3,arg4,arg5,arg6 = ...;
if ( event == "ADDON_LOADED" and arg1 == addonName ) then
InitialiseAddon(self);
elseif ( event == "PLAYER_ENTERING_WORLD" ) then
InitialiseList(self);
self:UnregisterEvent(event);
end
end
--[[ Register the events we want to watch ]]--
f:SetScript( "OnEvent", OnEvent );
f:RegisterEvent( "ADDON_LOADED" );
f:RegisterEvent( "PLAYER_ENTERING_WORLD" );