UI (functions)/Custom Menus: Difference between revisions

From PMDOWiki
Imbion (talk | contribs)
Created page with "== UI:SetCustomMenu(RogueEssence.Menu.InteractableMenu) == Displays a custom menu of the caller's choice. UI:WaitForChoice() must be called afterwards for the menu to be actually displayed, and for execution to suspend until the menu is exited. == UI:BeginChoiceMenu(System.String,NLua.LuaTable,System.Object,System.Object,NLua.LuaTable) == Marks the start of a multi-choice menu. UI:WaitForChoice() must be called afterwards for the menu to be actually displayed, and..."
 
Imbion (talk | contribs)
No edit summary
 
Line 1: Line 1:
== UI:SetCustomMenu(RogueEssence.Menu.InteractableMenu) ==
== SetCustomMenu ==
 


Displays a custom menu of the caller's choice.
Displays a custom menu of the caller's choice.
Line 7: Line 6:
and for execution to suspend until the menu is exited.
and for execution to suspend until the menu is exited.


== UI:BeginChoiceMenu(System.String,NLua.LuaTable,System.Object,System.Object,NLua.LuaTable) ==
== BeginMultiPageMenu ==


Marks the start of a multi-paged choice menu.


Marks the start of a multi-choice menu.
UI:WaitForChoice() must be called afterwards for the menu to be actually displayed,
UI:WaitForChoice() must be called afterwards for the menu to be actually displayed,
and for execution to suspend until the choice is returned.
and for execution to suspend until the choice is returned.
Then to recover the integer value indicating the result of the menu, UI:ChoiceResult() must be called.
=== Arguments ===


* <code>message</code>: The question to ask the user.
* <code>choicesPairs</code>: A table of choices.  Each choice can be either a string, or { string, bool } representing the text and enabled status.
* <code>defaultChoice</code>: The cursor starts on this choice.
* <code>cancelChoice</code>: This choice is chosen if the player presses the cancel button.
* <code>callbacks</code>: The Lua table of callbacks for the textbox to call.
== UI:BeginMultiPageMenu(System.Int32,System.Int32,System.Int32,System.String,NLua.LuaTable,System.Int32,System.Object,System.Object) ==
Marks the start of a multi-paged choice menu.
UI:WaitForChoice() must be called afterwards for the menu to be actually displayed,
and for execution to suspend until the choice is returned.
Then to recover the integer value indicating the result of the menu, UI:ChoiceResult() must be called.
Then to recover the integer value indicating the result of the menu, UI:ChoiceResult() must be called.


=== Arguments ===
=== Arguments ===


* <code>x</code>: X position of the menu
{|class="wikitable"
* <code>y</code>: Y position of the menu
{{ArgHeader}}
* <code>width</code>: Width of the menu
{{ArgRow
* <code>title</code>: Height of the menu
|name=x
* <code>choicesPairs</code>: A table of choices.  Each choice can be either a string, or { string, bool } representing the text and enabled status.
|type=Integer
* <code>linesPerPage</code>: Number of choices per page
|techt=System.Int32
* <code>defaultChoice</code>: The cursor starts on this choice.
|purp=X position of the menu
* <code>cancelChoice</code>: This choice is chosen if the player presses the cancel button.
}}
 
{{ArgRow
== UI:ChoiceResult ==
|name=y
 
|type=Integer
 
|techt=System.Int32
Get the result of the last choice menu
|purp=Y position of the menu
 
}}
 
{{ArgRow
=== Returns ===
|name=width
 
|type=Integer
The result of the choice
|techt=System.Int32
 
|purp=Width of the menu
== UI:GetChoiceAction(System.Object) ==
}}
 
{{ArgRow
 
|name=title
It's complicated.
|type=String
 
|techt=System.String
 
|purp=The title of the page
=== Arguments ===
}}
 
{{ArgRow
* <code>obj</code>: None
|name=choices
 
|type=Table
== UI:WaitForChoice ==
|techt=NLua.LuaTable
 
|purp=A table of choices.  Each choice can be either a string, or { string, bool } representing the text and enabled status.
 
}}
Displays the currently set choice menu and waits for the player's selection to complete.
{{ArgRow
 
|name=linesPerPage
 
|type=Integer
=== Example ===
|techt=System.Int32
 
|purp=Number of choices per page
<pre>
}}
 
{{ArgRow
UI:WaitForChoice()
|name=defaultChoice
 
|type=Object
</pre>
|techt=System.Object
 
|purp=The cursor starts on this choice.
== UI:__WaitForChoice ==
}}
 
{{ArgRow
 
|name=cancelChoice
Wait for choice and then CLEAN UP m_curchoice
|type=Object
|techt=System.Object
|purp=This choice is chosen if the player presses the cancel button.
}}
|}

Latest revision as of 17:33, 18 January 2026

SetCustomMenu

Displays a custom menu of the caller's choice.

UI:WaitForChoice() must be called afterwards for the menu to be actually displayed, and for execution to suspend until the menu is exited.

BeginMultiPageMenu

Marks the start of a multi-paged choice menu.

UI:WaitForChoice() must be called afterwards for the menu to be actually displayed, and for execution to suspend until the choice is returned.

Then to recover the integer value indicating the result of the menu, UI:ChoiceResult() must be called.

Arguments

Name Type Technical Type Purpose
x Integer System.Int32 X position of the menu
y Integer System.Int32 Y position of the menu
width Integer System.Int32 Width of the menu
title String System.String The title of the page
choices Table NLua.LuaTable A table of choices. Each choice can be either a string, or { string, bool } representing the text and enabled status.
linesPerPage Integer System.Int32 Number of choices per page
defaultChoice Object System.Object The cursor starts on this choice.
cancelChoice Object System.Object This choice is chosen if the player presses the cancel button.