0 votes
by (390 points)
edited by
This is something that is not immediately coming out to me, so I thought I'd ask.

 

I'm currently writing in a reasonably chunky bit of code for a rather rudimentary minigame inside my story, which is fair enough. However, to make it easier for me to break it down, I've opted to keep code on separate lines so I can refer to it properly as I go through it.

Unfortunately for me, all of these lines take up written space on the passage so most of my actual prose ends up scrolled way down.

I tried a named hidden hook, but it made the code obsolete.

I know an easy solution is to put it all on one line, but it makes it hard to read. Is there a simple way for me to efficiently save space on the passage?

2 Answers

+2 votes
by (61.3k points)

Place the code between curly braces to suppress line breaks. You can also use a backslash to stop a new line from forming. 

{
(set: $blah to "blah")
(if: $blah is "blah")[
    (set: $blah to "not blah")
](else:)[
    (set: $blah to "yay")
]
} $blah

<!-- or -->

(set: $blah to "blah")\
(if: $blah is "blah")[\
    (set: $blah to "not blah")\
](else:)[\
    (set: $blah to "yay")\
]\
$blah

More info: 

https://twine2.neocities.org/#markup_collapsing-whitespace

https://twine2.neocities.org/#markup_escaped-line-break

I recommend always spacing and indenting your code and using these methods to suppress unwanted white space. Jamming everything onto a single line is messy and a nightmare to edit and debug. 

by (390 points)
Absolutely agree on the messy, one-line stuff. Good to know that there's a quick and easy solution to keep everything nice and separate.

 

Thank you for the prompt response!
0 votes
by (144k points)

Please don't include the application and story format version information in the title of your question as it just make the title longer than needed and it serves no real value, the question tags are the correct way to indicate that information.

I suggest you read about Escaped line break markup and Collapsing whitespace markup in the Harlowe 2 manual, these are what you use to remove unwanted line-breaks from the HTML that is generated based on the content of your Passage.

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...