Lessons

The Python you type

The lesson book, in the order the screens teach it. Each screen wants one call. The box can do more than that — decisions, loops, your own names — and that full list is the Python chapter.

Words worth keeping

Function

A named action. print, set_name, choose_race. Parentheses run it.

String

Text in quotes. Item ids, skill ids, race ids, save slots. "bread" is not bread.

Integer

A whole number with no quotes. hero.attack(2) and hero.move_right(3).

Object and method

hero is the object. hero.look() asks that hero to look. The dot ties the action to the hero.

Argument

Extra data inside the parentheses. Some calls take none, some take one, enchant takes two.

Order

A snippet runs top to bottom. F5 or the Run button sends it. A mistake stops that snippet; fix the line and send it again. Creation only accepts the four lesson calls. After that, a name, an if, or a loop switches the whole box into full Python.

The lesson track

1a — Your first line

print("Hello")

print() is a function: a named action. Parentheses mean run it now. Text inside quotes is a string. The computer does only what this line says.

1b — Name your hero

set_name("Aldric")

You pass your own word into the function. Change Aldric. Keep the quotes. The examples use Aldric, Nyra, and Kael — never a real-world name.

1c — Choose a lineage

choose_race("elf")

Race is what you are. Valid strings: "human" "elf" "dwarf" "orc" "gnome" "beastfolk" "draken". Aliases such as dragonborn also mean draken.

1d — Choose how you fight

choose_class("mage")

Class is how you fight. Race is what you are. Valid strings: "warrior" "archer" "mage".

2a — Look around Bronze Castle

hero.look()

hero is an object. look is a method: a function that belongs to that hero. Empty parentheses mean run it now, with no extra data.

2b — Open the shops

hero.shop()
hero.enter_shop("blacksmith")

shop() lists the stalls. enter_shop takes a string: general, blacksmith, or alchemist. General sells food and trinkets, the smith sells weapons and armor, the alchemist sells potions.

2c — Buy with an item id

hero.buy("bread")
hero.buy("minor_hp_potion")

Use the id, not the pretty name. Gold goes down. The stack goes in the bag.

2d — Wear gear

hero.equip("copper_short_sword")

Same kind of string as buy. A warrior’s shield needs a one-handed weapon. An archer’s quiver works even with a two-handed bow. A mage’s tome needs a wand, not a two-handed staff.

2e — Read the bag

hero.inventory_list()
hero.equipment_list()

The bag is data on the hero. inventory_list prints every id and count. equipment_list prints the worn slots.

2f — Stations

hero.look_stations()

A town may have forge, sawbench, loom, tannery, alchemy_table, and a rune_table. This call lists only the ones in the town you are standing in.

2g — Craft

hero.craft("recipe_cured_rawhide")

A recipe id is a string. The ingredients must already be in the bag. Rings are not crafted; they are bought or dropped.

2h — Save

hero.save("save1")

A slot name is a string, like an item id. That writes your name, bag, gear, gold, and lesson progress. Load Game on the title reads the same slot.

2i — Professions and the rune table

hero.professions()
hero.enchant("copper_short_sword", "minor_keen")

Gathering and crafting raise a profession, not your hero level. Enchant takes the worn piece and a rune id. minor_ward and minor_stride are the other first runes. Archers start from a yew shortbow; mages from a yew wand.

2j — Leave town

hero.leave_town()

When the bag and the gear are ready, this call steps into the current wild stage. hero.leave_town(3) asks for stage 3 if you have unlocked it.

3a — One step

hero.move_right()

The map is a grid of colored squares. Each call moves one tile. move_left, move_up, and move_down match. A wall or a brown obstacle refuses the step.

3b — Several lines, in order

hero.move_right()
hero.move_down()

Python runs from the top of the snippet to the bottom. Two lines are two steps. You can also pass a count: hero.move_right(2).

3c — Find a node, then harvest

hero.look_nodes()
hero.gather()
hero.gather("chamomile_blossoms")

look_nodes lists herbs, wood, ore, fiber, and hides near you. gather() takes the nearest. Naming an id takes that one. The item enters the bag and the matching profession gains experience.

3d — The gold tile, then home

hero.move_right()
hero.leave()

Walk onto the gold square to end the stage. On a floor that is not the last, that same square is the stair. A boss waits at the end of every fifth stage. hero.leave() walks back to the closest town. Stages 1–20 return to Bronze Castle.

4 — A fight is still code

hero.look()
hero.attack()
hero.attack(2)
hero.defend()
hero.skill("firebolt")
hero.use("minor_hp_potion")

Walking onto an enemy opens combat in the same editor. attack() hits foe 1. attack(2) hits foe 2 — 2 is an integer, so it has no quotes. defend raises your guard. A skill name is a string. use spends a bag item by id. After the fight, inventory_list shows the loot, then you keep walking.

5–6 — The loop, then the champion

hero.attack()
hero.move_right()

Stages between bosses are the same loop: fight, gather, step on G. When you step on the goal of a boss stage, the champion fight begins. Beat them to open the next stage.

Mistakes the game will tell you about

Forgetting quotes around an id. Using the display name (“Minor Health Potion”) instead of minor_hp_potion. Calling attack, skill, or use when you are not in a fight. Casting a skill you have not unlocked or whose weapon you are not holding. Buying something the open stall does not stock. Crafting without the ingredients, or without that town’s station.

hero.help() reprints the list for wherever you are: town, wilds, or combat. If a name fails, that list is the correction.

What the lessons leave alone

The screens never require a decision. The box already accepts if, for, while, lists, and functions you define, once you are past creation. That whole fence — builtins, the 200-call cap, and the words it refuses — is the Python chapter. A class of your own is not one of those words. Skills come from your fighting style and your weapon, not from a class you type.