How do you get the name of a battleground when a player enters? Right now I am using the PLAYER_ENTERING_BATTLEGROUND event and GetRealZoneText like:
But this prints out the zone I was in before entering the bg. For example, I was in Undercity, queued for Arathi Basin, accepted queue. When the loading finished, my chat log had a message "Entering Undercity". Using /reload, the screen loaded and I had the message "Entering Arathi Basin"Code:if event == "PLAYER_ENTERING_BATTLEGROUND" then local bgName = GetRealZoneText() print("Entering "..bgName) end
Is there a way to get the name of the new zone, instead of the one you came from?
Slightly related, I found the PLAYER_ENTERING_BATTLEGROUND event, but is there a way to detect when the player leaves the battleground? I know PLAYER_ENTERING_WORLD is fired when leaving a battleground, but that gets fired loads of times, I only care about it when it is fired from leaving a battleground, not /reload, first log in, entering a raid or dungeon, etc.