Tutorial 3: Gold and words
What you will build
Section titled “What you will build”In Tutorial 1 the coins lived in the scheme. Now every actor gets a purse of its own, called Gold. You read it in a check, spend it, print it in the dialogue and show it in the objective. The scheme from Tutorial 1 is the one you change.
Who holds a value
Section titled “Who holds a value”A variable has an owner. You pick it once, and it decides who holds a value.
| Owner | One value for | Use it for |
|---|---|---|
| Each Actor | Each actor | A purse, a health, a mood. |
| This Scheme | Each run of one scheme | What only this plot needs, like Coins. |
| World | The whole game | A year counter. |
This Scheme variables are made in the Library of a scheme, as in Tutorial 1. Belongs To on the Variables page offers the others: Each Actor, Each Relationship, Each Clan, Each Family and World.
Gold is for every actor, so it belongs to Each Actor. See Variables.
1. Make the variable
Section titled “1. Make the variable”- In the page menu, choose Variables. Click New.
- Type
Goldand press Return. Names take letters and digits only. - In the inspector, check that Type reads Integer and Belongs To reads Each Actor. A new variable starts that way.
- Under Limits, turn on Minimum, and set Lowest to
0. - Under Default Value, leave the value at
0.
You should see a row Gold, Integer, Each Actor, with the default 0. See Variables page.
2. Give your conspirator some gold
Section titled “2. Give your conspirator some gold”- In the page menu, choose Actors. Select your conspirator on the People tab.
- Find Starting values. Set Gold to
40.
Dimmed values are the variable’s default, so Gold should stop being dimmed. Starting values are what the actor starts a new game with. See Actors: People.
3. Read and spend it in the scheme
Section titled “3. Read and spend it in the scheme”- Open A Cup for the King. Select the Compare Variable node.
- Click the button of Variable. In Which variable?, click Gold under EACH ACTOR.
- An Actor row appears. Make sure it is Conspirator.
- Select the Set Variable line under True. Do the same: Gold, Actor Conspirator, Operation Subtract, Value
15.
The cards should read Conspirator: Gold ≥ 15 and Conspirator: Gold − 15. The scheme’s own Coins is not used now. Delete its row in the Scheme tab of the Library, with the button with the cross.
4. Write with tokens
Section titled “4. Write with tokens”Select the Show Dialogue node and replace its Text with this:
{target.Name} dines alone tonight, and Torsten carries the cup. You hold {conspirator.Gold} gold.{if conspirator.Gold >= 15} Torsten could be bought.{else} Torsten will not be bought with so little.{end}A token is a subject, a dot and a member in braces. {target.Name} is the target’s name and {conspirator.Gold} is the conspirator’s own Gold. The {if} block shows its words only when the condition holds, and {end} closes it. See Texts, tokens and pacing.
A token that names nothing, such as a typo, is printed as you wrote it. The Studio checks texts and suggests the word you meant.
5. Lock the choice
Section titled “5. Lock the choice”- Under Choices, click Bribe Torsten.
- In Available when, write
conspirator.Gold >= 15. - In Tooltip when unavailable, write
You need at least 15 gold.
Tooltip when unavailable appears once Available when holds a condition. The condition has no braces, because it is a condition, not a text. While it fails, the choice is greyed out and the tooltip says why.
6. Set an objective
Section titled “6. Set an objective”- Drag from the output of Start and add
Set Objective. It folds under Start. - In Objective, write
Poison {target.Name}. You hold {conspirator.Gold} gold.
The line under Start should read as your objective. The tokens are filled in whenever the objective is shown, so the number stays current. See Set Objective.
Save with Cmd+S (Ctrl+S on Windows).
Check that it works
Section titled “Check that it works”Run the scheme with setup. Choose the conspirator you gave 40 gold.
- The dialogue should say you hold 40 gold and that Torsten could be bought. Bribe Torsten is on.
- The Values section of the Run tab should list the Objective, with its text.
- Set the conspirator’s starting Gold to
10and run again. The{else}sentence should show, and Bribe Torsten should be off, with a hover text that starts Not available now.
The test run works on a copy, so the 15 gold you spend is never taken from your database. The run starts each actor with its Starting values. See Test run.
Mistakes and messages
Section titled “Mistakes and messages”- The text shows braces. A token has a typo, or the member is not one the subject has. Compare the words with the table in the texts page.
- A choice is always on. Available when is empty, or it has a condition that is always true.
- Gold is not under EACH ACTOR in the picker. The picker groups variables by owner. Set Belongs To to Each Actor on the Variables page.
Where to go next
Section titled “Where to go next”- Tutorial 4: A wedding and an heir builds a family and a child.
- Conditional choices shows more rules for choices.
- Hide values from players covers who sees a variable in multiplayer.
- Show a value in the UI puts Gold on your own screen.