Thread Tools Display Modes
09-24-06, 12:37 PM   #81
Grumpey
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 5
I was playing with something like this for stance shifting, I briefly checked this on my druid and it worked, but I'm not sure how practical it is to do mass bar changes on shapeshift/stance changes.

Bar all
Event: UPDATE_BONUS_ACTIONBAR

Code:
for i=1,3 do
	_,_,active = GetShapeshiftFormInfo(i)
	if (( active == 1 )) and (( i == 1 )) then
		--Stance 1
		BActionBar.SetStanceOffset(2,1)
		--Break to exit loop since you can only be in one stance at a time
		break
	elseif (( active == 1 )) and (( i == 2 )) then
		--Stance 2
		BActionBar.SetStanceOffset(2,3)
		BActionBar.SetStanceOffset(1,2)
		--Break to exit loop since you can only be in one stance at a time
		break
	elseif (( active == 1 )) and (( i == 3 )) then
		--Stance 3
		BActionBar.SetStanceOffset(2,4)
		BActionBar.SetStanceOffset(1,1)
		--Break to exit loop since you can only be in one stance at a time
		break
	else
		--return bars to normal
		BActionBar.SetStanceOffset(2,0)
		BActionBar.SetStanceOffset(1,0)
		
	end
end
  Reply With Quote
09-25-06, 06:42 AM   #82
elvenn
A Defias Bandit
Join Date: Sep 2006
Posts: 2
Exclamation Yikes Grumpey

thats way too much code to be running for every bar, 100 times a second.

i hate having to use UPDATE_BONUS_ACTIONBAR in the first place. using UPDATE_SHAPESHIFT_FORMS would only call the code once when you change forms.... sooo much more effiecent.

EDIT: the more i think about it, is UPDATE_BONUS_ACTIONBAR only fired when you hit a button on the actionbars? if so i can live w/ that.

Last edited by elvenn : 09-25-06 at 07:02 AM.
  Reply With Quote
09-25-06, 05:47 PM   #83
Tuller
A Warpwood Thunder Caller
 
Tuller's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 91
I'm trying to get a mouseover script on bar6 and it's just not working.
There isn't a mouseover event

BarIDs:
The "all" bar id refers to all bars, including things like the casting bar. You can specify bars 1 to 10 by 1-10.

Using a range, you can reduce this code:
Code:
BAR:3
EVENT: UPDATE_BONUS_ACTIONBAR
if GetBonusBarOffset() == 1 then BActionBar.SetStanceOffset(bar.id, 2)
elseif GetBonusBarOffset() == 2 then BActionBar.SetStanceOffset(bar.id, 0)
elseif GetBonusBarOffset() == 3 then BActionBar.SetStanceOffset(bar.id, 6) end
RUN AT LOAD: Checked

BAR:4
EVENT: UPDATE_BONUS_ACTIONBAR
if GetBonusBarOffset() == 1 then BActionBar.SetStanceOffset(bar.id, 2)
elseif GetBonusBarOffset() == 2 then BActionBar.SetStanceOffset(bar.id, 0)
elseif GetBonusBarOffset() == 3 then BActionBar.SetStanceOffset(bar.id, 6) end
RUN AT LOAD: Checked
To simply this:
Code:
BAR:3-4
EVENT: UPDATE_BONUS_ACTIONBAR
if GetBonusBarOffset() == 1 then BActionBar.SetStanceOffset(bar.id, 2)
elseif GetBonusBarOffset() == 2 then BActionBar.SetStanceOffset(bar.id, 0)
elseif GetBonusBarOffset() == 3 then BActionBar.SetStanceOffset(bar.id, 6) end
RUN AT LOAD: Checked
Events:
UPDATE_BONUS_ACTIONBAR is called whenever the main bar would change when changing form/stances, and also when switching to moonkin.

UPDATE_SHAPESHIFT_FORMS, or whatever it is called, should be called whenever one of the class buttons changes in state from enabled to disabled

I really need to write some custom events, or make a nice UI for stance shifting and stuff.

Syntax Changes:
I might end up changing the syntax for scripts in the future to be more OOish: bar:SetStance(2), instead of BActionBar.SetStanceOffset(bar.id, 2)

BBar.Show(bar) would become: bar:Show(), assuming I can safely hook the show function.
  Reply With Quote
