0 votes
by (270 points)

Hi there, 

I am trying to build a game where the player can explore a world in three different time periods: past, present and future. So the player can switch, at any time, from one period to another, while investigating the world. 

I am using Twine 2.2.1 and harlowe 2.1.0.

Each passage would consist of a description of the place and, below, an area with three links to navigate time. Check here for a preview:

https://www.dropbox.com/s/dtv5zl7ksp19der/Twine-SpaceTime.png?dl=0

If the player clicks one of the "time" links, he will be transported to that same passage in that new period: past, present or future.

I am trying to implement it like this:

1. I gave each place in the world three different passages. For instance:

room 211 - past
room 211 - present
room 211 - future

2. I created a passage called "Navigation", that I call in each world passage via the (display: ) to create the navigation area with three columns, centered. Its contents are:

=><=

|==

(link: "Past")[]	

==|==

(link: "Present")[]	

==|

(link: "Future")[]

 

So now, comes the trick part. How can I make the links "Past", "Present", "Future", move the player to the correct new passage, i.e. If the player is in room 211 in the past and he clicks the "Future" link, he should go to the passage "room 211 - future". How can I create a dynamic linking system for the navigation area?

I thought of doing it like this:

1. I could grab the current passage name with (set: $currentpassageName to (passage:)'s name), which would give a variable with the value, for instance, "room 211 - past"

2. Strip it of the text after the dash, which contains the time information. In this example, it would be "past". I would then have a variable name called "room 211 -".

3. Finally, I could complete the (link: ) macro like this:

(link: "Future")[(go-to: (passage:)'s name + " future")]

The problem is that I don't know how to do step 2. Can anyone help me? Is it possible to do it with regular harlowe operations?

Thanks!

José

1 Answer

0 votes
by (270 points)
edited by

I've solved it!! So, starting from the example above, where I'm in "Room 211 - past" and what to move the player to "Room 211 - future":

1. I grab the current passage's name:

(set: $currentPassageName to (passage:)'s name)

2. I divide the name of the passage into separate words:

(set: $dividedName to (words: $currentPassageName))

3. I remove the unwanted elements from the name:

(set: $baseName to (find: _element where _element is not "-" and is not "past" and is not "future" and is not "present", ...$dividedName))

4. I join the remaining elements into a string, separated by spaces:

(set: $readyName to (text: $baseName.join (" ")))

5. And now I can complete the (link: ) command, like this:

(link: "Future")[(go-to: $readyName + " - future")]

I still need to do some testing with different passage names, but I think this might do the trick.

Hope this helps someone.

José

...