Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Repeat a text $number times (Harlowe)

Hi all, new to Twine. Have quite a large project made in Harlowe over the past week that I'm happy with, but I'm stumped on one thing.

I want to make a display along the top of some of my scenes, just with a | or similar character printed X number of times to represent how many times the player has to do a thing until the day is over.

So what I need is the function to do something along the lines of (print: "|") and then something to wrap that in, which will repeat it a number of times stored in a $variable. I've looked through the whole of the neocities and there is no description of this sort of feature.

The Javascript function for this on rosettacode.org is something like

console.log("ha".repeat(5)); to get "hahahahaha"


Any ideas?

Comments

  • You basically answered your own question. *smile*

    Try the following:
    (set: $count to 5)
    (set: $output to "|".repeat($count))
    output: $output
    
  • Perfect! Thankyou so much :D
Sign In or Register to comment.