0 votes
by (690 points)
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...

2 Answers

+4 votes
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:


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


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!]


–4 votes
by (6.2k points)

Alright, I'm not trying to be rude here, but variables is an extremely basic thing. The MOST basic thing. It's probably the first thing anyone learns in any coding: the (set:) macro (or whatever it is for every other way of programming). I've said this to new twine people SO MANY TIMES! If you're new, and therefore don't know what you're doing, DON'T ASK A QUESTION HERE. If you are new, then you're questions are most likely gonna be basic stuff like this. Please, if you are new, watch youtube videos, read documentations, actually learn how to twine first. If you have a real problem, check if the question has been asked here before (and this kinda question has been asked SO MANY times), and check if it's been asked on the old forum. THEN, when you finally think you understand stuff, and you have a problem, and you've read and watched all kinda stuff, FINALLy ask here. Asking here should be your LAST RESORT. That's what I did. I joined the forum (the old one) ages after I had started doing twine, because I had an issue I could not find an easy answer to.

Also, as Charlie said, please put your format in the title or your tags of the question. If you don't know what that is, look it up.

by (690 points)

I already figured this out before you said that...

...besides, it was my first experience with programming EVER, so right now the only thing I need help with is the more complicated Macros

by (2.5k points)
Moderators' note: if you start a response with "I'm not trying to be rude here," it's a sign you should take a step away from the keyboard for a little. I understand the frustration, but nonconstructive responses don't help anybody.

If you think a question is a duplicate, best to link to an existing answer (ideally)  or downvote the question and move on.