Home - Blog - Contact

CogsBar McRun

Version 1.0 - 2010-05-19 15:16 - See Setting up CogsBar for the latest version

CogsBar McRun is a reincarnation of my original CogsBar addon. It requires the McRun framework, which means you don't actually have to install any addons. All the code is stored in macros which means it's also saved to the server.

Feedback? Questions? Suggestions? Please visit the official McRun forum thread.

Overview

As with the original CogsBar, this addon follows the philosophy of doing one thing really well. All it does is create action bars. No effort is made to replace any other default UI functionality. It won't even hide the main bar on its own. I use the following macro to accomplish that:

/run if MainMenuBar:IsShown() then MainMenuBar:Hide() else MainMenuBar:Show() end

Of course, there are plenty of other addons out there you can use to replace the XP bar, menu buttons, bag buttons, casting bar, etc. You can even use the portions of other bar mods that do these things.

Why should you use CogsBar McRun?

Because I'm awesome! :P Seriously, though, here are some benefits of CogsBar over other bar mods.

* Macaroon is the notable exception, and I've used it throughout WotLK. However, it has its own unique quirks since it doesn't use the built-in action bar button template.

Why shouldn't you use CogsBar McRun?

McRun addons share a few caveats, and CogsBar is no exception. Here are some of the specific reasons you might want to use another bar mod:

* I may be adding a state-controlled visibility option in the future, though i'm hesitant to bump CogsBar's macro usage above 3 slots.

Setting up CogsBar

Requirements: McRun, three free account-wide macro slots, and at least one free character-specific macro slot

First you'll need to install the latest version of McRun. Be sure to read through the User's Guide if you haven't used it before. Once you have it installed, create the following three macros in your account-wide macros (or character-specific if you only want it on one character).

CogsBar1

local C,a={},1 McRun("CBConfig",C)for I,c in ipairs(C.bars)do local N,B,r,p,x,y,b,h,n="CB"..I,{}h=CF("Button",N,UIParent,"SecureHandlerStateTemplate,UICheckButtonTemplate")h:SzPt(16,16,c.P or"BOTTOM",c.H,c.V)h:MM()for i=1,c.B do x,y,n=0,0,N.."_"..i if i

CogsBar2

==1 then r,p=h,"BOTTOMRIGHT"elseif(i-1)%c.W==0 then r,p,y=B[i-c.W],"BOTTOMLEFT",-4 else r,p,x=B[i-1],"TOPRIGHT",4 end b=CF("CheckButton",n,h,"ActionBarButtonTemplate")B[i]=b b:SP("TOPLEFT",r,p,x,y)if c.K and c.K[i]then b:RB()SetBindingClick(c.K[i],n)end

CogsBar3

b:SA("action",a)a=a+1 end if c.S then h:SA("_onstate-a","for _,c in ipairs(newtable(self:GetChildren()))do c:SetAttribute('*action*',c:GetAttribute('action')+(newstate-1)*"..c.B..")end")RegisterStateDriver(h,"a",c.S)a=a+c.B*(c.N-1)end end

Now add McRun "CogsBar" to your McLoad script, and you're ready to begin configuring bars!

Configuring bars

CogsBar McRun uses configuration scripts stored in macros called CBConfig1, CBConfig2, etc. It's probably best to keep these in your character-specific macros unless none of your characters have stances/forms (including stealth). Here is an example which I currently use for my Warrior:

bars={
{B=28,W=7,V=180,H=-320,
S="[form:1]1;[form:2]2;[form:3]3",N=3,
K={'1','2','3','4','5','6','7',
"'",',','.','P','Y','F','G',
'A','O','E','U','I','D','H',
';','Q','J','K','X','B','M',},
},
{B=36,W=9,V=180,H=50},
}

Below is a screenshot of the resulting bars. As you can see, each bar is just a simple grid of action buttons. The little square at the upper-left of the bar is a dragging nub so you can move the bar around on the screen (as mentioned above, moving the bar with the nub is only temporary).

Cogwheel's CogsBar McRun layout

Configuration format

The general format of the config script is:

bars = { {bar 1 config options}, {bar 2 config options}, ... }  

When CogsBar loads, it will go through each set of config options in order to create the bars.

Here are the options that can appear in each config:

B=# (required)

The total number of buttons in the bar

The total number of buttons (× states) used by all your bars cannot exceed 120 (the built-in action slot limit).

W=# (required)

The width of the bar in buttons

P="point" (optional)

The anchor point of the bar (defaults to "BOTTOM").

Note that the anchor point sets the position of the dragging nub, not the entire bar. The grid of buttons will always be anchored to the lower right corner of the dragging nub.

V=# (required)

Vertical offset - the number of pixels to move the bar up from the anchor point (negative numbers move it down)

H=# (required)

Horizontal offset - the number of pixels to move the bar right from the anchor point (negative numbers move it left)

S="states", N=# (optional)

S is a secure command option list of possible states. The states must evaluate to numbers from 1 to N. See Making a macro for instructions on using the secure option syntax.

When CogsBar creates a bar with states, it "consumes" a number of action slots equal to N × B. The first state is mapped to the first set of B action slots, the second state is mapped to the second range of B slots, etc. This means my 7x4 stance changing grid uses up 28 × 3 = 84 action slots. That leaves exactly the 36 slots needed for my "utility" bar.

You can also use this mechanic to "skip" action slots. For example, you may want to use the built-in bar but just use CogsBar to add an extra utility grid. A config like the following will skip the pages used by the default UI (at least for non-stance classes):

{B=12,W=4,V=300,H=0,P="LEFT",S="7",N=7}

Since S will always evaluate to 7, the buttons will never be mapped to the slots used by the 6 main action bar pages. The alternative is to create an additional bar that's positioned offscreen. However, using states takes up less space in the configuration macro, and doesn't create any extra buttons (read: extra memory & cpu usage).

K={} (optional)

A list of key bindings for the bar in the form {'key1', 'key2', 'key3', nil, 'key5', nil, nil, 'key8', ...}

The bindings are applied in order from left-to-right, top-to-bottom. The screenshot above illustrates this. If you don't want to bind some of the keys, you can change replace 'key' with nil. You can also make the list of keys shorter than the number of buttons if you only need to bind the first buttons in the bar.

Copyright ©2008-2009 Matthew Orlando
This site is not affiliated with Blizzard Entertainment or John Wiley and Sons.