Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Krasheninnikov <boba09@list.ru>2025-04-17 09:51:27 +0200
committerVladimir Krasheninnikov <boba09@list.ru>2025-04-17 09:51:27 +0200
commit36ffe46ae378dfd8c2edb883503e1bac163cd1b5 (patch)
tree329037f77fc69d93abbb327f9c4642d5d39f5613
parent6b548c17e20c5d6c5cc154d300a7a4c4ed42984c (diff)
Add chat lua callbacks documentation
-rw-r--r--doc/lua/openstarbound/chat.md59
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..834b4e8
--- /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.
+
+---
+
+#### `List<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