API:PregameSetPreSelectedServerRealm
From RoR Wiki
UI Lua API · Pregame functions
Version: WAR 1.4.8
Stores which realm the character select screen should offer after a server was picked.
PregameSetPreSelectedServerRealm(realm)
Arguments
- realm
number– The realm choice. The stock UI uses1(both realms),2(Order only) and3(Destruction only), defined ininterfacecore/source/serverselectwindow.luaasServerSelectWindow.BOTH_REALM_OPTIONS,ORDER_ONLYandDESTRUCTION_ONLY.
Returns
Nothing.
Details
- The value is converted to an integer and stored as a 16-bit value. The client does not check it.
- The call only has an effect in the pregame state while the character select data is set up. Otherwise it does nothing.
- Read the value back with PregameGetPreSelectedServerRealm. The stock character select window uses it to hide the info box of the realm that was not chosen.
Errors
None besides the generic Invalid Parameters message when the argument is not a number.
Example
From interfacecore/source/serverselectwindow.lua, which picks the realm from the server's population bonuses:
if ( ( server.destructionBonus ~= 0 ) and ( server.orderBonus == 0 ) )
then
PregameSetPreSelectedServerRealm( ServerSelectWindow.DESTRUCTION_ONLY )
elseif ( ( server.orderBonus ~= 0 ) and ( server.destructionBonus == 0 ) )
then
PregameSetPreSelectedServerRealm( ServerSelectWindow.ORDER_ONLY )
else
PregameSetPreSelectedServerRealm( ServerSelectWindow.BOTH_REALM_OPTIONS )
end
