Howdy, Stranger!

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

Ignoring spaces?

I'm using things like <<timedreplace>> and <<timedcycle>> to change text around--to do stuff with speech cadence and blinking and stuff like that, and I'm running into a problem where Twine is ignoring spaces. (I'm getting the sense this is some arcane--read: stupid--code-related reason.)

In other words, imagine a motel sign with a broken NO VACANCY sign: The V and the A bulbs are flickering. In theory, this should work:

<<timedcycle .3s>>NO VACANCY<<becomes>>NO  CANCY<<endtimedcycle>>

Essentially, this code is going to alternate the sign between the two states; there are three spaces between "NO" and "CANCY" in the second one. I'm using a fixed-width font, so the latter two spaces should be in the place of the VA.

However, Twine is ignoring the three spaces and giving me only a single space: In other words, it's just outputting "NO CANCY"--one space in between. So my question is, how do I get Twine to realize that I'm not just adding spaces in for my health?

A workaround involves inline CSS. The following *looks* how I want it to:

@color:transparent;VA@@CANCY<;<endtimedcycle>>

This does come off as somewhat ugly and clumsy, but it works, and it might be the most elegant solution that's available at the moment. Anyway, if anyone has any ideas or insight about the spacing issue, I'd appreciate it. Thanks!

Comments

  • Hi,

    I think the problem lies in HTML and not in twine as 'ignoring the whitespace' behavior is 'by design' of the HTML. I would suggest using non-breaking spaces to solve your issue:

    <<timedcycle .3s>>NO VACANCY<<becomes>>NO&nbsp;&nbsp;&nbsp;CANCY<<endtimedcycle>>

    With Regards,
    Binary Adder
  • Thanks! I figured it was some type of deal like that but was having trouble figuring out why--thanks for the help!
  • I guess this is something of a bug in Twine that ought be fixed.

    As an aside, I think the effect you want would look a little classier if you did this:
    <<timedcycle .3s>>NO VACANCY<<becomes>>NO @@opacity:0.1;VA@@CANCY<<endtimedcycle>>
  • You know, in the particular cases I've used it in so far, the straight-blink makes the most sense (and yes, this is going to come with epilepsy warnings up the wazoo), but opacity's one of those things I haven't played around with very much, and it's worth plugging that into the bits I've already done just to see which effect actually does look better. It's a neat trick and I think I could get some use out of it. Thanks for the tip.
Sign In or Register to comment.