User Tools

Site Tools


display_choices

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
display_choices [2021/06/29 19:03]
justin created
display_choices [2021/06/29 20:42] (current)
justin
Line 2: Line 2:
 ---- ----
  
-Displays a set of choices to the player using a [[dialogue]] box. The list of choices must be provided as an [[array]] of [[string]] values. Once the player has selected an option, the choice will be stored into the result variable as a [[number]] (with 0 being the first option, 1 being the second, and so forth).+Displays a set of choices to the player using a [[dialogue]] box. The list of choices must be provided as an [[array]] of [[string]] values. Once the player has selected an option, the choice will be stored into the result variable as a [[number]] (with 0 being the first option, 1 being the second, and so forth). This function, when paired together with the [[Display Message]] function, can be used to create simple, on the fly conversations without the need for a standalone [[dialogue]] file.
  
 ====Signature:==== ====Signature:====
Line 11: Line 11:
 ^Argument^Description^Type^Required^ ^Argument^Description^Type^Required^
 |message_text|Message text to display in the [[dialogue]] box.|[[String]]|Yes| |message_text|Message text to display in the [[dialogue]] box.|[[String]]|Yes|
-|speaker|[[character|Character]] that will speak the message.|[[Entity]]|No|+|choices|List of choices the player will be presented with.|[[Array]]|Yes| 
 +|speaker|[[character|Character]] who will speak the message.|[[Entity]]|No|
  
 <WRAP center round info 100%> <WRAP center round info 100%>
Line 19: Line 20:
 ====Example:==== ====Example:====
 <code bauxite> <code bauxite>
-display_choices("Pick an item.", array["Sword", "Dagger"], entity["Sarah"]);+display_choices("Choose a reward!", array["Food", "Potions"], entity["Sarah"]);
 </code> </code>
-//Results:// A [[dialogue]] box is displayed containing the text "Justin and Sarah's House".+//Results:// A [[dialogue]] box spoken by Sarah is displayedcontaining the text "Choose a reward!along with two options for the player to choose between.
  
 <WRAP center round tip 100%> <WRAP center round tip 100%>
-Use the **Display Choices** function to .+Use the **Display Choices** function to provide a list of rewards for the player to choose from upon completing a quest or to provide a prompt that determines the next event in a cutscene when the player is faced with a decision.
 </WRAP> </WRAP>
  
display_choices.1625018627.txt.gz · Last modified: 2021/06/29 19:03 by justin