API:PregameSetCharacterSelectPage
From RoR Wiki
UI Lua API · Pregame functions
Version: WAR 1.4.8
Switches the character select screen to another page of character slots.
PregameSetCharacterSelectPage(realm, page)
Arguments
- realm
number– The realm whose page to show, 1 or 2. The stock UI passesGameData.Realm.ORDERorGameData.Realm.DESTRUCTION.- page
number– The page within that realm, 1 or 2.
Returns
Nothing.
Details
- The call only works in the pregame state. At any other time it does nothing.
- A realm or page outside 1–2 gives one of the errors below, and nothing changes.
- Nothing happens if mouse handling is blocked with PregameBlockMouseOver, if the requested page is already shown, or if the requested page has no character slots.
- Otherwise the page is switched and the slot models are refreshed. If the selected character is not on the new page, the first slot of the new page becomes selected.
- After a switch the client fires
SystemData.Events.CHARACTER_SELECT_CURRENT_PAGE_UPDATED. The stock handlerCharacterSelectWindow.UpdateCurrentPage(currentRealm, currentPage)receives the new realm and page. - The function needs at least two arguments and only reads the last two.
Errors
Error in function call 'PregameSetCharacterSelectPage': %d is not a valid realm.Error in function call 'PregameSetCharacterSelectPage': %d is not a valid character page.
Example
From interfacecore/source/characterselectwindow.lua, where a local helper turns a running page number into a realm and page:
local function GetRealmCharacterPageIndexFromRawIndex( rawIndex )
if ( rawIndex > CharacterSelectWindow.iNumOrderPages )
then
return GameData.Realm.DESTRUCTION, rawIndex - CharacterSelectWindow.iNumOrderPages
else
return GameData.Realm.ORDER, rawIndex
end
end
function CharacterSelectWindow.OnSelectCharacterPage( selectedIndex )
if ( selectedIndex > 0 ) -- When the combo box is cleared, this gets called with a selectedIndex of 0, which is invalid
then
PregameSetCharacterSelectPage( GetRealmCharacterPageIndexFromRawIndex( selectedIndex ) )
end
end
