GML Basic Coding Help

GMS is attempting to draw the Tab characters I assume.

You could build your text using a different method, use '\n' for newlines, put all your text on one line, separated by new line characters.

Code:
text = "First line\nSecond Line\nThis is the third line"
draw_text(room_width/2, 200, text)
Also, it would be great if you could paste your code as text next time, and put it between code tags, ie.

[ c o d e]

code goes here

[ / c o d e]

(remove the spaces - I had to include spaces or it you wouldn't be able to see the example).
 

FrostyCat

Member
(remove the spaces - I had to include spaces or it you wouldn't be able to see the example).
No, it's 100% possible to show the [code] and [/code] tags without spaces, and the method has been in the clear for years.

If you want to see how it's done, quote this post in the reply field, then select "Use BB Code Editor" (paper with wrench icon at top-right corner).
 

GMWolf

aka fel666
No, it's 100% possible to show the [code] and [/code] tags without spaces, and the method has been in the clear for years.

If you want to see how it's done, quote this post in the reply field, then select "Use BB Code Editor" (paper with wrench icon at top-right corner).
using the [plain] and [/plain] tags?

so [plain] [code] [/code] [/plain]
of course that last example was written like so:
[plain][plain] [code] [/code] [/plain] [/plain]

etc etc

@guitarmonkeys14
The issue does seem to be the tab character.
i would recommend you build you strings like this instead:
Code:
draw_text(x,y, "Score 1000 points to win\n" +
               "UP: move\n"+
               "L/R: Change direction\n"
etc etc
 

Yal

šŸ§ *penguin noises*
GMC Elder
using the [plain] and [/plain] tags?

so [plain] [code] [/code] [/plain]
of course that last example was written like so:
[plain][plain] [code] [/code] [/plain] [/plain]

etc etc

@guitarmonkeys14
The issue does seem to be the tab character.
i would recommend you build you strings like this instead:
Code:
draw_text(x,y, "Score 1000 points to win\n" +
               "UP: move\n"+
               "L/R: Change direction\n"
etc etc
He's not using a fixed-width font, though (looks like Arial to me), this isn't a foolproof method... for instance if every line doesn't start with tabs (e.g you have headings on the left side and numbers/stats on the right of them) this gets unreliable quickly.

Personally, I prefer to solve situations like this by drawing more than one string (at different coordinates). Gives you much more control over how much stuff is aligned. You can also get the size of a string with string_width() and string_height() if you need to align other stuff to the text.
 

GMWolf

aka fel666
He's not using a fixed-width font, though (looks like Arial to me), this isn't a foolproof method... for instance if every line doesn't start with tabs (e.g you have headings on the left side and numbers/stats on the right of them) this gets unreliable quickly.

Personally, I prefer to solve situations like this by drawing more than one string (at different coordinates). Gives you much more control over how much stuff is aligned. You can also get the size of a string with string_width() and string_height() if you need to align other stuff to the text.
But the tabs op was seeing was from the code formating, rather than intentional tabs in the text.
Or rather, that it what it looks like to me.
 
using the [plain] and [/plain] tags?

so [plain] [code] [/code] [/plain]
of course that last example was written like so:
[plain][plain] [code] [/code] [/plain] [/plain]

etc etc

@guitarmonkeys14
The issue does seem to be the tab character.
i would recommend you build you strings like this instead:
Code:
draw_text(x,y, "Score 1000 points to win\n" +
               "UP: move\n"+
               "L/R: Change direction\n"
etc etc
Thank you all for your responses, I definitely found the best option to be setting it up as follows

Code:
draw_text(
           room_width/2, 200,
           "Score 1,000 points to win!\n" +
           "\n" +
           "UP: Move\n" +
           "L/R: Change Direction\n" +
           "SPACE: Shoot\n" +
           "\n" +
           ">> Press ENTER to Start <<\n"
Resulted in this :)))
upload_2019-1-20_19-23-59.png

I appreciate everyone help
 
Top