This here is something I'm quite used to using in other programs, especially in BASIC, but it doesn't work in any RM I've ever tried it in, and I'm just curious as to why.
Why does \n not work in text boxes for a new line?
RPG Maker VXAce Supportbecause its for html balise only.
The game run in js and not with balise div and css
This is the VX Ace forum...
As for the original question, it's because the string preconvert routine turned it into "\en", which is not a recognized escape sequence. If you add
Code:
result.gsub!(/\en/) { "\n" }
I don't understand what "text boxes" do you mean.
Is it a message box displayed in game dialogue? or is it the text field where you put text in editor text field?
If it's the former, pretty sure it will display a new line if you put a script call like
Is it a message box displayed in game dialogue? or is it the text field where you put text in editor text field?
If it's the former, pretty sure it will display a new line if you put a script call like
Code:
$game_message.add("line 1\nline2\nline3")
That too. However, if using the default message editor, backslashes are escaped, which leads to processing that results in not seeing newlines.
@cyanic I just saw your edit.
Imo, instead of editing the preconverted the character, why not add more escape character to process?
Something like
Imo, instead of editing the preconverted the character, why not add more escape character to process?
Something like
Code:
def process_escape_character(code, text, pos)
case code.upcase
when 'N'
process_new_line(text, pos) # <--- add this
when 'C'
change_color(text_color(obtain_escape_param(text)))
when 'I'
process_draw_icon(obtain_escape_param(text), pos)
when '{'
make_font_bigger
when '}'
make_font_smaller
end
end
You would be introducing duplicated logic, as Window_Base#process_character already handles the newline.
I know, right? modifying it is not necessary in the first place. So what text boxes in this question?
New lines are handled in the makers by putting in a new line. The escape characters are for other text functions - if you hover over the text entry box, you will see what they all are.
If you want \n to force a new line in a dialogue box, you need to mod the script to look for and handle it.
If you want \n to force a new line in a dialogue box, you need to mod the script to look for and handle it.
Yes, I meant the dialog box that appears in game.
But at any rate, for this to work, I see that I'd have to dig around in the established syntax.
Well, thank you for your help on this.
But at any rate, for this to work, I see that I'd have to dig around in the established syntax.
Well, thank you for your help on this.
Original thread: https://forums.rpgmakerweb.com/threads/why-does-n-not-work-in-text-boxes-for-a-new-line.92235/