Random BG (queue) Macro

UI and Macro
I found above code does not workin.

here is my new "queue Capture the Flag game" macro using RequestBattlegroundInstanceInfo(). first line "Horde Battle Standard" is just for Horde :)
#show Horde Battle Standard
/run local j=0 for i=1,GetNumBattlegroundTypes() do local n,ok=GetBattlegroundInfo(i); if ok and (n=="Warsong Gulch" or n=="Twin Peaks") then RequestBattlegroundInstanceInfo(i); JoinBattlefield(j); j=j+1 end end

if you want to use battlefield ID to against number of characters,
/run local j=0 for i=1,GetNumBattlegroundTypes() do local n,ok,_,_,id=GetBattlegroundInfo(i); if ok and (id==2 or id==108) then RequestBattlegroundInstanceInfo(i); JoinBattlefield(j); j=j+1 end end
Battlefield ID sheet
# Name ID
1 Random Battleground 32
2 Twin Peaks 108
3 The Battle for Gilneas 120
4 Warsong Gulch 2
5 Arathi Basin 3
6 Eye of the Storm 7
7 Alterac Valley 1
8 Strand of the Ancients 9
9 Isle of Conquest 30
With the original macro posted it doesn't queue when I get out of a BG I've just done.. What on earth would be causing this?
07/07/2012 07:40 AMPosted by Iunix
With the original macro posted it doesn't queue when I get out of a BG I've just done.. What on earth would be causing this?

It's not designed for it. All that macro does is drop you out of the BG queue and dungeon queue and queues you up for a random battleground.

This was needed at the time because there was a problem in early cata with the BG queue system where you could be stuck in queue for hours because the server never acknowledged you were in queue.

This is why you check post dates before you post (you can fine those right above the quote and reply buttons)

Use this macro instead:
/run for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end end

This works great for whichever BG in the PvP page is selected, is it possible to queue two as Choonster requested? I too would like to queue both WSG and Arathi with one button press, regardless which BG is already queued? Two separate buttons would be a fine alternative.

/run for i=1,GetNumBattlegroundTypes()do local _,_,_,_,BGID=GetBattlegroundInfo(i)function JB(I)JoinBattlefield(BGID==I and i)end JB(1)JB(2)end

Did not work at all. Thanks
Hey guys,

I've got a slight issue with the Warsong Gulch queue. it doesn't work after I've exited a battleground for some reason?
Here's the Macro code I used.

/run for i=1,GetNumBattlegroundTypes()do local name,_,_,_,_=GetBattlegroundInfo(i)if name=="Warsong Gulch"then JoinBattlefield(i)end end

Is there anything wrong with that that disables the macro to be used after I've left the battleground? Any info would be great. Cheers :)
Hey so I am using this macro and it works once but then once I try to re que it doesn't work again. Help please?
That's my issue aswell
/run TogglePVPFrame()for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end end TogglePVPFrame()

This is the macro I use. It will queue you for the bg highlighted in the pvp frame, and works every time.
Hey, is there a way to make a script so when the BG is OVER, I can leave?? I am having issues leaving the battleground at the end using the macros above. When used, I get booted and placed with deserter. Plz help

local myEventFrame, MyEvents = CreateFrame("Frame"), {};
local ag = false
local BGIndex = 0
local RandomQueue = false
local SpecificQueue = false

function MyEvents:PVPQUEUE_ANYWHERE_SHOW(...)
--print(string.format("BGIndex: %d",BGIndex))
local Index = BGIndex - 1
--print(string.format("BGIndex: %d | Index: %d",BGIndex,Index))
JoinBattlefield(Index, ag)

function QueueBgs(AsTeam, Random)
local WarsongGulch = false
local ArathiBasin = false
local RandomBG = false

if Random == true then
RandomQueue = true
SpecificQueue = false
RandomQueue = false
SpecificQueue = true

local i = 0
local Status,BG = GetBattlefieldStatus(i)
--if Status ~= nil and BG ~= nil then
-- print(string.format("Status: %s | BG: %s | Index: %d",Status,BG,i))

if BG == "Warsong Gulch" and Status == "queued" then
WarsongGulch = true
elseif BG == "Arathi Basin" and Status == "queued" then
ArathiBasin = true
i = i + 1

local Index = 1

while Index <= GetNumBattlegroundTypes() do

local Name, CanEnter, IsHoliday, IsRandom, BGID = GetBattlegroundInfo(Index)

local Holiday = "False"
local Random = "False"
local Entry = "False"

if IsHoliday == true then
Holiday = "True"
if IsRandom == true then
Random = "True"
if CanEnter == true then
Entry = "True"

--print(string.format("[%d]Name: %s | Entry: %s | Bonus: %s | Random: %s",Index,Name,Entry,Holiday,Random))

if CanEnter == true then
if SpecificQueue == true then
if Name == "Warsong Gulch" and WarsongGulch == false then
elseif Name == "Arathi Basin" and ArathiBasin == false then
elseif RandomQueue == true then

Index = Index + 1

function JoinBattlegroundType(index, asGroup)
--if myEventFrame:IsEventRegistered("PVPQUEUE_ANYWHERE_SHOW") then
-- error("A join battleground request is already being processed.")


BGIndex = index
aG = asGroup


Queue as Random-Solo

Queue as Random-Group

Queue as Specific-Solo

Queue as Specific-Group


local f = CreateFrame("Frame");
f:SetScript("OnUpdate", function(self, sinceLastUpdate) f:onUpdate(sinceLastUpdate); end);

function f:onUpdate(sinceLastUpdate)
self.sinceLastUpdate = (self.sinceLastUpdate or 0) + sinceLastUpdate;
if ( self.sinceLastUpdate >= 5 ) then -- in seconds
if UnitInBattleground("player") == nil then
self.sinceLastUpdate = 0;

02/01/2016 01:21 PMPosted by Judgemênt

Hate to necro on an old post, but this is exactly what I'm looking for - except that it, like every other example I've tried over the last 24 hours, causes this error:

"attempted to call a forbidden function (JoinBattlefield()) from a tainted execution path"

I've been banging my head against this issue since yesterday, even with the simplest stripped down versions of an auto-queue addon - is it even possible to join the queue automatically any more?
04/24/2011 05:34 AMPosted by Kilois
I'm using this for the moment,
/click MiniMapBattlefieldFrame
/click DropDownList1Button2
/click PVPMicroButton
/click PVPHonorFrameBgButton3
/click PVPFrameLeftButton

it works, if the last things I opened were my honor frame and right clicked on the minimap

I just copy and pasted this one and now all my colors are all weird and inverted how do I fix this!

Join the Conversation

Return to Forum