• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Tab characters showing up in draw_text?

K

kiki1234

Guest
I'm not sure if this is a bug or not and I can't find it anywhere on the internet.

I'm simply drawing text to the screen as seen below:

upload_2019-1-5_7-22-9.png


but when it renders, it seems the indentation (tab characters) are also being rendered as seen here:

upload_2019-1-5_7-25-33.png

The tutorial I'm following along with does not have the same issue and I'm not sure if it is an issue or just how the @"" thing works.

I'm currently working around by removing the indentation from lines 16-22
 
S

SamSam

Guest
Hi kiki,

@" " is for verbatim string literals so this is how it works. It literally reads your entry, including line breaks and tabs. :)
 
K

kiki1234

Guest
Hi kiki,

@" " is for verbatim string literals so this is how it works. It literally reads your entry, including line breaks and tabs. :)
Thanks for the quick reply!

I decided to use \n to split the lines in my case for consistency's sake. (also cuz it looked strange being the only unindented section)
 
Last edited by a moderator:
L

lindsay

Guest
can you please upload an example? I am having the exact same issue
 
T

Trylon

Guest
can you please upload an example? I am having the exact same issue
GML:
draw_text(room_width/2, 200,
            "Score 1,000 points to win!\n\nUP: move\nLEFT/RIGHT: change direction\nSPACE: shoot\n\n>> PRESS ENTER TO START <<"
        );
 

Yal

šŸ§ *penguin noises*
GMC Elder
@'d string literals will include everything inside them verbatim. Note that the original code example contains tab characters since the string is indented!



If you want to use escape codes you should use regular "" strings (but then you can't embed newlines, you'll need to use \n), if you want to use @"" strings then you shouldn't put tabs in the string unless you want them there.


Also I think escape codes and @"" literals are both a GMS2 addition, they won't work in GMS1?
 
Top