Thread Tools Display Modes
10-10-08, 11:47 AM   #1
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
CaptureBar moving

Hi there,

Right now i'm using this pease of code, but for some odd reason it won't work.

I have my minimap set to the bottom right cornor of the screen, but fail to get the caputure bar above.


Code:
	if (WorldStateCaptureBar) then    
		WorldStateCaptureBar:ClearAllPoints()
		WorldStateCaptureBar:SetPoint("TOP", Minimap, "TOP", 0, 50)
		WorldStateCaptureBar.ClearAllPoints = function () end
--		WorldStateCaptureBar.SetPoint = function() end
	end
Or is there a way to change the bar to a new one.

blue - gray - red and Vertical with my nice own default texture?

thanks
  Reply With Quote
10-11-08, 04:45 PM   #2
warcrazy
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 4
I am not sure the WorldStateCaptureBar exists. I just tired in game to run WorldStateCaptureBar:Hide() and got an error telling me it doesn't exist. Are you positive that is the correct name?
  Reply With Quote
10-11-08, 04:55 PM   #3
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Yes i'm sure, but it's only there if yiu have a capturebar.

but I'll doppelcheck that
  Reply With Quote
10-29-08, 08:09 AM   #4
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
got some stuff moved

AchievementWatchFrame:ClearAllPoints()
AchievementWatchFrame:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -24)
AchievementWatchFrame.SetPoint = function() end

-- QuestWatchFrame:ClearAllPoints()
-- QuestWatchFrame:SetPoint('BOTTOMLEFT', AchievementWatchFrame, 'BOTTOMLEFT', 0, -13)
-- QuestWatchFrame.SetPoint = function() end

how would I get the default shifting of the QuestWatchFrame in relation to the AchievementWatchFrame?

and the WorldStateCaptureBar is giving me a hard time, because it simply wont work

if(WorldStateCaptureBar) then
WorldStateCaptureBar:ClearAllPoints()
WorldStateCaptureBar:SetPoint('TOP', UIParent, 'TOP', 0, -24)
WorldStateCaptureBar.SetPoint = function() end
end

Last edited by Quokka : 10-29-08 at 08:50 AM.
  Reply With Quote
10-29-08, 11:55 PM   #5
Gendr
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 11
This is what I used to move the durability man (ArmoredMan - Ace3). To see the full code in use, download it. Hope this gives you an idea.

DurabilityFrame -> WorldStateCaptureBar
ArmoredMan -> Your AddOn Name
Code:
function ArmoredMan:OnEnable()
        self:SecureHook("UIParent_ManageFramePositions", "setPosition")
end

function ArmoredMan:locked()
	DurabilityFrame:SetMovable(true)
	DurabilityFrame:EnableMouse(true)
	DurabilityFrame:SetClampedToScreen(true)
	DurabilityFrame:RegisterForDrag("LeftButton")
	DurabilityFrame:SetScript("OnDragStart", function(frame) if not self.db.profile.locked then frame:StartMoving() end end)
	DurabilityFrame:SetScript("OnDragStop", function(frame)
		if self.db.profile.locked then return end
		frame:StopMovingOrSizing()
		self.db.profile.x, self.db.profile.y = frame:GetCenter()
		self.db.profile.anchorframe, self.db.profile.anchor = "UIParent", "BOTTOMLEFT"
	end)

	DurabilityFrame:ClearAllPoints()
	DurabilityFrame:SetPoint("CENTER", self.db.profile.anchorframe, self.db.profile.anchor, self.db.profile.x, self.db.profile.y)
end

function ArmoredMan:setPosition()
	DurabilityFrame:ClearAllPoints()
	DurabilityFrame:SetPoint("CENTER", self.db.profile.anchorframe, self.db.profile.anchor, self.db.profile.x, self.db.profile.y)
end
  Reply With Quote
11-06-08, 04:04 AM   #6
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
tried a bit but could'nt get it working.

Your code sould make it movable, I'd like to have it at a pre set lua position
  Reply With Quote
11-06-08, 11:48 AM   #7
Gendr
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 11
Just change x and y to set your position.

If you want to anchored to the minimap, just change UIParent to MinimapCluster.

Code:
local event = CreateFrame('Frame')
local x = 40
local y = 15

local move = function(self)
	WorldStateCaptureBar:ClearAllPoints()
	WorldStateCaptureBar:SetPoint("CENTER", UIParent, 'CENTER', x, y)
end

event.PLAYER_LOGIN = function()
	hooksecurefunc('UIParent_ManageFramePositions', move)
end

event:SetScript("OnEvent", function(self, event, ...)
	self[event](self, event, ...)
end)
event:RegisterEvent("PLAYER_LOGIN")

Last edited by Gendr : 11-06-08 at 12:00 PM.
  Reply With Quote
11-07-08, 08:12 AM   #8
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
so with the code inplace an error pops up


Code:
[15:10:00] Interface\AddOns\AI-MiniMap\AI-CB.lua:6: attempt to index global 'WorldStateCaptureBar' (a nil value)
[C]: ?
Interface\AddOns\AI-MiniMap\AI-CB.lua:6: in function <Interface\AddOns\AI-MiniMap\AI-CB.lua:5>
[C]: in function `UIParent_ManageFramePositions'
Interface\FrameXML\VehicleMenuBar.lua:816: in function `VehicleSeatIndicator_UnloadTextures'
Interface\FrameXML\VehicleMenuBar.lua:854: in function `VehicleSeatIndicator_OnEvent'
[string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>

Line 6: WorldStateCaptureBar:ClearAllPoints()
  Reply With Quote
11-07-08, 10:48 AM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
That frame is only created when it is needed. It is also actually 9 different frames called WorldStateCaptureBar1, WorldStateCaptureBar2, WorldStateCaptureBar3, etc. It's a PITA to move, which is why only several addons deal with it. I'm working on putting movers into my minimap addon, and I decided to just leave it in its default location. If a user wants to move it, they can use Capping or SSPVP (iirc, they move it). Chinchilla also moves this frame if you want to look at the code for these addons.
__________________
"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

WoWInterface » Developer Discussions » Lua/XML Help » CaptureBar moving


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