Tagged: variables

Twine for Beginners: Displaying Random Text

Even using only the most basic range of tools, Twine gives you a lot to work with. You can produce a fully featured interactive story with nothing more than plain old hyperlinks, and if you’re willing to sink just a little time into learning how to use variables, you can introduce some very sophisticated adventure game elements with minimal effort. But those tools only take you so far. No matter what you do with them, games produced with only hyperlinks and variables will always be entirely deterministic: the same sequence of actions will always produce the same effect.

That’s actually a perfectly good way to go. Sometimes – if anything most of the time – you want people to know that what happens in the game will be a direct result of what they’ve decided to do. But an element of chance can spice things up, and if the player is going to be coming back to the same passage again and again (maybe it’s a room they pass through several times, or an action they must take repeatedly) then it never hurts to vary the text they see. There’s a really easy way of doing this:

The (either:) Macro:

Simply writing (either: “one thing”, “another”) is enough to display one thing or another. If you don’t have a whole lot of possible options in mind you can just stick this in the story where you want the random text to appear and it’ll do the job nicely.

This looks like a mess, but the text it generates when played is perfectly serviceable. It might look like this:

Continue reading

Twine for Beginners: Using Variables

Back in my first Twine for Beginners tutorial (which I recommend at least taking a glance at before tackling this one), I mentioned that it was possible to do just about anything you see in the classic Fighting Fantasy books using only passages and hyperlinks. These gamebooks use a system of numbered passages and references, and choosing which passage to turn to performs exactly the same function as choosing which hyperlink to click in a Twine game. In addition to these standard choices, however, the passages will occasionally say something like “If you have a dagger, turn to 294. If you do not have a dagger, turn to 334.”

I think if I were going to fight Eyeface McBlubberson or Beardy the Dragon Wizard then I’d probably want something bigger than a dagger, but whatever.

There’s a totally obvious way to do this in Twine, and that’s to directly copy the method used in this Fighting Fantasy book. “[[If you have a dagger, click here]]. [[If you do not have a dagger, click here]]” will do exactly the same job and involves absolutely no Twine know-how that wasn’t covered in my first tutorial. If you’re happy to simply ask the reader to keep track of their previous choices (or note things down on some kind of character/inventory sheet) and don’t fancy reading on, then you can just do that. Continue reading