CorsixTH Lua Documentation

UIAdviser Class

The (ideally) helpful advisor who pops up from the bottom dialog during a game.

Declared on: line 23 of Lua/dialogs/adviser.lua.
Inheritance: UIAdviser ยป Window

Method Index

Member Index

(*) only used in superclass methods
function UIAdviser:UIAdviser(ui)

Parameters:

NameTypeDescription
ui ? ?

Declared on: line 29 of Lua/dialogs/adviser.lua.

function UIAdviser:addMessageToHistory(speech)

Adds a message to the adviser's message history.

If the history exceeds a certain limit, the oldest messages are removed.

Parameters:

NameTypeDescription
speech ? ?

Declared on: line 73 of Lua/dialogs/adviser.lua.

function UIAdviser:addQueuedMessagesToHistory()

Adds all queued messages to the adviser's message history.

Declared on: line 92 of Lua/dialogs/adviser.lua.

function UIAdviser:afterLoad(old, new)

Parameters:

NameTypeDescription
old ? ?
new ? ?

Overrides: Window:afterLoad.
Declared on: line 336 of Lua/dialogs/adviser.lua.

function UIAdviser:checkForDuplicates(speech)

Function checks if the adviser has been asked to say something already queued

Parameters:

NameTypeDescription
speech string Text to check

Declared on: line 183 of Lua/dialogs/adviser.lua.

function UIAdviser:deleteAllMessagesFromHistory()

Deletes all messages from the adviser's message history.

Declared on: line 105 of Lua/dialogs/adviser.lua.

function UIAdviser:draw(canvas, x, y)

Parameters:

NameTypeDescription
canvas ? ?
x ? ?
y ? ?

Overrides: Window:draw.
Declared on: line 235 of Lua/dialogs/adviser.lua.

function UIAdviser:hide()

Hides the adviser by running the appropriate animation.

Declared on: line 174 of Lua/dialogs/adviser.lua.

function UIAdviser:idle()

Makes the adviser idle for a while before disappearing. This means that the text bubble is removed.

Declared on: line 162 of Lua/dialogs/adviser.lua.

function UIAdviser:messageIndexInHistory(message)

Parameters:

NameTypeDescription
message ? ?

Declared on: line 64 of Lua/dialogs/adviser.lua.

function UIAdviser:onMouseDown(button, x, y)

Parameters:

NameTypeDescription
button ? ?
x ? ?
y ? ?

Overrides: Window:onMouseDown.
Declared on: line 258 of Lua/dialogs/adviser.lua.

function UIAdviser:removeMessageFromHistory(index)

Removes a message from the adviser's message history.

Parameters:

NameTypeDescription
index ? ?

Declared on: line 100 of Lua/dialogs/adviser.lua.

function UIAdviser:say(speech, talk_until_next_announce, override_current)

Makes the adviser say something

Parameters:

NameTypeDescription
speech ? The table containing the text he should say and the priority.
talk_until_next_announce ? Whether he should stay up until the next say() call is made. Useful for the tutorial.
override_current ? Cancels previous messages (if any) immediately and shows this new one instead.

Declared on: line 194 of Lua/dialogs/adviser.lua.

function UIAdviser:show()

Shows the adviser by running the "popup" animation. Then moves on to the next phase automatically.

Declared on: line 110 of Lua/dialogs/adviser.lua.

function UIAdviser:talk()

Displays the text bubble along with the next message from the queue.

Declared on: line 119 of Lua/dialogs/adviser.lua.