Functions for prompting the player for input.
local Input = ELONA.require("core.Input")
yes_no (message) | Prompts the player to select "yes" or "no". |
prompt_number (message, max[, initial]) | Prompts the player to choose a number. |
prompt_text (message, is_cancelable) | Prompts the player to enter text. |
prompt_choice (choices) | Prompts the player to select from a list of choices. |
prompt_dialog (message, portrait_id, speaker_name[, default_index], choices[, impression][, interest]) | Creates a dialog window like the one normally shown when talking to a character. |
prompt_dialog (message, chara_image, speaker_name[, default_index], choices[, impression][, interest]) | Creates a dialog window like the one normally shown when talking to a character. |
start_dialog (speaker[, dialog]) | Starts a dialog with a character. |
choose_ally (operation) | Prompts the player to choose an ally. |
enqueue_macro (action, actions) | Enqueues an action or a list of actions into the macro action queue. |
clear_macro_queue () | Clears any actions that haven't been run yet in the macro action queue. |
ignore_keywait () | Disables input/macro keywait for this frame. |
any_key_pressed () | Returns true if any key is pressed. |
Prompts the player to select "yes" or "no".
Parameters:
local result = Input.yes_no("Yes or no?")
if result == nil then
GUI.txt("You canceled. ")
elseif result then
GUI.txt("You chose yes. ")
else
GUI.txt("You chose no. ")
end
Prompts the player to choose a number.
Raises an error if
max
is less than 0.
local result = Input.prompt_number("Which character to spawn? ", 353)
if result then
local chara = Chara.create(25, 25, result)
if chara then
GUI.txt("Spawned " .. chara.name .. ". ")
end
else
GUI.txt("Never mind.")
end
Prompts the player to enter text.
Parameters:
local result = Input.prompt_text("What text?", true)
if result then
GUI.txt("You typed \"" .. result .. "\". ")
else
GUI.txt("Never mind. ")
end
Prompts the player to select from a list of choices.
Raises an error if no arguments are provided.
Parameters:GUI.txt("Which? ")
local choices = {"First", "Second", "Third"}
local result = Input.prompt_choice(choices)
if result then
GUI.txt("You chose \"" .. choices[result] .. "\". ")
else
GUI.txt("Never mind. ")
end
Creates a dialog window like the one normally shown when talking to a character.
Parameters:
Creates a dialog window like the one normally shown when talking to a character.
Parameters:
Starts a dialog with a character.
Parameters:
Prompts the player to choose an ally.
Parameters:
Enqueues an action or a list of actions into the macro action queue.
It will be run in order of insertion the next time input is queried.
Parameters:Macro.enqueue("north")
Macro.enqueue({"east", "wait", "northwest"})
Clears any actions that haven't been run yet in the macro action queue.
Disables input/macro keywait for this frame.
Returns true if any key is pressed.
Returns: