Chat Box¶
Picture
The Chat Box is able to read and write messages to the in-game chat. You can send messages to just one player or to everyone.
Hint
If you prefix your message with a $ the message will not be sent to the global chat but the chat event fires.
Example:
$this message is hidden!
Overview¶
Peripheral Name | Interfaces with | Events | Introduced in |
---|---|---|---|
chatBox | Game Chat | Yes | 0.1b |
Events¶
Event Name | Parameter One | Parameter Two | Parameter Three | Parameter Four | Parameter Five | Description |
---|---|---|---|---|---|---|
chat | "chat" | string username | string message | string uuid | boolean isHidden | Fires when a player sends a message |
Example¶
1 2 3 4 |
|
Info
The chat
event will fire once a chatbox has been connected to the computer.
You don't have to .wrap()
or .find()
the peripheral (unless you intend to send messages).
Functions¶
Function | Returns | Description |
---|---|---|
sendMessage(string message, string prefix) | Broadcasts a message to the global chat. | |
sendFormattedMessage(string jsonObject, string prefix) | Broadcasts a text component message to the global chat. | |
sendMessageToPlayer(string message, string user, string prefix) | Sends a message to one specific player. |
Example¶
The Chat Box is quite easy to use. Wrap the peripheral and send messages or use the chat event.
1 2 3 4 5 6 7 |
|
Scripts & Examples¶
I made an script which emits a redstone signal if a player sends a specified message.
Script: here
Example Video: here
Changelog/Trivia¶
0.7r
Added the uuid and hidden parameter to the chat event. Also added the sendFormattedMessage
function.
4.0b Fixed that the chat box is not working on LAN worlds
0.1b Added the chat box. It was the first feature of the mod.