Game Maker Language new line

15.9k views Asked by At

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
8

There are 8 answers

0
Frederik Witte On

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");
1
AudioBubble On

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

0
Michael Todd On

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

0
Delete This Account Please On

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!
0
Aaron H On

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.

0
kikones34 On

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.

0
Tanay Karnik On

To create a new line use # So for example

To print this:

Hello
World

Use this:

show_message('Hello#World');
0
Rob On

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");