1. Hey guys I'm new here, and I'm rather new to the WoW API.

    I am trying to find a way to obtain the battleground instance ID, and it seems like GetBattlefieldStatus() is the best function for that, however it doesn't seem to work. It is returning 0, even with the battleground status is active.

    Any solutions or work arounds?

    Here is a code snippet

     if event == "UPDATE_BATTLEFIELD_SCORE" then
            local status, mapName, instanceID, minlevel, maxlevel, registeredMatch
            for i = 1, MAX_BATTLEFIELD_QUEUES do
                status, mapName, instanceID, minlevel, maxlevel, teamSize = GetBattlefieldStatus(i)
                if status == "active" then
                    DEFAULT_CHAT_FRAME:AddMessage("Status: " .. status)
                    DEFAULT_CHAT_FRAME:AddMessage("Map Name: " .. mapName)
                    DEFAULT_CHAT_FRAME:AddMessage("Instance ID: " .. instanceID)
                    DEFAULT_CHAT_FRAME:AddMessage("Max Level: " .. maxlevel)
                end
    
            end
        end
    

    PS. For some reason the code block isn't taking the first line :\ but it should be read as: if event == "UPDATE_BATTLEFIELD_SCORE" then

    So you're in a battleground (which one) and its returning 0?

    Also, the reason the code block didn't work is because you likely highlighted the wrong thing. It's meant to be done after the code has been written, highlight and click and it works. I still need to find a better markup language, but my time is very limited.

    I didn't try each battleground but it returns 0 for Alterac Valley and Warsong Gulch