UI (functions)/Choice Menu: Difference between revisions

From PMDOWiki
Imbion (talk | contribs)
Imbion (talk | contribs)
No edit summary
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=
|type=
|techt=
|purp=
}}
{{ArgRow
|name=
|type=
|techt=
|purp=
}}
{{ArgRow
|name=
|type=
|techt=
|purp=
}}
{{ArgRow
|name=
|type=
|techt=
|purp=
}}
{{ArgRow
|name=
|type=
|techt=
|purp=
}}
|}
== 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=
|techt=
|purp=X position of the menu
}}
{{ArgRow
|name=y
|type=
|techt=
|purp=Y position of the menu
}}
{{ArgRow
|name=width
|type=
|techt=
|purp=Width of the menu
}}
{{ArgRow
|name=title
|type=
|techt=
|purp=Height of the menu
}}
{{ArgRow
|name=choices
|type=
|techt=
|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=
|techt=
|purp=Number of choices per page
}}
{{ArgRow
|name=defaultChoice
|type=
|techt=
|purp=The cursor starts on this choice.
}}
{{ArgRow
|name=cancelChoice
|type=
|techt=
|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

Revision as of 17:14, 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

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 X position of the menu
y Y position of the menu
width Width of the menu
title Height of the menu
choices A table of choices. Each choice can be either a string, or { string, bool } representing the text and enabled status.
linesPerPage Number of choices per page
defaultChoice The cursor starts on this choice.
cancelChoice 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