thehollow89
thehollow89

Reputation: 21

Game Maker Language new line

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

Upvotes: 2

Views: 16606

Answers (8)

Frederik Witte
Frederik Witte

Reputation: 955

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

Upvotes: 14

Rob
Rob

Reputation: 4987

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

Upvotes: 1

Aaron H
Aaron H

Reputation: 134

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.

Upvotes: 0

Tanay Karnik
Tanay Karnik

Reputation: 434

To create a new line use # So for example

To print this:

Hello
World

Use this:

show_message('Hello#World');

Upvotes: 2

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!

Upvotes: 0

kikones34
kikones34

Reputation: 400

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.

Upvotes: 3

user1163722
user1163722

Reputation:

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

Upvotes: -1

Michael Todd
Michael Todd

Reputation: 17051

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

Upvotes: 5

Related Questions