Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Adding a carriage return "\n" in Behavior's Customizable Properties

A topic by bollafa created Aug 30, 2016 Views: 604 Replies: 1
Viewing posts 1 to 2

Hello there! I'm creating a dialog text GUI, ( like in a normal RPG) , and to make things easier I added a variable like so:

class TextBBehavior extends Sup.Behavior {
   DlgMgr :DialogMgr ;
  Message_1 : string;
  awake() {
     this.DlgMgr = new DialogMgr(;
  //  this.DlgMgr.AddMessage(["Who are you?\nLeave this place",75,5000]);
 Sup.log("Sup?" + this.Message_1 + "Let's check this" + 'test\\ntest' +" It is the same oh damn :c");

  update() {

The commented version works fine, but if manually set in the scene manager (in the Behavior's propierties) the text ("Who are you?\nLeave this place") it prints the \n without doing a carriage return, my guess is that the behavior's properties automatically scapes the \n character .

Thanks in advance.

Btw, special thanks for the team that created this great app ,and to the community that helps in improving it :)

(1 edit)

My workaround is to add a preprocessing step. I have, essentially, this:

public message_c: string;
public message: DialogueBox; // text, scroll speed, colors, etc.; doesn't show in scene editor

awake() {
  if (!this.message && !!this.message_c) {
    this.message = new DialogueBox(this.message_c.replace('\\n', '\n'));

This way you can also define your own control codes. For instance, I have one for "make the dialogue box appear all at once rather than scrolling", and another for "split message into multiple dialogue boxes". You should find it pretty straightforward.