Thread Tools Display Modes
06-29-09, 08:51 AM   #1
Cidwel
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 23
How to know the InstanceID in a Battleground

Hi all!

I want to make an addon that reports the Instance ID of the player's active battleground. I think that can be get with GetBattlefieldInstanceInfo(index) but I don't know how to handle this. This will be added in this way using SendChatMessage:

[Guild][Cidwel] We're inside Alterac Valley no. 3 and there's 3 slots available.

I know how to do anything except the number Id of the active Balttleground. I searched in wowinterface, wowprogramming and wowwiki without any results . Anyone knows how to do this? Thanks!
  Reply With Quote
06-29-09, 11:04 AM   #2
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
You can't really do that with GetBattleFieldStatus()
Originally Posted by wowwiki
instanceID
Integer - Battlefield instance (returns 0 until you are inside an active battlefield)
Besides, GetBattleFieldStatus() does not return the number of players currently active in that battlefield.

Trying to find the right API now.
  Reply With Quote
06-29-09, 11:42 AM   #3
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Originally Posted by Cidwel View Post
I know how to do anything except the number Id of the active Balttleground.
Maybe iterating through all indizes and then checking whether it is active or not:
Code:
local activeID
for i=1, MAX_BATTLEFIELD_QUEUES do
    if GetBattlefieldStatus(i) == "active" then
        activeID = i
    end
end
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
06-29-09, 12:21 PM   #4
Cidwel
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 23
whoops. Didn't work I tried the solution that Cargor have submited but it return to me other variables instead the BG instance number.

I tried to read the api over9000 times but no class is programmed to solve my trouble
  Reply With Quote
06-29-09, 12:24 PM   #5
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
I should maybe clarify a bit: This is the index you need for GetBattlefieldInstanceInfo(index) to fetch the correct data

EDIT: Okay, well, tested it - there are still problems :/ Give me some minutes

EDIT2: select(3, GetBattlefieldStatus(index)) is the way you go
__________________
« Website | GitHub »

Oh hai!

Last edited by xConStruct : 06-29-09 at 12:30 PM.
  Reply With Quote
06-29-09, 06:22 PM   #6
Cidwel
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 23
haha oh wow. It worked!

Many thanks to both!!!!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to know the InstanceID in a Battleground


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