Thread Tools Display Modes
06-21-11, 02:18 AM   #1
SRCarebear
A Fallenroot Satyr
AddOn Compiler - Click to view compilations
Join Date: Mar 2009
Posts: 26
rActionBarStyler - Pet Bar help.

Just wondering if anybody could help me with a little bit of code for rActionBarStyler.

I would like to create an if statement to move the petbar depending whether bar2 and bar3 is enabled.

I'm not sure how it would work because they're usually enabled / disabled using the in-game Action Bars tab.

Code:
if cfg.bars.bar2.enable then
    cfg.bars.petbar.pos { a1 = "BOTTOM", a2 = "BOTTOM", af = "UIParent", x = 0, y = 76 },
end
if cfg.bars.bar3.enable then 
cfg.bars.petbar.pos { a1 = "BOTTOM", a2 = "BOTTOM", af = "UIParent", x = 0, y = 104 },
end
Something like this, this doesn't work though. Also which file would the if statement be placed? The config.lua or the petbar.lua?

Thanks beforehand.
  Reply With Quote
06-21-11, 02:35 AM   #2
apocalipsus
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 5
Hi there.
Maybe this could help:

Code:
showBar1, showBar2, showBar3, showBar4 = GetActionBarToggles()
The GetActionBarToggles() returns 1 if the interface option is set to show the corresponding action bar.
In you case you should do something like this:

Code:
showBar1, showBar2, showBar3, showBar4 = GetActionBarToggles()
if (showBarx) then  -- replace x with the action bar you checking
 posy = y -- y postion you want
else
posy = y2 -- other position you want if the actionbar isn't showing
end
cfg.bars.petbar.pos { a1 = "BOTTOM", a2 = "BOTTOM", af = "UIParent", x = 0, y = posy},
edit: Actually i just notice the cfg.bars.petbar.pos is inside a table correct?
You can't do the "if, else," etc part inside the table. You need to do it outside the "table"
  Reply With Quote
06-23-11, 01:45 AM   #3
SRCarebear
A Fallenroot Satyr
AddOn Compiler - Click to view compilations
Join Date: Mar 2009
Posts: 26
I tried this last night and couldn't get it to work. Have you got it to work at all?
  Reply With Quote
06-24-11, 02:29 AM   #4
apocalipsus
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 5
Originally Posted by SRCarebear View Post
I tried this last night and couldn't get it to work. Have you got it to work at all?
Didn't test it myself tbh. I always have the 3 action bars activated (the bottom 3) but ill give a look later.
  Reply With Quote
06-26-11, 08:34 AM   #5
apocalipsus
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 5
Hello again.
I've been trying it and it works fine.

First on the config.lua At the very start (before the local addon, ns = ...) do this:
Code:
local posy --just creating a variable to store the value we want for the y position
local Bar1, Bar2, Bar3, Bar4 = GetActionBarToggles() -- getting the status of the actionbars. On this example im using actionbar2 wich is the "bottom right bar" on the blizzard interface
if(Bar2) then
	posy = 125 -- change this value to whatever u want if the action bar is activated
else
	posy = 250 -- change this value to whatever u want if the action bar is NOT activated
end
Then on the petbar config change the value on the y position to the variable we created before: posy

Should end like this:
Code:
pos = { a1 = "BOTTOM", a2 = "TOP", af = "rABS_MultiBarBottomRight", x = 0, y = posy },
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » rActionBarStyler - Pet Bar 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