09-25-06, 11:36 PM   #84
behkat
A Defias Bandit
Join Date: Sep 2006
Posts: 3
Cooldown auto-hide/show:
Code:
local start,duration=GetActionCooldown(BActionBar.GetStart(20));
if not BBarCD_OnUpdate then
  BBarCD_OnUpdate=function()
  this.origOnUpdate(arg1);
  if this.CDupdate<=0 then
    if this.CDExpire<GetTime() then
      BBar.Toggle(this);
    end;
    this.CDupdate=0.2;
  else
    this.CDupdate=this.CDupdate-arg1;
  end;
  end;
end;
if duration>1.5 and not bar:IsShown() then
  BBar.Toggle(bar);
  bar.CDExpire=start+duration;
  bar.CDupdate=0.2;
  bar.origOnUpdate=bar.origOnUpdate or bar:GetScript("OnUpdate") or function() end;
  bar:SetScript("OnUpdate",BBarCD_OnUpdate);
end;
This shows the button with my cooldown spell only when on cooldown. If you want to show the button when off cooldown you need to reverse the logic and create an update frame to watch the cooldown since OnUpdate isn't processed on a Hidden frame.
(I don't know why the forum shows two spaces in GetStart, but they're not supposed to be there)

Last edited by behkat : 09-27-06 at 06:18 PM. Reason: made hook safe
  Reply With Quote
09-28-06, 09:09 AM   #85
Avae
A Defias Bandit
Join Date: Sep 2006
Posts: 3
I've been looking everywhere for a more complete list of scripting that works with Bongos. I'm inexperienced with it, however I'm a wiz at copy/paste. I found the name of the event that I want to trigger a bar to show, and when its over have the bar hide again.

PLAYER_CONTROL_LOST

But I have no idea how to word it. Could someone please help?
  Reply With Quote
09-28-06, 09:20 AM   #86
Avae
A Defias Bandit
Join Date: Sep 2006
Posts: 3
Thought I would come back and post the couple of scripts that I do have that work in case someone else needs them.

if ( UnitCanAttack("target", "player") ) then
bar:Show()
else
bar:Hide()
end

That one hides the bar until you target a hostile enemy.


if (UnitCreatureType("target")=="Undead") then
bar:Show()
else
bar:Hide()
end

That one I use for my shackle, the shackle button stays hidden until I target an undead creature type.
  Reply With Quote
09-28-06, 01:39 PM   #87
Scae
A Deviate Faerie Dragon
Join Date: Jan 2006
Posts: 11
I've read the druids replies and it seems people are doing very complex things for something simple (simple coding wise, the concept took my a long time to get my head round ><).

The druids stance changes work just like a warriors, except the stance offset is 0 instead of 1.

My current setup

Bar 1
Bar 5
are my main bars.

My bear stuff is on bar 4 and 8
Cat form actions are on bar 2 and 6

Now my script attached to bar 1 and 5

Event = UPDATE_BONUS_ACTIONBAR

script=

if GetBonusBarOffset() == 0 then
BActionBar.SetStanceOffset(bar.id, 0)
else
BActionBar.SetStanceOffset(bar.id, GetBonusBarOffset())
end


Works perfectly for me. (the script is literally that btw, just copy and paste it).

Also if you change things, try reloading the ui to see the effect as they don't seem to come into effect otherwise.
  Reply With Quote
09-28-06, 02:43 PM   #88
jpwoof
A Murloc Raider
Join Date: Sep 2006
Posts: 4
I'm not familiar with LUA scripting but I hope someone could help me through with this. I've been using Discord Action Bars and Flexbars for one single purpose, to have an action bar appear when enterting combat/targeting a hostile or duel player and hides when leaving combat / de-targetting.

How can I accomplish these events? Thanks!
  Reply With Quote
09-28-06, 04:12 PM   #89
Avae
A Defias Bandit
Join Date: Sep 2006
Posts: 3
If you look two posts up I posted the code I use to do that. The bar is hidden until I target a hostile player and goes away when I don't have a target that is hostile.

You just go to the script tab on bongos options, put in the bar # you want to behave that way, put in an event name such as PLAYER_TARGET_CHANGED, copy paste that code, check the box at the bottom to load. Press save and save your profile after you have everything the way you want it. Reload your ui via /reload ui to keep all changes.
  Reply With Quote
