WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Xpbar (https://www.wowinterface.com/forums/showthread.php?t=39419)

Oraknathal 03-25-11 03:44 PM

Xpbar
 
Stexperience bar.
I have the look I want but I cant get it to the width i Want when i change the width it dissapears atm it is anchored to the top of my minimap.

here is the start lua if that helps.

-- Config ----------------
--------------------------
--Bar Height and Width
local barHeight, barWidth = 3, Minimap:GetWidth()2

--Where you want the fame to be anchored
--------AnchorPoint, AnchorTo, RelativePoint, xOffset, yOffset
local Anchor = { "TOP", Minimap, "TOP", 0 , 0 }

--Fonts
local showText = false -- Set to false to hide text
local mouseoverText = true -- Set to true to only show text on mouseover
local font,fontsize,flags = [[Interface\Addons\stExperienceBar\Media\homespun.ttf]], 10, "MONOCHROMEOUTLINE"

--Textures
local barTex = [[Interface\Addons\stExperienceBar\Media\Flat.tga]]
local flatTex = [[Interface\Addons\stExperienceBar\Media\Flat.tga]]

Waky 03-25-11 05:36 PM

Quote:

Originally Posted by Oraknathal (Post 232911)
Stexperience bar.
-- Config ----------------
--------------------------
--Bar Height and Width
local barHeight, barWidth = 3, Minimap:GetWidth()2

Try changing Minimap:GetWidth()2 to something like just "3", that won't work in lua since you're just attaching a number to the end of a function. Remove the Minimap:GetWidth() all together and put your own plain number or you can do something like "Minimap:GetWidth()+5" to go 5 (units) wider than the minimap.

Oraknathal 03-25-11 08:11 PM

Quote:

Originally Posted by Waky (Post 232922)
Try changing Minimap:GetWidth()2 to something like just "3", that won't work in lua since you're just attaching a number to the end of a function. Remove the Minimap:GetWidth() all together and put your own plain number or you can do something like "Minimap:GetWidth()+5" to go 5 (units) wider than the minimap.

So what should my LUA look like if I wanted to make the width manually?
As in how should it look like after i remove the minimap:getwidth()?
Soz im just not good at lua

Seerah 03-25-11 09:23 PM

Quote:

Originally Posted by Oraknathal (Post 232911)
Minimap:GetWidth()2

You should be getting a Lua error here. As Waky mentioned, you have a number attached to your function call which won't work. What exactly are you trying to accomplish with this "2"?

Oraknathal 03-26-11 02:54 AM

Its from carebears ui and it was meant to say -2 But I dont really want it there I just want my bar width to match my map I Dont know what to change in the code to change the width.

Seerah 03-26-11 12:07 PM

Minimap:GetWidth()

^^ == get the width of the minimap. Carebear's -2 was 2 less than the width of the minimap.

Oraknathal 03-26-11 02:55 PM

the minimap is about 140 pixels long but when I try put lets say 0 as the width instead of -2 the bar will disappear

Nibelheim 03-26-11 04:02 PM

Quote:

Originally Posted by Oraknathal (Post 232993)
the minimap is about 140 pixels long but when I try put lets say 0 as the width instead of -2 the bar will disappear

Forget about the number.

Code:

local barHeight, barWidth = 3, Minimap:GetWidth()

Kendian 03-26-11 04:07 PM

Quote:

Originally Posted by Nibelheim (Post 233000)
Forget about the number.

Code:

local barHeight, barWidth = 3, Minimap:GetWidth()

I had the code at one time, to have the width and height anything I'd like, but lost it moving to a diff computer. Any way to just get rid of a the Minimap GetWidth and just have width = somenumber and height = somenumber?

Nibelheim 03-26-11 04:16 PM

Quote:

Originally Posted by Kendian (Post 233001)
I had the code at one time, to have the width and height anything I'd like, but lost it moving to a diff computer. Any way to just get rid of a the Minimap GetWidth and just have width = somenumber and height = somenumber?

Yep. All Minimap:GetWidth() does is return a number, so replacing it with one is fine.

Oraknathal 03-26-11 04:39 PM

This is what it looks like after the,
local barHeight, barWidth = 3, Minimap:GetWidth() code was input


http://img825.imageshack.us/f/wowscr...711093623.jpg/

Oraknathal 03-26-11 04:49 PM

lol forgot to add to question in earlier post.

what I mean to say is what exactly should my LUA look like.
without the numbers obviously I'll input the numbers to make the the bar's width,height to my preference but what should change in my code to allow me do this.
I want to delete the getminimap lua line thingy so I can personally adjust mu width and height but how should the lua look like after?

Dainton 03-26-11 07:09 PM

If you want it to be the width of your minimap then shouldn't it be something like
Code:

local barHeight, barWidth = 3, Minimap:GetWidth()*Minimap:GetScale()
that?

Seerah 03-26-11 07:34 PM

If he has his minimap scaled to something other than 1, yeah.


and...
Quote:

the minimap is about 140 pixels long but when I try put lets say 0 as the width instead of -2 the bar will disappear
Well yeah - if you put a width of 0, it's going to be 0 "pixels" long. /edit: unless you mean Minimap:GetWidth()0, then you're back to the exact same error mentioned above. It should be + or - 0.

Othgar 03-26-11 09:10 PM

Quote:

Originally Posted by Oraknathal (Post 233005)
local barHeight, barWidth = 3, Minimap:GetWidth()

I'm no pro at Lua or anything but wouldn't "barWidth = 3" set the bar width to 3 leaving "Minimap:GetWidth()" serving no purpose?

Please tell me to go away if I'm wrong though lol

Andone 03-26-11 09:30 PM

local barHeight, barWidth = 3, Minimap:GetWidth()

means the barheight is 3 and barwidth is Minimap:GetWidth() ...seperated by the comma.

Seerah 03-26-11 09:37 PM

It's like saying "a and b are equal to 1 and 2 respectively".

Nibelheim 03-26-11 09:48 PM

Quote:

Originally Posted by Dainton (Post 233017)
If you want it to be the width of your minimap then shouldn't it be something like
Code:

local barHeight, barWidth = 3, Minimap:GetWidth()*Minimap:GetScale()
that?

Yep, if the xpbar isn't parented to the Minimap. Otherwise it's scale will remain relative to the Minimap's.

Oraknathal 03-27-11 03:18 AM

so how do I unparent it?

Nibelheim 03-27-11 03:32 AM

Quote:

Originally Posted by Oraknathal (Post 233042)
so how do I unparent it?

Code:

local Anchor = { "TOP", Minimap, "TOP", 0 , 0 }
to

Code:

local Anchor = { "TOPRIGHT", UIParent, "TOPRIGHT", 0 , 0 }
You'll need to change the last two numbers (X, Y) to move your bar. Both numbers will go negative to move the bar left and down. I.e.

Code:

local Anchor = { "TOPRIGHT", UIParent, "TOPRIGHT", -20 , -10 }
Will move your bar 20 pixels left, and 10 pixels down.


All times are GMT -6. The time now is 02:46 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI