How to add line breaks in variables

I want to create a variable with text that stretches across a few lines. I tried to do it like this:
*set variable “some text *line_break some text” but it didn’t work. Does anyone know how to do this?

You can’t add line breaks into variables.

@FairyGodFeather, okay thanks. Just wanted to know if it could be done.

There is no way to do so, *commands cannot be contained withing variable settings, they just will not run.

The only solution is to include two variables with either side of the text around the line break and write it out as such when displaying it.

Is there a reason you want so much information held in a variable? What specifically is it you’re trying to do?

I find Copy+Paste and Find+Replace work for doing something similar. It’s not as neat as being able to do ${variable}.

I suppose you could also resort to *gosub if you’re calling on that variable in a lot of places.

@FairyGodFeather, I have several characters you can play as. Each has a lot of information. I could store each stat in a separate variable, but I wanted to have one variable that would contain the entire character description. I wanted to have the different stats on different lines.

Will the information be called up frequently, or can you just place it in the stat screen?

Personally, if it was a lot of information, I needed on separate lines, which I’d call up multiple times in a scene, I’d use subroutines.

I only need it once, but each character has different information.

You would usually be able to do:
“My name is
John Doe” or similar, it can vary and is usually based on OS, but ChoiceScript seems to strip it down :confused:

I’m with @lackofmops on this, it’s something that would be really useful to have.
I’ve got a hack that does it, but official support is nice.

In the latest version of ChoiceScript, you can put a line break anywhere like[n/]this, and it will display

like
this

2 Likes

@dfabulich, thanks for the help! This discussion can be closed now.

Reopened, as on a very related note, it seems Dan also added support for a multiline text box in the latest version of choicescript.

You can bring one up by adding the word ‘long’ as a second parameter to the input_text command.

*input_text var_name long

When you print a variable with a value set from a multiline box it’ll retain any line breaks etc.

Thought you’d all like to know! :slight_smile:

Awesome sauce :slight_smile: