Originally Posted by lqt8
I believe because it's an hardware function and may require click/button so it may be protected.
That's correct. You can't call AcceptBattlefieldPort outside of HE (hardware events) as it is protected and will only cause taint.
Only HE (user input) will be able to do so.
What you _could_ do though is creating a popup to inform you when you reach the MMR extention and assign AcceptBattlefieldPort to its OnClick function.
OnClick events are HE and therefore will be allowed to call AcceptBattlefieldPort.
quickly put together:
Code:
local mmrExtention = 3 -- change this to match your preferred extention level
StaticPopupDialogs['MMR_EXTENTION'] = {
text = mmrExtention..'/10 MMR extention reached.\n Accepting will leave the queue!',
button1 = 'Leave Queue',
OnAccept = function()
AcceptBattlefieldPort(1, 0)
RaidNotice_AddMessage(RaidWarningFrame,
'Queue left, please queue again!',
ChatTypeInfo['RAID_WARNING']
)
PlaySound('RaidWarning')
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1,
preferredIndex = 3,
}
local frame = CreateFrame('FRAME', nil, UIParent)
frame:RegisterEvent('CHAT_MSG_SYSTEM')
frame:SetScript('OnEvent',function(self, event, message)
if message:match(mmrExtention..'/10 times') then
StaticPopup_Show('MMR_EXTENTION')
end
end)
Can't really say it's much quicker this way, though you get notified (hence the RaidWarning) if your extention reaches your preferred level.