diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-04-17 17:58:59 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-17 17:58:59 +1000 |
commit | ba97cca2af947d0893f520965e5e4c545511c565 (patch) | |
tree | a4dd8ff1248e9a0c9b279052a8428f946989c5b2 /doc/lua | |
parent | 6b548c17e20c5d6c5cc154d300a7a4c4ed42984c (diff) | |
parent | bd31d70266e4a39fba12ff31a6e61d43245446d5 (diff) |
Merge pull request #225 from KrashV/main
Add chat lua callbacks documentation
Diffstat (limited to 'doc/lua')
-rw-r--r-- | doc/lua/openstarbound/chat.md | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/doc/lua/openstarbound/chat.md b/doc/lua/openstarbound/chat.md new file mode 100644 index 0000000..af9c96d --- /dev/null +++ b/doc/lua/openstarbound/chat.md @@ -0,0 +1,59 @@ +# Chat + +The new chat table is accessible from almost every clientside script and allows interaction with the in-game chat system. + +--- + +#### `double` chat.send(`String` message, [`String` modeName], [`bool` speak], [`Json` data])) + +Sends a new message in the chat. Optionally specifies the modeName: + +- `"Broadcast"`: Global chat. Default value. +- `"Local"`: Chat within the current planet. +- `"Party"`: Chat within the current party. + +If `speak` is false, the chat bubble will not appear above the player. +If `data` is provided, it will be sent as a JSON object with the message. This can be used to send custom data with the message. + +--- + +#### `String[]` chat.command(`String` command) + +Executes the specified command and returns a list of strings with the result. + +--- + +#### `void` chat.addMessage(`String` text, [`Json` config]) + +Adds the specified message to the chat log. The following keys are available in the `config` JSON object: + +- `String` __mode__ - The mode of the message. Can be one of the followgin: + - `"Broadcast"` + - `"Local"` + - `"Party"` + - `"Whisper"` + - `"CommandResult"` + - `"RadioMessage"` + - `"World"` +- `String` __channelName__ - The name of the channel to send the message to. +- `String` __fromNick__ - The name of the sender of the message. +- `String` __portrait__ - message portrait. +- `bool` __showPane__ - If false, the chat pane will not be triggered. + +--- + +#### `String` chat.input() + +Returns the current chat input text. + +--- + +#### `bool` chat.setInput(`String` text, [`bool` moveCursor]) + +Sets the current chat input text. If `moveCursor` is true, the cursor will be moved to the end of the text. Returns true if the input was set successfully, false otherwise. + +--- + +#### `void` chat.clear([`unsigned`] count) + +Clears the chat input text. If `count` is provided, it will clear the last `count` messages, all otherwise.
\ No newline at end of file |