I just use PLAYER_ENTERING_WORLD. always fires, there's no event specific for loading into an instance, so if you only want something while in an instance, you have to do IsInInstance()
edit: here's some relevant code I use for a minimap addon that shows various texts based on instance difficulty:
Lua Code:
--This block of code controls the text in the bottom right of the minimap that confers to the difficulty you're currently on
local tMinimapDifficultyTextFrame = CreateFrame('frame', nil, Minimap)
tMinimapDifficultyTextFrame:SetSize(24, 12)
tMinimapDifficultyTextFrame:SetPoint('BOTTOMRIGHT', Minimap, 'BOTTOMRIGHT', -1, 1)
tMinimapDifficultyTextFrame:RegisterEvent('PLAYER_ENTERING_WORLD')
tMinimapDifficultyTextFrame:RegisterEvent('CHALLENGE_MODE_START')
tMinimapDifficultyTextFrame:RegisterEvent('CHALLENGE_MODE_COMPLETED')
tMinimapDifficultyTextFrame:RegisterEvent('CHALLENGE_MODE_RESET')
tMinimapDifficultyTextFrame:RegisterEvent('PLAYER_DIFFICULTY_CHANGED')
tMinimapDifficultyTextFrame:RegisterEvent('GUILD_PARTY_STATE_UPDATED')
local instanceDifficultyTable = {
[1] = '5N',
[2] = '5H',
[3] = '10',
[4] = '25',
[5] = '10H',
[6] = '25H',
[7] = 'LFR',
[8] = 'M+',
[9] = '40',
[11] = 'HS',
[12] = 'NS',
[14] = 'N',
[15] = 'H',
[16] = 'M',
[17] = 'LFR',
[23] = '5M',
[24] = 'TW',
[33] = 'TW',
[38] = 'N',
[39] = 'H',
[40] = 'M',
[147] = 'WF'
}
tMinimapDifficultyTextFrame.text = tMinimapDifficultyTextFrame:CreateFontString(nil, 'OVERLAY')
tMinimapDifficultyTextFrame.text:SetPoint('BOTTOMRIGHT', tMinimapDifficultyTextFrame, 'BOTTOMRIGHT')
tMinimapDifficultyTextFrame.text:SetFont('Interface\\AddOns\\tMinimap\\Font.ttf', 12, 'THINOUTLINE')
tMinimapDifficultyTextFrame.text:SetJustifyH('RIGHT')
tMinimapDifficultyTextFrame.text:SetTextColor(1, 1, 1, 1)
tMinimapDifficultyTextFrame:SetScript('OnEvent', function(self, event, isGuildGroup)
local _, _, instanceDifficulty, _, _, _, _, _, numPlayers = GetInstanceInfo()
local mythicPlusDifficulty = C_ChallengeMode.GetActiveKeystoneInfo() or ''
local text = instanceDifficultyTable[instanceDifficulty] or ''
if (isGuildGroup and type(isGuildGroup) == boolean) then --this argument can be a number when you start mythic plus for some reason
text = 'G'..text
end
if numPlayers < 6 then
numPlayers = ''
end
if mythicPlusDifficulty < 1 then
mythicPlusDifficulty = ''
end
if IsInInstance() then --hack to fix a weird bug where if you get to your WoD garrison, it says you're in in a 5N zone, but also says that all of shadowmoon/frostfire ridge is also a 5N zone until you leave that zone; this is probably related to garrison invasions
tMinimapDifficultyTextFrame.text:SetText(text..numPlayers..mythicPlusDifficulty)
tMinimapDifficultyTextFrame.text:Show()
else
tMinimapDifficultyTextFrame.text:Hide()
end
end)