Random BG (queue) Macro

UI and Macro
Is there a way to macro BG random queue?

With the Random queue being "broken" I've found that I have to queue requeue every 5 minutes in order to get my BGs to pop. It is getting tiresome Leaving Queue (on the map button) and then rejoining ("H" key).

Any ideas or is this even possible?
Leave queue:/click MiniMapBattlefieldFrame
/click DropDownList1Button2

Join random queue:/run for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end end

Two in one:/click MiniMapBattlefieldFrame
/click DropDownList1Button2
/run for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end end
Leaves any current queue then joins the random queue.

Edit: Added the missing ends. Thanks Grodak.
How about join for specific ones like AB and WSG?
03/04/2011 9:16 AMPosted by Eatmoarchikn
How about join for specific ones like AB and WSG?
To leave the queue, use the same macro as above. If the "Leave Queue" button is in a different position in the MiniMap PvP dropdown menu for specific BGs, change the number on the end of DropDownList1Button2. The top is 1, the position below it is 2, etc.

To join one specific BG:
/run for i=1,GetNumBattlegroundTypes()do local name,_,_,_,_=GetBattlegroundInfo(i)if name=="Name of BG"then JoinBattlefield(i)end endReplace "Name of BG" with the full name of the BG you want to join enclosed in quotation marks. e.g. "Warsong Gulch" or "Arathi Basin".