10-01-06, 06:32 PM   #90
Valinear
A Murloc Raider
Join Date: Aug 2006
Posts: 4
Execute Script 'o' doom

I tried the Unit_Health function, I was trying to setup a script that would show bar five only when

Target hp is <20% and Rage is >15

That way, Bar 5 with Execute, will only show Execute when it's usable, any tips?
  Reply With Quote
10-06-06, 06:18 PM   #91
Vekkth
A Defias Bandit
Join Date: Apr 2006
Posts: 2
need some advice here

i want to make one bar (actually one button) to appear when a spell put on it is available (riposte)

so i have 2 ideas how to make it
1) Make it appear with UNIT_COMBAT, player, parry .
think its easy to make it appear but i want it to presist or 3-4 seconds after (the time riposte is available for casting, dont know exact time, but will test later).
any advice on what should i write in script field?

2) make it other way i dont know - may be there is a simple event detecting availability to cast in WoW and i just missed it.

thanks a lot.
  Reply With Quote
10-08-06, 08:16 AM   #92
Fendryl
A Kobold Labourer
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 1
Any update on a mouseover event?

I'm trying to move from DAB, as most of the options aren't really necessary for me; however, hide/show on mouseover is =)
  Reply With Quote
10-09-06, 10:27 AM   #93
Tuller
A Warpwood Thunder Caller
 
Tuller's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 91
WoW 2.0, aka The Burning Crusade, introduces significant changes to the UI. Those changes are dramatic enough that the stuff I allow you to do with scripting may not work in the future. This includes things like showing a bar or moving a button, and possibly contextual things like ranged bar paging. Its still unclear what's really changed, and I won't know everything until I can get on a test realm with the changes.

So, don't get too comfortable

PLAYER_CONTROL_LOST
But I have no idea how to word it. Could someone please help?
PLAYER_CONTROL_LOST fires when you lose control of your player, including when riding a gryphon. PLAYER_CONTROL_GAINED fires when you regain control. So...
Code:
Event: PLAYER_CONTROL_LOST
Bar: all
Action: BBar.Hide(bar)

Event: PLAYER_CONTROL_GAINED
Bar: all
Action: BBar.Show(bar)
Would hide all of Bongos when you lose player control.

Target hp is <20% and Rage is >15

That way, Bar 5 with Execute, will only show Execute when it's usable, any tips?
You'd want to check UnitHealth("target") < 20 and UnitMana("player") > 15. Mana refers t energy, focus, and rage in addition to mana.

i want to make one bar (actually one button) to appear when a spell put on it is available (riposte)
I'm actually not sure how I'd do this. I'd try checking if the skill on the button is usable (IsUsableAction(slot)) on the event ACTIONBAR_UPDATE_USABLE, showing it if it is, and hiding it if its not. Slot can be figured out by figuring out its keybinding.

Any update on a mouseover event?
Its one of the things on my list to do when I update Bongos after finishing the work on Sage. I'll be adding the events BONGOS_BAR_ENTER, and BONGOS_BAR_LEAVE with arg1 being the bar that's being entered/left
  Reply With Quote
10-09-06, 09:37 PM   #94
Vekkth
A Defias Bandit
Join Date: Apr 2006
Posts: 2
works like charm
many thanks, Tuller.
Bongos > world. =)
  Reply With Quote
10-10-06, 04:38 PM   #95
Kaaihn
A Defias Bandit
Join Date: Jan 2005
Posts: 3
Warrior help

I am trying to switch from flexbar over to bongos for a warrior, and having some difficulty with the stances.

First thing, I have bar number increased to 120 so that I can individually position each button where I want it on screen.

Currently for flexbar, I linked buttons 1-10, 11-20, and 21-30 to be three seperate groups. I then scripted the remapping of buttons 1-10 to remap to 11-20 if I go to defensive stance, or 21-30 if I go to beserker stance. So I only ever see one group of 10 buttons on screen, the spells on those buttons just change when I change stances, keeping the same bindings.

I am looking to duplicate this functionality in bongos. Can someone please post exactly what the script needs to be for bar 1 (which is 1 button with actionbars pushed up to 120) to remap itself to bar 11 (again, which is one button) if I hit defensive, or for bar 1 to remap itself to bar 21 (one button) if I hit beserker stance.

