Skip to content

In-world chat bubbles and typing indicator #1418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 46 additions & 8 deletions scripts/communityScripts/armored-chat/armored_chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
var settings = {
external_window: false,
maximum_messages: 200,
join_notification: true
join_notification: true,
use_chat_bubbles: true,
};

// Global vars
Expand All @@ -26,6 +27,7 @@
var messageHistory = Settings.getValue("ArmoredChat-Messages", []) || [];
var maxLocalDistance = 20; // Maximum range for the local chat
var palData = AvatarManager.getPalData().data;
var isTyping = false;

Controller.keyPressEvent.connect(keyPressEvent);
Messages.subscribe("Chat"); // Floofchat
Expand Down Expand Up @@ -99,6 +101,8 @@
if (channel !== "chat") return;
message = JSON.parse(message);

if (message.action !== "send_chat_message") return;

// Get the message data
const currentTimestamp = _getTimestamp();
const timeArray = _formatTimestamp(currentTimestamp);
Expand All @@ -124,13 +128,15 @@
_emitEvent({ type: "show_message", ...message });

// Show new message on screen
Messages.sendLocalMessage(
"Floof-Notif",
JSON.stringify({
sender: message.displayName,
text: message.message,
})
);
if (message.channel !== "local" || !settings.use_chat_bubbles) {
Messages.sendLocalMessage(
"Floof-Notif",
JSON.stringify({
sender: message.displayName,
text: message.message,
})
);
}

// Save message to history
let savedMessage = message;
Expand Down Expand Up @@ -160,6 +166,7 @@
_sendMessage(event.message, event.channel);
break;
case "setting_change":

// Set the setting value, and save the config
settings[event.setting] = event.value; // Update local settings
_saveSettings(); // Save local settings
Expand All @@ -171,6 +178,14 @@
? Desktop.PresentationMode.NATIVE
: Desktop.PresentationMode.VIRTUAL;
break;
case "use_chat_bubbles":
Messages.sendLocalMessage(
"ChatBubbles-Config",
JSON.stringify({
enabled: event.value,
})
);
break;
}

break;
Expand All @@ -183,6 +198,29 @@
type: "clear_messages",
});
break;
case "start_typing":
if (!isTyping) {
Messages.sendMessage(
"Chat-Typing",
JSON.stringify({
action: "typing_start",
position: MyAvatar.position,
})
);
}
isTyping = true;
break;
case "end_typing":
if (isTyping) {
Messages.sendMessage(
"Chat-Typing",
JSON.stringify({
action: "typing_stop"
})
);
}
isTyping = false;
break;
}
break;
case "initialized":
Expand Down
32 changes: 32 additions & 0 deletions scripts/communityScripts/armored-chat/armored_chat.qml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ Rectangle {
text = ""
}
}
onTextChanged: {
if (text === "") {
toScript({type: "action", action: "end_typing"});
} else {
toScript({type: "action", action: "start_typing"});
}
}
onFocusChanged: {
if (!HMD.active) return;
if (focus) return ApplicationInterface.showVRKeyboardForHudUI(true);
Expand Down Expand Up @@ -380,6 +387,30 @@ Rectangle {
}
}
}

// Chat bubbles
Rectangle {
width: parent.width
height: 40
color: "transparent"

Text{
text: "In-world chat bubbles"
color: "white"
font.pointSize: 12
anchors.verticalCenter: parent.verticalCenter
}

CheckBox{
id: s_chat_bubbles
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter

onCheckedChanged: {
toScript({type: 'setting_change', setting: 'use_chat_bubbles', value: checked})
}
}
}
}
}

Expand Down Expand Up @@ -610,6 +641,7 @@ Rectangle {
if (message.settings.external_window) s_external_window.checked = true;
if (message.settings.maximum_messages) s_maximum_messages.value = message.settings.maximum_messages;
if (message.settings.join_notification) s_join_notification.checked = true;
if (message.settings.use_chat_bubbles) s_chat_bubbles.checked = true;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Item {
Keys.onLeftPressed: { moveLeft(); }
Keys.onRightPressed: { moveRight(); }

onTextChanged: {
if (text === "") {
toScript({type: "action", action: "end_typing"});
} else {
toScript({type: "action", action: "start_typing"});
}
}

function moveLeft(){
if (cursorPosition > 0){
cursorPosition--
Expand Down Expand Up @@ -119,4 +127,4 @@ Item {
function toScript(packet){
sendToScript(packet)
}
}
}
Binary file not shown.
Loading
Loading