- 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
Voice Message Examples - Working Reference
✅ All Examples Now Working
1. IT Team - Pure Voice Message
File: scenarios/ink/voice-message-example.ink
=== start ===
voice: Hi, this is the IT Team. Security breach detected in server room. Changed access code to 4829.
-> END
Compiled: scenarios/compiled/voice-message-example.json (209 bytes)
Display: Voice message UI with:
- ▶️ Play button
- 🌊 Audio waveform
- 📄 Transcript: "Hi, this is the IT Team..."
2. David - Mixed Text + Voice
File: scenarios/ink/mixed-message-example.ink
=== start ===
Hello! This is a test of mixed message types.
+ [Tell me more]
-> voice_example
=== voice_example ===
voice: This is a voice message. I'm calling to let you know that the security code has been changed to 4829. Please acknowledge receipt.
+ [Got it, thanks!]
Great! I'll see you soon.
-> END
+ [What was the code again?]
voice: The code is 4-8-2-9. I repeat: four, eight, two, nine.
-> END
Compiled: scenarios/compiled/mixed-message-example.json (720 bytes)
Display:
- First message: Regular text bubble
- After choice: Voice message UI
- Depending on choice: Either text or another voice message
3. Simple Conversion Test - Runtime Conversion
Source: Phone object (old format)
{
"type": "phone",
"voice": "Welcome to the Computer Science Department! The CyBOK backup is in the Professor's safe.",
"sender": "Receptionist"
}
Converted To: Ink JSON with voice: prefix (automatic)
Display: Voice message UI (same as IT Team)
Full Contact List
When you open the phone (player_phone), you should see:
-
Alice - Security Consultant
- Type: Interactive chat
- Story:
alice-chat.json - Avatar: ✅
-
Bob - IT Manager
- Type: Interactive chat
- Story:
generic-npc.json - Avatar: ✅
-
Charlie - Security Guard
- Type: Interactive chat
- Story:
generic-npc.json - Avatar: ❌
-
Security Team
- Type: Simple text message
- Story:
simple-message.json - Avatar: ❌
-
IT Team ✅ FIXED
- Type: Voice message
- Story:
voice-message-example.json - Avatar: ❌
- Display: Voice UI with waveform
-
David - Tech Support ✅ FIXED
- Type: Mixed text + voice
- Story:
mixed-message-example.json - Avatar: ❌
- Display: Text then voice based on choices
Visual Differences
Regular Text Message (Security Team)
┌────────────────────────────────┐
│ Security alert: Unauthorized │
│ access detected... │
│ 2:18 PM │
└────────────────────────────────┘
Voice Message (IT Team, David after choice)
┌────────────────────────────────┐
│ ▶️ ~~~~~~~~~~~~~~~~~~~ │
│ │
│ 📄 Transcript: │
│ Hi, this is the IT Team... │
│ │
│ 2:18 PM │
└────────────────────────────────┘
Verification Checklist
✅ All 6 NPCs appear in contact list ✅ IT Team shows voice message UI ✅ David shows mixed text + voice ✅ Simple conversion test doesn't create duplicates ✅ Voice messages have play button + waveform ✅ Transcript displays correctly ✅ Timestamp shows on all messages
Status: All Working ✅
Date: 2025-10-30
Test Page: test-phone-chat-minigame.html