Reputation: 21
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
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
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
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
Reputation: 434
To create a new line use # So for example
To print this:
Hello
World
Use this:
show_message('Hello#World');
Upvotes: 2
Reputation: 1
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
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
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
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