S03 · Sat, Oct 3, 2026

Make the World React

Student slides for session S03. Use these to follow along in class or to recap what to try before next time.

Compass Awakening

Make the World React

Last session your Moon Compass sat where you placed it. Today it gets a clue and a reveal, and you write both.

near_message = f"The {object_name} needle trembles toward the dark trees."

Today's mission

M03 · Make It Respond

Mission: make-your-object-respond

Learning target: Construct an f-string message from an object-name variable and predict which player event reveals each authored response.

The Moon Compass is hiding a secret. You choose what it is. Your nearby clue hints at it; your interaction line reveals it.

Recap from S02

Variables and strings

object_name = "Moon Compass"
print(object_name)
  • A variable is a name that stores a value.
  • A string is text inside matching quotation marks.
  • print(object_name) shows the stored value: Moon Compass.

New today

f-strings

Put an f right before the opening quote, and Python lets you place variables inside the string with curly braces.

"The {object_name} glows."

A plain string. The braces are printed as typed.

f"The {object_name} glows."

An f-string. Python fills in the value.

Three names to know

object_name, near_message, interacted_message

Today’s variables
object_nameThe object’s name: "Moon Compass".
near_messageYour clue. Built with an f-string that uses object_name.
interacted_messageYour reveal. Also built with an f-string.

How braces work

Braces substitute a value

object_name = "Moon Compass"
near_message = f"The {object_name} glows."
print(near_message)
The Moon Compass glows.

Checkpoint: point to the braces and explain what value appears there.

Two different events

Move near vs. press E

  • Move near: walk up to the compass without pressing anything. The near message appears: your clue.
  • Press E nearby: interact with the compass. The interacted message appears: your reveal.

Same object, two events, two different messages. Approach first, record what you see, then press E.

Your story choice

Choose a secret, write a clue

What is the Moon Compass hiding? A lantern, a fork in the trail, a clearing, or an idea of your own.

  • The clue (near) hints at the secret without giving it away: a direction, a feeling, or an object.
  • The reveal (interacted) tells what the secret is.
  • If your clue simply repeats the reveal, make it more indirect.

Predict before interacting

Say it before you see it

Complete this sentence before you run the Trail:

“Moving near will show ___; pressing E will show ___.”

With a partner: read your clue aloud and have them guess the reveal before either of you presses E. No partner? Write your reveal prediction on paper first.

Python first

The starter

object_name = "Moon Compass"
near_message = f"{object_name}"  # TODO: add a nearby clue inside this f-string.
interacted_message = f"The {object_name} points past the trees to a guide's lantern!"

print(near_message)
print(interacted_message)
python lessons/sessions/s03/student/starter.py

Before you change anything, it prints:

Moon Compass
The Moon Compass points past the trees to a guide's lantern!

The first line is only the name. That is on purpose: the clue is yours to write.

Core path

Clue, reveal, run

  1. Choose your secret: what the Moon Compass’s clue is hiding.
  2. Expand near_message = f"{object_name}" into a complete nearby clue. Keep {object_name} inside the f-string.
  3. Write your own reveal line for interacted_message, then run the file.
  4. Checkpoint: both printed lines now include the object name and your story text.

The bridge to the world

Python text becomes YAML text

Where each message goes
Python valueYAML fieldWhat you see
near_messagewhen_nearAppears when the player approaches
interacted_messagewhen_interactedAppears after E is pressed nearby

Copy only the final message text into the object file:

# lessons/sessions/s03/student/explorer-package/objects/compass.yaml
when_near: "The Moon Compass needle trembles toward the dark trees."
when_interacted: "The Moon Compass points past the trees to a guide's lantern!"

YAML drives the world. Python helps you compose and check the text. The YAML file gets plain text, with no braces.

Validate first

Check the package

explore-package validate lessons/sessions/s03/student/explorer-package

Look for valid: .... If validation fails, fix only the first reported issue and try again.

Launch the Trail

See both events

explore-package trail \
  examples/explorer-packages/nova-character \
  lessons/sessions/s03/student/explorer-package \
  --player "nova-character:nova" \
  --mission-id "make-your-object-respond" \
  --name "S03 Make the World React"
  1. Approach without pressing E. Record the near message.
  2. Press E. Record the interaction message.
  3. Compare your partner’s prediction with the actual reveal.
  4. M03 completes after you interact with every world object.

Today’s Trail is the same painted Moon Meadow as S02. What changes today is the text your compass shows. If you see a plain dark Trail with a rectangle Compass, your course tools are out of date — tell your teacher.

Deliberate debugging

Edit, predict, run, restore

  1. Save your working line somewhere in your notes.
  2. Temporarily remove the closing } after object_name:
near_message = f"The {object_name needle begins to shimmer."
  1. Predict the error before running Python.
  2. Run and read the final error line. It starts with SyntaxError.
  3. Restore the saved working line and rerun successfully.

Reasoning check

What if the fields were swapped?

when_near: "The Moon Compass points past the trees to a guide's lantern!"
when_interacted: "The Moon Compass needle trembles toward the dark trees."

Both values are valid text, so the package can still pass validation. Predict what a player would see.

Answer: the reveal shows up just by walking near, and the clue only appears after pressing E. The story is spoiled. Fix it by putting each message back in its matching field.

If you get stuck

Support and extension paths

Support: start with near_message = f"The {object_name} glows.", then replace glows with your own clue. Ask the teacher to identify the field, not write the message.

Extension: write a second, harder clue that foreshadows the same reveal with less detail, so a partner has to think longer before predicting it. Keep exactly the two existing response fields.

Using AI on this mission

Bounded questions, not full solutions

Write both of your own lines first. AI may suggest wording or explain one brace or field mismatch. It may not write either message, choose your secret, or invent a new event. Record your intent, prediction, exact question, suggestion tested, accepted or rejected change, and your own explanation.

Exit check

Three quick answers

  • f-strings: In your near_message, what value appears where the braces are?
  • Events: Which message appears when you move near? Which appears when you press E? Did your prediction match?
  • Debugging: What happened when the closing brace was missing? What would a player see if the two YAML messages were swapped?

Looking ahead

S04 · Introduce a Character

Your Moon Compass’s clue points toward someone. Next session, the expedition meets a guide who needs your help, and you write a Python function that gives the guide a voice.

Close

Wrap up S03

Save your files. Be ready to explain the braces in your f-string and which event shows each message. A correct explanation matters more than finishing every step.

What we learned in Python today →