UI (functions)/Choice Menu: Difference between revisions

From PMDOWiki
Imbion (talk | contribs)
Imbion (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 43: Line 43:
}}
}}
|}
|}
== BeginChoiceMenu ==
Marks the start of a multi-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. {{FuncUsage|nmspace=UI|nm=BeginChoiceMenu|args=}}
=== Arguments ===
{|class="wikitable"
{{ArgHeader}}
{{ArgRow
|name=msg
|type=String
|techt=System.String
|purp=The question to ask the user.
}}
{{ArgRow
|name=choices
|type=LuaTable
|techt=NLua.LuaTable
|purp=A table of choices.  Each choice can be either a string, or { string, bool } representing the text and enabled status.
}}
{{ArgRow
|name=defaultChoice
|type=Object
|techt=System.Object
|purp=The cursor starts on this choice
}}
{{ArgRow
|name=cancelChoice
|type=Object
|techt=System.Object
|purp=This choice is chosen if the player presses the cancel button.
}}
{{ArgRow
|name=callbacks
|type=LuaTable
|techt=NLua.LuaTable
|purp=The Lua table of callbacks for the textbox to call.
}}
|}
== 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. {{FuncUsage|nmspace=UI|nm=|args=}}
=== Arguments ===
{|class="wikitable"
{{ArgHeader}}
{{ArgRow
|name=x
|type=Integer
|techt=System.Int32
|purp=X position of the menu
}}
{{ArgRow
|name=y
|type=Integer
|techt=System.Int32
|purp=Y position of the menu
}}
{{ArgRow
|name=width
|type=Integer
|techt=System.Int32
|purp=Width of the menu
}}
{{ArgRow
|name=title
|type=String
|techt=System.String
|purp=Height of the menu
}}
{{ArgRow
|name=choices
|type=LuaTable
|techt=NLua.LuaTable
|purp=A table of choices.  Each choice can be either a string, or { string, bool } representing the text and enabled status.
}}
{{ArgRow
|name=linesPerPage
|type=Integer
|techt=System.Int32
|purp=Number of choices per page
}}
{{ArgRow
|name=defaultChoice
|type=Object
|techt=System.Object
|purp=The cursor starts on this choice.
}}
{{ArgRow
|name=cancelChoice
|type=Object
|techt=System.Object
|purp=This choice is chosen if the player presses the cancel
}}
|}
== ChoiceResult ==
Get the result of the last choice menu
=== Returns ===
The result of the choice
== GetChoiceAction ==
undocumented
== WaitForChoice ==
Displays the currently set choice menu and waits for the player's selection to complete.
=== Example ===
<pre>
WaitForChoice()
</pre>
== __WaitForChoice ==
Wait for choice and then CLEAN UP m_curchoice

Latest revision as of 17:21, 18 January 2026

SetChoiceLoc

Sets the position of the choices for a question dialog.

Arguments

ResetChoiceLoc

Sets the position of the choices for a question dialog back to default.

ChoiceMenuYesNo

Ask a question answered by yes or no via character dialogue to the player. 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.

The Yes/No menu returns 1 for yes, and 0 for no.

Argument order is UI:ChoiceMenuYesNo(message, defaultWhenNo, callbacks).

Arguments

Name Type Technical Type Purpose
message String System.String Question to be asked to the user.
defaultWhenNo Boolean System.Boolean Whether the cursor starts on no by default
callbacks Lua Table NLua.LuaTable The Lua table of callbacks for the textbox to call.

BeginChoiceMenu

Marks the start of a multi-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. Argument order is UI:BeginChoiceMenu().

Arguments

Name Type Technical Type Purpose
msg String System.String The question to ask the user.
choices LuaTable NLua.LuaTable A table of choices. Each choice can be either a string, or { string, bool } representing the text and enabled status.
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.
callbacks LuaTable NLua.LuaTable The Lua table of callbacks for the textbox to call.

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. Argument order is UI:().

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 Height of the menu
choices LuaTable 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

ChoiceResult

Get the result of the last choice menu

Returns

The result of the choice

GetChoiceAction

undocumented

WaitForChoice

Displays the currently set choice menu and waits for the player's selection to complete.

Example


WaitForChoice()

__WaitForChoice

Wait for choice and then CLEAN UP m_curchoice