0 votes
by (240 points)
I want to have dispayed the amount of, say, gold. How to set the value of a variable and make it appear?

2 Answers

0 votes
by (44.7k points)

I'd recommend at least skimming through the SugarCube documentation, so you know what all it can do for you.

To answer the above question I'd take a look at these sections:

TwineScript - Variables  (explains SugarCube variables)

the <<set>> macro  (explains how to set the value of variables)

Markup - Naked Variables  (explains one way to display the value of variables)

the <<print>> macro  (explains another way to display the value of variables)

The documentation has plenty of examples too, so you'll see it's pretty simple.

Hope that helps!  :-)

0 votes
by (159k points)

You didn't used the Question Tags to stare the name or version number of the Story Format you are using and answers can vary based on that information. If you don't know which Story Format you are using then you're likely using Harlowe 2.x which is the default of the Twine 2.x application.

HiEv has supplied you information about how to do what you asked using the SugarCube 2.x story format, the following explaination does the same for Harlowe 2.x whoes manual can be found here.

Harlowe's (set:) macro and its Variable markup section describe how to assign a value to a variable and one means to display that variable within the current passage, you can also use the (print:) macro to display values.

...