Howdy, Stranger!

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

[Harlowe] Non collapsing spaces ?

I've programmed a rotating scrolling display:
(set: $message to "Caution!.......")(set: $mh to (font: "Courier New")+(hook: "message"))\
$mh[Message](live: .1s)[(set: $message to $message's (range: 2, length of $message) + $message's 1st)\
(replace: ?message)[(print: " "+$message+")")]]
It works fine when the $message contains no spaces. When it does, Harlowe (or HTML) does it's usual stuff: collapsing them, which leads to some quite unpleasant effects.
I was thinking of using some non-breaking spaces but " " obviously counts as 5 caracters for Harlowe, not one. So they are rotated to. And that's ugly.
What to do? I have no clue. Do you?

Comments

  • edited February 2017
    What version of Harlowe are you using? You should always state the story format you're using and its version, because advice will tend to vary based on that information.

    Anyway. To use the no break space within $message, you'll probably have to use a literal no break space character.

    While you could enter the actual character from your keyboard, if you knew the character code for your OS, I'm not a fan of embedding non-basic whitespace into projects, since you cannot visually distinguish them from other whitespace. It would probably be easier and safer to simply use the Unicode escape notation for the character, which is "\u00a0".

    For example, the following puts a no break space after every period in the message:
    (set: $message to "Caution!\u00a0.\u00a0.\u00a0.\u00a0.\u00a0.\u00a0.\u00a0.\u00a0")
    


    EDIT: Updated this post as your code example initially threw me off.
  • Perfect, I forgot of that. Thanks a lot.
Sign In or Register to comment.