package dialog
Package dialog is how a mission talks to the player: a subtitle line with a speaker, and a question with several answers.
dialog.Say(player.Everyone, "Mira", "The bridge is out.", 4)
dialog.Choice(player.Red, "road", "Which road?", []string{"The pass", "The marsh"},
func(p player.ID, i int) { campaign.SetFlag("marsh", i == 1) })A question is a single-use decision, as in Warcraft III's campaigns: the first answer wins, the other buttons vanish and cannot be pressed again, and asking a new question under the same id replaces the old one. The answer is a click on a button of the map's interface, which the game records like any other input, so a replay and every computer in a game see the same answer at the same step. The lines are only presentation: nothing here changes the simulation by itself.
import "aqua4/dialog"Functions
Choice
func Choice(who player.ID, id, prompt string, options []string, onAnswer func(p player.ID, index int))Choice asks who a question. onAnswer is called once, with the player who answered and the
index of the option; a second click on any option of the same question does nothing.
Open
func Open(id string) boolOpen reports whether a question with this id waits for an answer.
Say
func Say(who player.ID, speaker, text string, seconds float64)Say shows a subtitle at the bottom of the screen for seconds of game time. The speaker may be
empty. Several lines at once stack in turn: a newer one replaces the older.