To join multiple specific BGs:
/run for i=1,GetNumBattlegroundTypes()do local _,_,_,_,BGID=GetBattlegroundInfo(i)function JB(I)JoinBattlefield(BGID==I and i)end JB(ID#1)JB(ID#2)JB(ID#3)endReplace ID#X with the Battleground ID of the BG you want to join.
  • 1 = Alterac Valley
  • 2 = Warsong Gulch
  • 3 = Arathi Basin
  • 7 = Eye of the Storm
  • 9 = Strand of the Ancients
  • 30 = Isle of Conquest
  • 32 = Random


  • You can join as many BGs as the PvP system will let you by adding JB(ID) for each new one between the last JB() tag and end.

    Examples:
    Join 1 BG:/run for i=1,GetNumBattlegroundTypes()do local _,_,_,_,BGID=GetBattlegroundInfo(i)function JB(I)JoinBattlefield(BGID==I and i)end JB(ID#1)endJoin 2 BGs:
    /run for i=1,GetNumBattlegroundTypes()do local _,_,_,_,BGID=GetBattlegroundInfo(i)function JB(I)JoinBattlefield(BGID==I and i)end JB(ID#1)JB(ID#2)endJoin 3 BGs:
    /run for i=1,GetNumBattlegroundTypes()do local _,_,_,_,BGID=GetBattlegroundInfo(i)function JB(I)JoinBattlefield(BGID==I and i)end JB(ID#1)JB(ID#2)JB(ID#3)end
    Join 4 BGs:
    /run for i=1,GetNumBattlegroundTypes()do local _,_,_,_,BGID=GetBattlegroundInfo(i)function JB(I)JoinBattlefield(BGID==I and i)end JB(ID#1)JB(ID#2)JB(ID#3)JB(ID#4)end
    Thank you so much
    Bumping an old post to ask if anyone can help me figure out why I can't use this macro
    04/24/2011 05:19 AMPosted by Kilois
    Bumping an old post to ask if anyone can help me figure out why I can't use this macro
    Could you post the copy of the macro you're using?
    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'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
    Have you tried using the macro I posted in post#2?

    http://us.battle.net/wow/en/forum/topic/2135903708#2
    I said in my first post, I needed help getting that one to work :), it was leaving the queue properly but would not queue me up, also wow fast response
    I also tried running them seperately to see if that would help
    For what it's worth I just tried to use this one:
    /run for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end
    and got this error:
    Date: 2011-04-24 09:02:48
    ID: 5
    Error occured in: Global
    Count: 1
    Message: [string "for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattleg..."] line 1:
    'end' expected near '<eof>'
    Debug:
    [C]: ?
    [C]: RunScript()
    ..\FrameXML\ChatFrame.lua:2043: value()
    ..\FrameXML\ChatFrame.lua:4235:
    ..\FrameXML\ChatFrame.lua:4162
    [C]: ?
    [C]: ChatEdit_ParseText()
    ..\FrameXML\ChatFrame.lua:3825: ChatEdit_SendText()
    ..\FrameXML\ChatFrame.lua:3863: ChatEdit_OnEnterPressed()
    [string "*:OnEnterPressed"]:1:
    [string "*:OnEnterPressed"]:1
    AddOns:
    Swatter, v3.2.3 (<%codename%>)
    NPCScan, v4.0.3.6
    NPCScanOverlay, v4.0.3.2
    Ace3, v
    ACP, v3.3.13
    AdvancedTradeSkillWindow, v
    Afterlife, v40000-R2
    Align, v
    AllPlayed, v40000-1 $Revision: 230 $
    Altoholic, v4.0.006b
    ArkInventory, v3.02
    ArkInventoryRules, v
    Atlas, v1.18.3
    AtlasBattlegrounds, v1.18.3
    AtlasDungeonLocs, v1.18.3
    AtlasOutdoorRaids, v1.18.3
    AtlasTransportation, v1.18.3
    AtlasLoot, vv6.02.00
    AtlasLootBurningCrusade, vv6.02.00
    AtlasLootCataclysm, vv6.02.00
    AtlasLootClassicWoW, vv6.02.00
    AtlasLootCrafting, vv6.02.00
    AtlasLootWorldEvents, vv6.02.00
    AtlasLootWrathoftheLichKing, vv6.02.00
    AtlasLootReverse, v1.10
    AucAdvanced, v5.9.4960 (WhackyWallaby)
    AucFilterBasic, v5.9.4960 (WhackyWallaby)
    AucFilterOutlier, v5.9.4960.2531
    AucMatchUndercut, v5.9.4960.2531
    AucScanData, v5.9.4960 (WhackyWallaby)
    AucStatHistogram, v5.9.4960 (WhackyWallaby)
    AucStatiLevel, v5.9.4960 (WhackyWallaby)
    AucStatPurchased, v5.9.4960 (WhackyWallaby)
    AucStatSales, v5.9.4960.2842
    AucStatSimple, v5.9.4960 (WhackyWallaby)
    AucStatStdDev, v5.9.4960 (WhackyWallaby)
    AucStatWOWEcon, v5.9.4960.2530
    AucUtilAHWindowControl, v5.9.4960.3311
    AucUtilAppraiser, v5.9.4960.2530
    AucUtilAskPrice, v5.9.4960.3175
    AucUtilAutoMagic, v5.9.4960.3142
    AucUtilCompactUI, v5.9.4960.2530
    AucUtilEasyBuyout, v5.9.4960.3583
    AucUtilFixAH, v5.9.4960 (WhackyWallaby)
    AucUtilGlypher, v5.9.4960.2545
    AucUtilItemSuggest, v5.9.4960.3108
    AucUtilPriceLevel, v5.9.4960.2545
    AucUtilScanButton, v5.9.4960.2530
    AucUtilScanFinish, v5.9.4960.2530
    AucUtilScanProgress, v5.9.4960.2530
    AucUtilScanStart, v5.9.4960.4819
    AucUtilSearchUI, v5.9.4960.3655
    AucUtilSimpleAuction, v5.9.4960.4546
    AucUtilVendMarkup, v5.9.4960.2530
    AuctionLite, v1.8.1
    AuctionValue, v1.1
    Auditor2, v4.4.2
    Babylonian, v5.1.DEV.130
    Bazooka, vv2.1.0
    BazookaOptions, vv2.1.0
    BeanCounter, v5.9.4960 (WhackyWallaby)
    Bejeweled, v1.1b
    BonusScanner, v5.3
    BrokerAuditor, v4.4.2
    BrokerLonnyMicroMenu, v$Revision: 120 $
    BuffEnough, v1.2.123
    ButtonFacade, v4.0.340
    ButtonFacadeCaith, v4.0.62
    ButtonfacadeNefs, v1.0
    caelNamePlates, v
    cBrokerRecount, v1.01
    Chinchilla, vv2.3.1
    Configator, v5.1.DEV.282
    DataStore, v4.0.001
    DataStoreAchievements, v4.0.001
    DataStoreAuctions, v4.0.001
    DataStoreCharacters, v4.0.006
    DataStoreContainers, v4.0.001
    DataStoreCrafts, v4.0.001
    DataStoreCurrencies, v4.0.001
    DataStoreInventory, v4.0.005b
    DataStoreMails, v4.0.001
    DataStorePets, v4.0.001
    DataStoreReputations, v4.0.001
    DataStoreSpells, v4.0.001
    DataStoreStats, v4.0.001
    DataStoreTalents, v4.0.001
    DBMCore, v
    DBMVictorySound, v1.8.1
    DebugLib, v5.1.DEV.275
    DualSpeccer, v
    EquippedItemLevelTooltip, v1.1.3
    EveryQuest, v2.4.r217-release
    EveryQuestKalimdor, vr217-release
    Examiner, v11.01.28
    FluidFrames, v2.3
    fontain, v
    FriendsWithBenefits, v3.2.0.4
    Gatherer, v3.2.3
    HideBossFrames, v1.0
    InFlightLoad, v4.0.004
    Informant, v5.9.4960 (WhackyWallaby)
    ItemDataCache, v1.303
    kRestack, v40000.1
    LibRock10, v
    LinkWrangler, v1.83
    LootLink, v
    Macaroon, v40000.2
    Mapster, v1.4.0
    MikScrollingBattleText, v5.5.91
    MobInfo2, vr29
    PitBull4, vv4.0.0-beta25
    PitBull4Aggro, vv4.0.0-beta25
    PitBull4AltPowerBar, vv4.0.0-beta25
    PitBull4Aura, vv4.0.0-beta25
    PitBull4Background, vv4.0.0-beta25
    PitBull4BlankSpace, vv4.0.0-beta25
    PitBull4Border, vv4.0.0-beta25
    PitBull4CastBar, vv4.0.0-beta25
    PitBull4CastBarLatency, vv4.0.0-beta25
    PitBull4CombatFader, vv4.0.0-beta25
    PitBull4CombatIcon, vv4.0.0-beta25
    PitBull4CombatText, vv4.0.0-beta25
    PitBull4ComboPoints, vv4.0.0-beta25
    PitBull4ExperienceBar, vv4.0.0-beta25
    PitBull4HealthBar, vv4.0.0-beta25
    PitBull4HideBlizzard, vv4.0.0-beta25
    PitBull4Highlight, vv4.0.0-beta25
    PitBull4HostilityFader, vv4.0.0-beta25
    PitBull4LeaderIcon, vv4.0.0-beta25
    PitBull4LuaTexts, vv4.0.0-beta25
    PitBull4MasterLooterIcon, vv4.0.0-beta25
    PitBull4PhaseIcon, vv4.0.0-beta25
    PitBull4Portrait, vv4.0.0-beta25
    PitBull4PowerBar, vv4.0.0-beta25
    PitBull4PvPIcon, vv4.0.0-beta25
    PitBull4QuestIcon, vv4.0.0-beta25
    PitBull4RaidTargetIcon, vv4.0.0-beta25
    PitBull4RangeFader, vv4.0.0-beta25
    PitBull4ReadyCheckIcon, vv4.0.0-beta25
    PitBull4ReputationBar, vv4.0.0-beta25
    PitBull4RestIcon, vv4.0.0-beta25
    PitBull4RoleIcon, vv4.0.0-beta25
    PitBull4Sounds, vv4.0.0-beta25
    PitBull4ThreatBar, vv4.0.0-beta25
    PitBull4VisualHeal5, vv4.0.0-beta25
    PitBull4VoiceIcon, vv4.0.0-beta25
    Portfolio, v1.21
    Postal, v3.4.4
    Prat30, v3.4.15
    Prat30HighCPUUsageModules, v
    Prat30Libraries, v
    Quartz, v3.0.5
    QuestProgressSound, v1.12
    RatingBuster, v
    Raven, v
    Recount, v
    RollWatcher, v1.0.4
    SellOMatic2, va039
    SharedMedia, v3.0.4-179
    SharedMediaAdditionalFonts, v1.0
    SkillUp, v3.1
    SkillUpDing, v1.0c
    SkillUpMaxLineColor, v1.1b
    SkillUpUCase, v1.0c
    SlashIn, v
    SLDT, v3.1.1
    Stubby, v5.9.4960 (WhackyWallaby)
    teksLoot, v3.3.0.9
    TipTac, v10.12.05
    TipTacItemRef, v10.12.06
    TipTacTalents, v10.11.23
    TolBaradMaster, v0.9
    TravelAgent, v4.0.3-1.0.11
    VanasKoS, v4.28-$Rev: 488 $
    WhoInterrupted, v0.1
    XPBarNone, vv1.5.4
    YurysRuneDisplay, vv3.0.1 (74)
    BlizRuntimeLib_enUS v4.0.6.40000 <us>
    (ck=14a3)
    For what it's worth I just tried to use this one:
    /run for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end
    and got this error:
    Date: 2011-04-24 09:02:48
    ID: 5
    Error occured in: Global
    Count: 1
    Message: [string "for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattleg..."] line 1:
    'end' expected near '<eof>'
    Ah, looks like I forgot an end.

    Use this macro instead:
    /run for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end end
    Ah, looks like I forgot an end.

    Use this macro instead:
    /run for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end end
    Yup, works now. :) I also had to add the extra end on this one for it to work:
    /click MiniMapBattlefieldFrame
    /click DropDownList1Button2
    /run for i=1,GetNumBattlegroundTypes()do local _,_,_,iR,_=GetBattlegroundInfo(i)if iR then JoinBattlefield(i)end end
    Once you have a bg already pre-selected, /script JoinBattlefield(1) will let you re-queue (ie for a random). It's a simple alternative but doesn't have much flexibility.
    I am trying to get a macro that will put my 29 hunter into the queue for Warsong Gulch and Arathi Basin, and I've tried the macro above to join 2 BG's at once but when I click the macro nothing happens. This is what it looks like: /run for i=1,GetNumBattlegroundTypes()do local _,_,_,_,BGID=GetBattlegroundInfo(i)function JB(I)JoinBattlefield(BGID==I and i)end JB(2)JB(3)end
    07/02/2011 04:13 PMPosted by Sathatis
    I am trying to get a macro that will put my 29 hunter into the queue for Warsong Gulch and Arathi Basin, and I've tried the macro above to join 2 BG's at once but when I click the macro nothing happens. This is what it looks like: /run for i=1,GetNumBattlegroundTypes()do local _,_,_,_,BGID=GetBattlegroundInfo(i)function JB(I)JoinBattlefield(BGID==I and i)end JB(2)JB(3)end
    Try run this macro to find out the BGIDs:/run for i=1,GetNumBattlegroundTypes()do local name,_,_,_,BGID=GetBattlegroundInfo(i)print("Name:",name,"BGID:",BGID)end
    Hi guys, is there a way to make this work with a group? for random Bgs, thanks guys.
    08/14/2011 04:03 AMPosted by Lineyz
    Hi guys, is there a way to make this work with a group? for random Bgs, thanks guys.
    Change this:JoinBattlefield(i)To this:JoinBattlefield(i,1)

    Edit: The F in battlefield should be lower-case.
    Thanks :)

    Join the Conversation

    Return to Forum