Live Replace Text In A Sequence

I would like to know how to do the text shuffle, but in a sequence, so that every 2 seconds the text is replaced with the next text in a sequence.

(live: 2s)[(either: “No.”, “It’s not possible.”, “It can’t be.”, “How?”)]

Philip,

First of all, when you include code in your questions, which is a good thing, you should write or paste it using the </> Preformatted text button between the quote and upload buttons in the top of the reply window, because when you don’t your quotes somehow become curly and don’t work in Twine.

I’ve not found something simple to achieve what you look for. My solution is not elegant, though it should work. In addition to the (live:) macro, I’ve used a named hook, the (rerun:) macro and a (stop:) macro. You can check some descriptions of all these features at https://twine2.neocities.org/.

Here’s a way to get your text in sequence:

{(set: _reaction to (a: "No.", "It’s not possible.", "It can’t be.", "How?"))
(set: _n to 1)
}|reaction>[(print:(_n of _reaction))]

(live: 2s)[(set: _n to it+1)(if: _n is 4)[(stop:)](rerun: ?reaction)]

I tried it out and got the message:

There isn’t a temp variable named_n in this place.

What does that mean?

Did you type or did you copy and paste? If the latter I don’t know why it wouldn’t work as it worked for me. If the former, maybe you made an error?

No, I copied and pasted.

I put dollar signs in front of the variables, and then it worked, but it still doesn’t rerun the way I wanted to, and I think it’s supposed to.

And note, I put the dollar signs in after trying without.

At this point I can’t do anything to help you more if you don’t share your current code. You might also tell your current Harlowe version numbers, is it 3.3.3?

It’s Harlowe 3.2.2

I would suggest to

  • save current project somewhere (another directory not under the Twine directory)
  • upgrade to most recent version of Harlowe (possibly by upgrading Twine)
  • check again, because my code is working with a more recent version of Harlowe than yours.

However every macro I’ve used were already in Harlowe 3.2.2, so it shouldn’t be a problem.

There isn’t any other way of making it work? I know updating would be a good idea, but I think this is the most complicated thing I need to do in my story, and I’ve already almost made it work. I just need a way that makes it repeat.

Though if there isn’t I’ll guess I’ll have to.

*The weird message I keep getting when I put it in as is states that there isn’t a temp variable named _n in this place, but when I write it in it recognizes it.

Is it possible to make it work with a regular variable?

I see you haven’t shared your code. It’s difficult to fix your problem until you share your code, because it might be a version thing or it might be something else in your passage.

If by regular variable you mean a variable starting with a $ instead of a _, it should work just fine.

If by repeat you mean you expect your phrase to continue from “How?” to “No.” and never stop, you may try this:

{(set: _reaction to (a: "No.", "It’s not possible.", "It can’t be.", "How?"))
(set: _n to 1)
}|reaction>[(print:(_n of _reaction))]

(live: 2s)[(set: _n to it+1)(if: _n is 5)[(set: _n to 1)](rerun: ?reaction)]

At this point I would suggest you try this on an otherwise empty passage to know for sure if it works under your current Harlowe version.

2 Likes

Yes! Thank you, it works now.

1 Like