How do I set/create character stats?

I could really use detailed information because I am new to Twine. If possible send an example file for Twine so that I can experiment with it to see how it works.

I'm using Twine 2.1.3 if that matters...

by (8.9k points)

We also need to know which Story Format you're using, since the answers will vary based on that.

Here's how you might do it in Sugarcube:

``````/* Create a character called Grendel */

<<set \$grendel to {}>>

/* Give Grendel a strength of 10 */

<<set \$grendel.str to 10>>

/* Or give Grendel a random strength between 1 and 10>>

<<set \$grendel.str to random(1,10)>>

/* Or give Grendel a strength of 3-18 using 3 six-sided dice */

<<set \$grendel.str to random(1,6) + random(1,6) + random(1,6)>>``````

by (690 points)
What is Sugarcube and how would I use it for my Twine 'Game'?
by (690 points)
Also, for the Story Format, I think it's Harlowe 2.0.1   Unless I'm looking at the wrong thing
by (560 points)

I recommend you take a look at the Twine 2 wiki and Harlowe's manual. Here are the differences between story formats:

https://twinery.org/wiki/twine2:how_to_choose_a_story_format

And here's the manual (pay attention to the "variable" and "(set:)" sections especially):

https://twine2.neocities.org

As for setting character stats i.e. variables in Harlowe, it tends to follow a general format. Use the (set:) macro to store data or assign value to variables, which always begin with a "\$" symbol. So for instance, here is a line assigning a base value of ten to the WORD strength:

``(set: \$strength to 10)``

I can add or subtract to it:

``(set: \$strength to it + 2)``

And here is a simple skill check that sees if the variable exceeds a certain number and displays data accordingly:

``(if: \$strength >= 15)[You lift the enormous boulder!](else:)[You can't lift the boulder!]``

by (6.2k points)