| chat.lua | actually fix #1 | |
| README.md | add readme and licence | |
| speech-bubble.png | add readme and licence | |
| UNLICENSE | add readme and licence | |
Chat Module
This module can read chat text.
This is intended to be used as a submodule for plugins. If you're not a plugin developer, you're in the wrong place.
Since the interface update 2026年01月19日, most text in the game now uses the same font as the chat box, so this module can actually be used to read most types of text.
How to add
To clone this module to the modules/chat directory in your repository:
git submodule add https://codeberg.org/Adamcake/bolt-chatmodule.git modules/chat
This pins the latest commit at the time when you run the command. To update (or downgrade), cd into the directory and then use git commands as normal. To update, use git pull. To checkout a specific commit, use git checkout <commit_hash>.
How to use
You can either use this plugin to recognise individual letters in the chat font, or it can also be used more statefully to parse new chat messages. Both require a render2d event.
To recognise an individual letter, use module:lookupchatcharacter(event, atlas_x, atlas_y, atlas_w, atlas_h). The last four are returned (in that order) from the event's vertexatlasdetails function.
To read the whole chat box in one pass, the player must have message timestamps enabled. First, identify something near the start of it. The most consistent way to do this is by finding this speech bubble icon: Speech Bubble
Next, call the tryreadchat function from this module: module:tryreadchat(event, startindex, prevmostrecent, callback)
The parameters are as follows:
- event: the render2d event
- startindex: the vertex index to start reading at (typically the index of the speech bubble)
- prevmostrecent: the most recent message passed to
callback, ornilif no messages have been received yet - callback: this function will be called for each new message that's newer than
prevmostrecent, in order of arrival. The parameter is a string and includes the timestamp at the beginning.
This module fully supports all font sizes and all levels of interface scaling. However, it should go without saying that the message must actually be shown on the user's screen to be able to read it. There's no way to read text that's off-screen due to being scrolled up or disabled/filtered.
Copying
The contents of this repository are public domain (see UNLICENSE), with the exception of speech-bubble.png, which depicts images I don't own. Accreditation is appreciated but not required.