<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3APregameSetCharacterSelectPage</id>
	<title>API:PregameSetCharacterSelectPage - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3APregameSetCharacterSelectPage"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:PregameSetCharacterSelectPage&amp;action=history"/>
	<updated>2026-10-17T06:30:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:PregameSetCharacterSelectPage&amp;diff=30647&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:PregameSetCharacterSelectPage&amp;diff=30647&amp;oldid=prev"/>
		<updated>2026-10-16T19:47:52Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Pregame}}&lt;br /&gt;
Switches the character select screen to another page of character slots.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PregameSetCharacterSelectPage(realm, page)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;realm : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – The realm whose page to show, 1 or 2. The stock UI passes &amp;lt;code&amp;gt;GameData.Realm.ORDER&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GameData.Realm.DESTRUCTION&amp;lt;/code&amp;gt;.&lt;br /&gt;
;page : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – The page within that realm, 1 or 2.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The call only works in the pregame state. At any other time it does nothing.&lt;br /&gt;
* A realm or page outside 1–2 gives one of the errors below, and nothing changes.&lt;br /&gt;
* Nothing happens if mouse handling is blocked with [[API:PregameBlockMouseOver|PregameBlockMouseOver]], if the requested page is already shown, or if the requested page has no character slots.&lt;br /&gt;
* 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.&lt;br /&gt;
* After a switch the client fires &amp;lt;code&amp;gt;SystemData.Events.CHARACTER_SELECT_CURRENT_PAGE_UPDATED&amp;lt;/code&amp;gt;. The stock handler &amp;lt;code&amp;gt;CharacterSelectWindow.UpdateCurrentPage(currentRealm, currentPage)&amp;lt;/code&amp;gt; receives the new realm and page.&lt;br /&gt;
* The function needs at least two arguments and only reads the last two.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;PregameSetCharacterSelectPage&amp;#039;: %d is not a valid realm.&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;PregameSetCharacterSelectPage&amp;#039;: %d is not a valid character page.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;interfacecore/source/characterselectwindow.lua&amp;lt;/code&amp;gt;, where a local helper turns a running page number into a realm and page:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local function GetRealmCharacterPageIndexFromRawIndex( rawIndex )&lt;br /&gt;
    if ( rawIndex &amp;gt; CharacterSelectWindow.iNumOrderPages )&lt;br /&gt;
    then&lt;br /&gt;
        return GameData.Realm.DESTRUCTION, rawIndex - CharacterSelectWindow.iNumOrderPages&lt;br /&gt;
    else&lt;br /&gt;
        return GameData.Realm.ORDER, rawIndex&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function CharacterSelectWindow.OnSelectCharacterPage( selectedIndex )&lt;br /&gt;
    if ( selectedIndex &amp;gt; 0 )    -- When the combo box is cleared, this gets called with a selectedIndex of 0, which is invalid&lt;br /&gt;
    then&lt;br /&gt;
        PregameSetCharacterSelectPage( GetRealmCharacterPageIndexFromRawIndex( selectedIndex ) )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:PregameGetCharacterSelectPage|PregameGetCharacterSelectPage]]&lt;br /&gt;
* [[API:PregameGetCharacterSelectNumPages|PregameGetCharacterSelectNumPages]]&lt;br /&gt;
* [[API:PregameBlockMouseOver|PregameBlockMouseOver]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>