Bongos - Light at the end of the tunnel

Started by Shadowwolf, December 06, 2006, 09:14:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Shadowwolf

So I hear oodles of complaints about Bongos in 2.0. Lost of people are caving in on its complexity after about what I can only see as a short time trying to tweak with it without much luck. So....

Being as I have used this mod for almost a year now and basically cant live in WoW without it (Beta was rough to play without it while waiting for the 2.0 version) I thought I would post the howto stuff here since the Wowinterface server is always down lately and just stress that you guys who have had issues with it should try to give it a chance. Its a pain at first, but once you get it down im positive you will love it.

Original thread can be found here when the site goes back to working: http://www.wowinterface.com/forums/showthread.php?t=5889




With WoW 2.0 (The Burning Crusade), things like showing, hiding, and moving action buttons in combat will most likely no longer work. In response to this, I have the scripting functionality from Bongos

Note: This thread is a work in progress. Ask questions

"I want to make another actionbar change when I change stances."
"I want to make an actionbar hide when I have no target."
"I want to make all bongos bars become transparent when I'm in town."
"I want to make <bar> do <action> when <event> happens."

With the release of Bongos 6.8.23, all of those things are now possible via scripting. Scripting is a feature intended for advanced users. You're going to want to know a bit about Lua, the WoW API, in game events, and the code of Bongos itself.


Writing a Script

Open up the options menu, and go to the scripts tab. You'll see three sections: bar, event, and action.

Bar - The barID we want listening for the event, or "all" for all bongos bars. You can figure out a bar's ID, if the bar is shown, by unlocking bar positions. bags is for the bag bar, 1 for the actionbar 1, menu for the menu bar, etc. You can also specify a group of bars, ex bags menu key for the menu, bags and key bars, and a range of bars, ex 1-10 for actionbars 1 through 10.
Event - What event we're watching for. A good list of events can be found at the wiki
Action - What we do when the specified event happens. This part is written in Lua. You have access to the normal globals for an event (event, arg1, arg2, etc), as well as the bar the event is being called for (bar).
Run At Load - This checkbox makes the given action run right after all bars have been created.
Saving - Click the save button. Code will only be saved if there were no errors in it.


Useful Bongos Stuff

bar

    * The bar a script is being run for.
    * A bar is a frame. You have access to all frame functions.
    * You can access a bar's ID via bar.id, or the function BBar.GetID(bar).


BBar - These functions work on all Bongos bars (action, class, bags, etc)

    * BBar.Show(bar [, save])
          o Shows the given bar.
          o If save is true, then save the bar's settings
    * BBar.Hide(bar [, save])
          o Hides the given bar.
          o If save is true, then save that the bar's hidden.
    * BBar.Toggle(bar [, save])
          o Show the bar if it's hidden, hide the bar if it's shown.
          o If save is true, then save its new setting.
    * BBar.Lock(bar)
          o Stops the given bar from moving, and hides its drag frame.
    * BBar.Unlock(bar)
          o Lets the given bar move, shows its drag frame.
    * BBar.SetScale(bar [, scale [, save]])
          o Sets the bar's scale.
          o This is different than frame:SetScale(scale) in that the top left position of the bar should remain constant
          o Prevents the drag frame's scale from changing.
    * BBar.SetAlpha(bar [, alpha [, save]])
          o Sets the bar's opacity.
          o This is different than UIObject:SetAlpha(alpha) in that the drag frame for any given bar will not become completely transparent.
    * BBar.GetID(bar)
          o Returns the barID of a given bar.
    * BBar.IDToBar(barID)
          o Takes a barID, ex menu, bags, or pet, and returns its related bar.
    * BBar.ForAll(action, arg1, arg2, ...)
          o Does action(bar, arg1, arg2, ...) to every bongos bar
          o If you wanted to say, make every bar transparent, you could do BBar.ForAll(BBar.SetAlpha, 0.5)


BActionBar - These functions only work on action bars.

    * BActionBar.SetStanceOffset(barID, offset)
          o Switches a bar's page to barID + offset
          o It will not switch pages if you're manually paged (shift + number)
          o So, BActionBar.SetStanceOffset(2, 1) would change the second actionbar to have the same buttons as the third actionbar.
    * BActionBar.SetContextOffset(barID, offset)
          o Switches a bar's page to barID + offset
          o It will not switch pages if you're manually paged (shift + number), and also not in a stance
          o So, BActionBar.SetContextOffset(2, 1) would change the second actionbar to have the same buttons as the third actionbar.


