2

I am writing a GML script and wanted to know how to make a message appear on the next line:

ex.

show_message("Hello" + *something* + "World")

outputs:

Hello
World
Rob
  • 4,927
  • 4
  • 26
  • 41
thehollow89
  • 21
  • 1
  • 1
  • 3

8 Answers8

14

For GameMaker: Studio 2, always use \n as new line.

show_debug_message("First Line\nSecond Line");

For earlier releases, always use # as new line.

show_message("First Line#Second Line");
Frederik Witte
  • 936
  • 1
  • 16
  • 31
5

I'm not positive (never used Game Maker before) but the manual appears to state that a # will work (though that may only work for draw_string). You can also try Chr(13) + Chr(10), which are a carriage return and linefeed.

So, you could try:

show_message("Hello#World") 

or

show_message("Hello" + chr(13) + chr(10) +"World") 

From: http://gamemaker.info/en/manual/gmaker

Michael Todd
  • 16,679
  • 4
  • 49
  • 69
3

Despite the other mentioned methods are more "correct", in Game Maker you can also write the new line straight in the code editor:

show_message("Hello
World");

But codes get a bit messy this way.

kikones34
  • 371
  • 9
  • 13
2

To create a new line use # So for example

To print this:

Hello
World

Use this:

show_message('Hello#World');
Tanay Karnik
  • 424
  • 6
  • 19
1

Game Maker 1.4 can use the pound sign for newlines, as well as the linefeed character (chr(10)):

show_debug_message("Hello#World");
show_debug_message("Hello" + chr(10) + "World");

Since GameMakerStudio 2 you can now use escaped characters;

show_debug_message("Hello\nWorld");
show_debug_message("Hello#World"); //Will not work, the pound sign is now literal!
show_debug_message("Hello" + chr(10) + "World");
Rob
  • 4,927
  • 4
  • 26
  • 41
0

Use # to start a new line:

show_message("Hello World!")  

Would come out like this:

Hello World!

However,

show_message("Hello#World!")  

Would come out like this:

Hello
World!
Timtech
  • 1,224
  • 2
  • 19
  • 30
0

As others have stated you can use "string#this is in a new line" If you want to use a hashtag as text and not newline use \#

You can look up more information about strings here.

Adil B
  • 14,635
  • 11
  • 60
  • 78
Aaron H
  • 134
  • 10
-1

Here's another example. Instead of having a message box come up, you could use the function draw_text(x,y,string)

An example of this would be: draw_text(320,320,"Hello World");

Hope this helps