The Quiet Message Window
Follow instruction sequences to guide the character to the goal.
- Web browser (Chrome, Edge, Firefox)
- Internet connection
- Scratch 3.0 online editor
🔧 Build Your Digital Handshake System
// Sender Script (Nurse Station)
when [space v] key pressed
say [Checking if Pharmacy is open...] for (1) seconds
set [channel_ready v] to [0]
broadcast [request_connection v]
wait until <(channel_ready) = [1]>
say [Handshake confirmed! Transmitting order: 5 Amoxil.]
play sound [Chime v]
// Receiver Script (Pharmacy)
when I receive [request_connection v]
wait (0.8) seconds // Simulate system processing
set [channel_ready v] to [1]
say [Pharmacy online: Ready to receive prescription.]
The sender pauses until channel_ready equals 1, preventing lost data transmissions.
⚗️ Test your model
| Test Condition / Action | Expected Result |
|---|---|
| Press Space (Handshake) | Sender says 'Checking if Pharmacy is open' and sends request |
| Pharmacy answers | channel_ready switches to 1; confirmation chime sounds |
| Prescription Sent | Data transmits only after confirmed connection |
Simulate a 'Pharmacy Closed' state where the receiver does not answer, and sender times out after 3 seconds!
📖 Our Story & Concepts
Imagine shouting a secret message across a noisy playground when your friend isn't listening. Your words disappear in the wind! In healthcare, banking, and space travel, sending data when the receiver is asleep or busy can cause disastrous errors.
To solve this, computers use a digital handshake: 1. Hello, are you ready? → 2. Yes, I am ready! → 3. Great, here is the data. This protocol ensures zero dropped messages and bulletproof reliability.
</> Full Annotated Code Walkthrough
// Complete Protocol Script with Timeout Protection
when [space v] key pressed
set [channel_ready v] to [0]
set [timeout_timer v] to [3]
broadcast [ping_receiver v]
say [Initiating handshake...] for (0.5) seconds
repeat until <(channel_ready) = [1]> or <(timeout_timer) = [0]>
wait (1) seconds
change [timeout_timer v] by (-1)
end
if <(channel_ready) = [1]> then
say [Handshake successful! Transmitting packet.]
play sound [Magic v]
else
say [TIMEOUT ERROR: Receiver unreachable. Message aborted.]
play sound [Oops v]
end
The sender pauses until channel_ready equals 1, preventing lost data transmissions.
▷ Expected Results & Troubleshooting
| Test Condition / Action | Expected Result |
|---|---|
| Press Space (Handshake) | Sender says 'Checking if Pharmacy is open' and sends request |
| Pharmacy answers | channel_ready switches to 1; confirmation chime sounds |
| Prescription Sent | Data transmits only after confirmed connection |
⚑ Extension Challenges & Blueprints
- Level 1: Add a 3-way handshake: Sender Pings -> Receiver Acks -> Sender Confirms Receipt.
- Level 2: Display an animated signal antenna with green waves during active connection.
- Level 3: Add an error log list that records every failed handshake attempt.