BProfile - These functions are used for loading and saving Bongos layouts. I don't have an exact time, but I would suggest not frequently loading profiles

    * BProfile.Load(profileName)
          o Loads the given Bongos layout, if it exists.
    * BProfile.GetDefault()
          o Returns the name of the default profile, if one exists.


BScript - These functions are used to define event actions for Bongos completely in Lua.

    * BScript.AddEventAction(event, action [, runNow])
          o Adds a function for Bongos to run on the given event.
          o Any event can have multiple functions. These are called in the order they were added
          o When the event is called, the function that is being called is passed to the function, but not currently the event being called (note to self: Do that)
          o If runNow is true, then the event action will be run immediately after being saved.
    * BScript.AddStartupAction(action [, runNow])
          o Adds an event action to run right after all addons have been loaded.
          o Right now, its equivalent to BScript.AddEventAction("VARIABLES_LOADED", action [, runNow])
    * BScript.AddBarEventAction(barList, event [, action [, runNow]])
          o Adds an event action to be run for the given barList.
          o A bar list can be a single barID, ex class, a set of barIDs, ex class pet bags, a range of barIDs, ex 1-10, or all for all bars
          o Does not run if no bars currently exist in the given barList.
          o Currently, you can only have one action per bar event
          o If runNow is true, then the action will be run for the bar immediately after being saved.
          o When run, the action is passed both the event and bar, ex action(event, bar)
    * BScript.RemoveEventAction(event, action)
          o Removes the given action from the list of things to run when the given event happens.
    * BScript.RemoveEventForBar(event, barList)
          o Removes any event actions for all barIDs in the given barList on the given event
    * BScript.CallEvent(event)
          o Runs all event scripts for the given event
    * BScript.CallBarEvent(event)
          o Runs all bar event scripts for the given event
    * BScript.CallBarEventForBar(event, barList)
          o Triggers the bar event script for all barIDs in the given barList

Examples

Making the second actionbar switch when you shapeshift/change stances:
bar:      2
event:   UPDATE_BONUS_ACTIONBAR
action:
BActionBar.SetStanceOffset(bar.id, GetBonusBarOffset())


Make the first actionbar hide when you don't have a target:
bar:      1
event:   PLAYER_TARGET_CHANGED
action:
if UnitExists("target") then
    bar:Show()
else
    bar:Hide()
end
Run at Load:  Checked


Make the tenth bar transparent when in combat. This one requires two scripts, one for entering combat, and one for leaving combat:
bar:      10
event:   PLAYER_REGEN_DISABLED
action:
BBar.SetAlpha(10, 0.5)
Run at Load:  Checked


bar:      10
event:   PLAYER_REGEN_ENABLED
action:
BBar.SetAlpha(10, 1)
Run at Load:  Checked
Come to the darkside, we have cookies.
"A flute with no holes is not a flute, and a donut with no hole is a danish" - Chevy Chase as Ty Webb in Caddyshack
"Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind."- Dr. Suess


Shadowwolf

Conditionals

event: UNIT_HEALTH
action:
if arg1 == "target" then
    if UnitHealth("target") <= 20 then
        bar:Show()
    elseif not bar:IsShown() then
        bar:Hide()
    end
end


This event WILL still fire on every unit health event, but it won't do much on it. I'm going to end up upgrading the event system a bit so you can specify a group of bars like you can in slash commands.

It's possible to do custom events via the function BScript.CallBarEvent(event), and here's how the previous code would probably look like using one:

event: UNIT_HEALTH
action:
if arg1 == "target" then
    arg1 = UnitHealth("target")
    BScript.CallBarEvent("BONGOS_TARGET_HP_UPDATE")
end


event: BONGOS_TARGET_HP_UPDATE
action:
if arg1 <= 20 then
    bar:Show()
elseif not bar:IsShown() then
    bar:Hide()
end
Come to the darkside, we have cookies.
"A flute with no holes is not a flute, and a donut with no hole is a danish" - Chevy Chase as Ty Webb in Caddyshack
"Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind."- Dr. Suess


Peligrie

You mean....bongo's aren't just drums? They speak a different language too?  ;)

haha. I have no idea what any of that means but....kudos and congrats on fleshing out the steps for those that know what you're talking about  :)