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

summaryrefslogtreecommitdiff
path: root/doc/lua/openstarbound/chat.md
blob: 834b4e825708775af130320ca8b50ff46c125076 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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.