With each button being its own bar, and my using 10 buttons per stance, I would need to take bar 1-10 (which is 10 buttons total) and put in 10 scripts I assume. Bars 11-30 (20 buttons) I am assuming would get hidden.

Any help would be greatly appreciated.

*Edit:

Nevermind, got it figured out. The default script for changing bars based on stance conditionals just needs to be duplicated for each bar you want to change, with the right bar.id specified. It seems to be +2 above the specified id. The default script specifies 5, which sets bar 7, 8, and 9 changing with stance changes.

I wanted to use buttons 1-10 as my visible stance bar, with buttons 11-40 being hidden. I changed the default script for button 1 to start with bar.id 9 (which is actually button 11). Then duplicate the script for button 2, specifying bar.id 11 (which is actually button 12). Repeat for bar 1-10, then hide bar 11-40 and you are set.

My only complaint with bongos so far is that I lose 10 buttons over flexbar. For 3 stances, you are taking 4 bars. The main, which gets propagated from one of the other 3 hidden ones, versus flexbar where the main is one of the bars, and remaps itself to one of 2 hidden bars, giving 10 extra buttons to work with.

Is there a cleaner way to accomplish this? Maybe a way to have 3 stances only take up 3 bars instead of 4?

Last edited by Kaaihn : 10-11-06 at 05:03 PM.
  Reply With Quote
10-11-06, 08:44 PM   #96
Pfire
A Defias Bandit
Join Date: Aug 2006
Posts: 2
Is this for whole bars or can you script for a button?


Example have a Shackle Undead button hidden untill I target a Undead Mob.

but I would like the rest of the bar to still show.
  Reply With Quote
10-11-06, 09:03 PM   #97
Tuller
A Warpwood Thunder Caller
 
Tuller's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 91
My only complaint with bongos so far is that I lose 10 buttons over flexbar. For 3 stances, you are taking 4 bars. The main, which gets propagated from one of the other 3 hidden ones, versus flexbar where the main is one of the bars, and remaps itself to one of 2 hidden bars, giving 10 extra buttons to work with.

Is there a cleaner way to accomplish this? Maybe a way to have 3 stances only take up 3 bars instead of 4?
Two things to note. First, you can specify a range of bars by putting 1-10 as the bar arg.
The other thing to note about warriors is that you always have a GetBonusBarOffset() that's greater than 0. So, you'd want to do if GetBonusBarOffset() == <index of your default stance> then don't change, else change.

BMsg(GetBonusBarOffset()) will print whatever offset is at a given point in time to your first chat window.

Is this for whole bars or can you script for a button?
All scripts are for bars, but bars can be set to be single buttons.
  Reply With Quote
10-13-06, 12:57 AM   #98
Hei-di
A Defias Bandit
Join Date: Sep 2006
Posts: 3
since im not realy into scripting in wow, i just want to know the event for being pvp-flaged or not beeing

want a new bar to show up when im pvping and unshow when leaving pvp

thx heidi

edit:

if now tried

Code:
bar:      3
event:   UNIT_PVP_UPDATE
action:
BBar.Toggle(3)
but id doesnt work
whats wrong about it?

Last edited by Hei-di : 10-13-06 at 02:23 AM.
  Reply With Quote
10-14-06, 12:31 PM   #99
Tuller
A Warpwood Thunder Caller
 
Tuller's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 91
since im not realy into scripting in wow, i just want to know the event for being pvp-flaged or not beeing

want a new bar to show up when im pvping and unshow when leaving pvp
UNIT_PVP was removed in 1.11, per the wiki. Try UNIT_FACTION, arg1 == "player", and check if the player is in pvp or not
  Reply With Quote
10-17-06, 01:19 AM   #100
Soltaris
A Kobold Labourer
Join Date: Oct 2006
Posts: 1
I've been trying to figure out how to get a couple buttons set up for my mage. Is there a way I can program my water button so that my action bar shows the number of units of water I have left like it does with Blizzard's UI, yet lets me drink water with the left mouse button, and lets me conjure water with the right mouse button?

I could set up my food and mana ruby to do the same thing and save having to have so many buttons on my screen.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Released AddOns » Bongos - Scripting


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