Class engine.Chat
Handle chats between the player and NPCs
Methods
engine.Chat:init (name, npc, player, data)
Init
engine.Chat:getChatFile (file)
Get chat file Also has support for chat files in addons
engine.Chat:switchNPC (npc)
Switch the NPC talking
engine.Chat:addChat (c)
Adds a chat to the list of possible chats
engine.Chat:invoke ([id=self.default_id])
Invokes a chat
engine.Chat:get (id)
Gets the chat with the given id
engine.Chat:replace (text)
Replace some keywords in the given text
Methods
- engine.Chat:init (name, npc, player, data)
-
Init
Parameters:
- engine.Chat:getChatFile (file)
-
Get chat file
Also has support for chat files in addons
Parameters:
- file string /data*/chats/{file}.lua
- engine.Chat:switchNPC (npc)
-
Switch the NPC talking
Parameters:
- npc Actor
Returns:
-
NPC we switched from
- engine.Chat:addChat (c)
-
Adds a chat to the list of possible chats
Parameters:
- c table
- engine.Chat:invoke ([id=self.default_id])
-
Invokes a chat
Parameters:
- id string the id of the first chat to run (default self.default_id)
Returns:
engine.dialog.Chat
- engine.Chat:get (id)
-
Gets the chat with the given id
Parameters:
- id string the id of the chat
Returns:
- engine.Chat:replace (text)
-
Replace some keywords in the given text
Parameters:
- text string @playername@, @npcname@, @playerdescriptor.(.-)@