mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
- Added support for voice messages prefixed with "voice:" in Ink files. - Updated UI rendering to display voice message UI with play button and transcript. - Implemented automatic conversion for scenario JSON with voice properties. - Created test examples for pure voice messages and mixed content. - Fixed issues with NPC registration and message duplication in test scenarios. - Documented feature details, use cases, and testing procedures.
3.7 KiB
3.7 KiB
Voice Messages - Bug Fixes
Issues Fixed (2025-10-30 02:40)
Issue 1: IT Team and David showing "no messages yet"
Cause: Compiled JSON files were 0 bytes (empty)
voice-message-example.jsonwas 0 bytesmixed-message-example.jsonwas 0 bytes
Root Cause: Initial compilation command used stdout redirection (>) which failed silently
Fix: Recompiled using proper -o flag:
inklecate -o ../compiled/voice-message-example.json voice-message-example.ink
inklecate -o ../compiled/mixed-message-example.json mixed-message-example.ink
Result:
voice-message-example.jsonnow 209 bytes ✅mixed-message-example.jsonnow 720 bytes ✅
Verification:
- IT Team now shows voice message with transcript
- David now shows mixed text + voice conversation
Issue 2: "Test Simple Message Conversion" creating duplicates
Cause: Function used timestamp-based NPC ID on every click:
const npcId = `phone_msg_${baseName}_${Date.now()}`; // New ID each time!
Problem:
- Click 1:
phone_msg_reception_phone_1730254800000 - Click 2:
phone_msg_reception_phone_1730254801000 - Click 3:
phone_msg_reception_phone_1730254802000 - Result: 3 duplicate NPCs in contact list
Fix: Modified test function to:
- Use static test ID:
test_reception_phone - Check if NPC already registered before creating
- If exists, just open phone (don't re-register)
Code Change (test-phone-chat-minigame.html):
async function testSimpleMessageConversion() {
const testNpcId = 'test_reception_phone'; // Static ID
// Check if already registered
if (window.npcManager.getNPC(testNpcId)) {
log('ℹ️ Test NPC already registered, skipping...', 'info');
// Just open phone, don't re-register
window.MinigameFramework.startMinigame('phone-chat', null, {
phoneId: 'default_phone',
title: 'Test Simple Message'
});
return;
}
// Create and register only if doesn't exist
const virtualNPC = PhoneMessageConverter.createVirtualNPC(simplePhone);
virtualNPC.id = testNpcId; // Override timestamp ID
window.npcManager.registerNPC(virtualNPC);
// ...
}
Result:
- First click: Registers NPC and opens phone
- Subsequent clicks: Just opens phone (no duplicates)
Testing Steps
Test Voice Messages
- Open
test-phone-chat-minigame.html - Click "Initialize Systems"
- Click "Register Test NPCs"
- Click "📱 Open Phone"
- Expected: 6 contacts visible:
- ✅ Alice - Security Consultant (interactive)
- ✅ Bob - IT Manager (interactive)
- ✅ Charlie - Security Guard (interactive)
- ✅ Security Team (simple text message)
- ✅ IT Team (voice message with waveform) ← FIXED
- ✅ David - Tech Support (mixed text + voice) ← FIXED
Test Conversion (No Duplicates)
- Click "🔄 Test Simple Message Conversion"
- Expected: Receptionist appears in contact list
- Click button again
- Expected: Console shows "Test NPC already registered, skipping..."
- Expected: No duplicate Receptionist entries ← FIXED
Files Changed
1. Recompiled Ink JSON
scenarios/compiled/voice-message-example.json- Now 209 bytesscenarios/compiled/mixed-message-example.json- Now 720 bytes
2. Test Page
test-phone-chat-minigame.html- UpdatedtestSimpleMessageConversion()function
Status
✅ All Issues Resolved
- IT Team voice message displays correctly
- David mixed message conversation works
- Simple message conversion test no longer creates duplicates
- All 6 NPCs appear in phone contact list
- Voice message UI renders with play button + waveform
Date: 2025-10-30 02:40
Status: Fixed & Verified