16Build a shop with Loom.
Prices, a purse and a lantern that lands in your pack.
Lesson 16 of 211:59

In this lesson12 steps
Transcript
Let’s build a real shop with the Loom... one where your gold actually runs out.
Click New to start an empty thread. Remember, each thread is one rule.
Give it a name you’ll remember. Only you ever see it.
First, the WHEN. What should this thread wait for? Here, the player asking to buy something.
Type a word, then press Enter. Buy... then lantern. If the message has either word, this part is true.
But wanting a lantern isn’t enough... you need the money. So add a second condition: enough gold to pay. All of these means both must be true. Ask to buy and have the gold... or the shop stays shut. Now the THEN, the part that acts.
First, take the price out of their gold.
Next, give the player a Storm lantern. It goes straight into their pack.
Then show the gold as a bar, so the player can watch their purse go down.
And finally, a narrator note. It’s a little line for the player... the AI never sees it.
Now read it back in plain words. If that sentence sounds right, your rule is right. And it’s already saved.
Time to try it. Back in the story, ask the lamp-keeper for a lantern.
And the shop works! The gold drops, the lantern’s yours, and your HUD keeps track of both. A working shop, built in minutes. Next up: testing your threads, and fixing them.
The course
All 21 lessons
Part I
Start playing
Part II
Keep the story straight
Part III
Shape the replies
Part IV
Voices and pictures
Part V
The Loom
Part VI