Apologies if I'm phrasing this in a slightly abstract way.
I have a grid of nine passages (three by three) that each connect to the passages left/right/up/down from them.
Each passage has two pieces of text in them. Is there a way to make my story so that once you've arrived at a passage it plays the first half of the text and if you arrive at the passage again it plays the second half. As it's a grid, with relatively free movement, it wouldn't work to have the passages around each particular one have a set to true command. I might be overthinking this, but any help would be gratefully accepted.
Comments
Harlowe's project overview lists a macro named (passage:) that contains information about the current passage being shown.
The following examples combines these two macros to check if the Reader has visited the current passage before: note: The (history:) macro contains the list of all passages the reader has visited (prior to the one they are currently viewing), in the order they were visited and it may contain the same passage name more than once if the Reader has visited it more than once.
So as the Reader travels through your story the number of items in the (history:) macro get greater and greater, which causes the time taken to determine if the list contains a particular Passage name a little longer each time the list size increases.
Over use of the (history:) macro on story's with very long paths can cause the Reader ability to interact with the story to slowdown.
And also a reminder to always go back to the documentation before asking a question...
You have guessed right, sir! Have I learnt my lesson? Find out on the next exciting Twine Forum Question! (hopefully the answer is yes.)
Also, thanks again.
I see what you did there XD
I've written:
(set: $number to (count: (history:)))
(if: $number is (either: 5,8,13,16)[*You’ve recovered these things,
Do you remember yet?])
The desired effect is that the text will display when the number of passages visited is any of those numbers. It's telling me however that I'm writing both commands wrong. What am I missing?
(set: $number to (count: (history:), (passage:)'s name))
The either macro returns one of it's parameters at random. So it'll choose one of those values at random and check if $number is equal to that. It might be what you want, but I thought I should mention it in case you thought it'd check if $number was equal to any of those numbers.
The last problem is the second close bracket is in the wrong place. It should be written as:
(if: $number is (either: 5,8,13,16))[*You’ve recovered these things,
Do you remember yet?]
Especially highlighting my error of using (either:) in this situation. Is there a way of getting it to check whether $number is equal to any of the numbers in the string?
Two methods to do what you want.
A. Using the or keyword
B. Using an array and the contains keyword.
note: this method should only be used if the are many values to check against, four is normally way below the minimum I would use it for because this method takes time to create the array and time to search the array, so it is generally better to use method A.