1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Please help me with the "Space Rocks" tutorial

Discussion in 'Programming' started by lindsay, Jul 16, 2019.

  1. lindsay

    lindsay Member

    Joined:
    Jul 5, 2019
    Posts:
    20
    I am almost done(im at part 4 time stamp 8:11 if you want to watch the clip on YouTube) with the Space Rocks tutorial but I have an issue I need help with. I posted this to Reddit and people have responded but it is so confusing to me. I already re-wrote my code and re-checked it for mistakes but can not find any. Since you are not aloud to post screenshots of code in these forums, I ask you guys to go to my Reddit at https://www.reddit.com/r/gamemaker/comments/cdyyy0/need_help_fixing_my_codescreen/ to view my code vs their code and you can also see my problem I am having. Please view it and then come back to this post and comment what I should do.

    ***Videos as well as exact, EASY TO FOLLOW steps greatly appreciated

    Thank You
     
  2. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,536
    Please do not post screenshots of code, and please don't link to a site with screenshots of code, either - it's all in the guidelines. :)

    That aside, you're drawing tab characters. You included them in your string, so of course they will be drawn.

    The reason why this works in the video you're watching is only because the font in use does not have a tab character, and yours does.
     
  3. lindsay

    lindsay Member

    Joined:
    Jul 5, 2019
    Posts:
    20
    if I cant use screenshots of code, how come I found other people on here with code screenshots. That's unfair
     
  4. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    891
    I was thinking at first that the tab character was the 127th character, so I made this to help: https://i.ibb.co/sgp7Nhx/Tab-Character-Help.png
    But I don't actually know if this works cus when I tested it in gms1.4, it doesn't use the same rules with breaks and stuff with strings, but maybe that will still work, if not, I tried to help
     
  5. BaBiA Game Studio

    BaBiA Game Studio Member

    Joined:
    Jun 20, 2016
    Posts:
    826
    Because they have also done it wrong, and have most likely been told not to do it (perhaps not publicly it might have been via PM). You are not being singled out, it is a guideline for all of us to follow.
     
  6. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,536
    That's beside the point... it's to make it as easy for people to help you as it can be, to increase your chances of receiving help. If others are not following this and making it a pain to help them, that's their loss, and certainly nothing you should be inspired by or idolize. That would both make you a part of an ongoing problem and decrease your chances of getting help.

    That aside, did you manage to resolve this? You quoted my entire reply but only responded to a part of it, so I'm unsure if my directions were helpful in any way.
     
  7. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    534
    Joe Ellis likes this.
  8. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    891
    "The reason why this works in the video you're watching is only because the font in use does not have a tab character, and yours does."
    @TsukaYuriko Do you know how to disable the tab character in fonts? or do you need to edit the font and remove it?

    Thanks @EvanSki, that was what I thought too
     
  9. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    534
    I think you would need to edit the range of characters the font stores, but it would just result in ▯, you would physically have to remove the parts where youve tabbed, so to quote someone else that replied on reddit on the
    and seeing as the OP didnt know what a local veritable was as pointed out here
    I shall quote Fryman again
    My point, the OP is better off dropping that @
     
  10. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    891
    Hmm, I'm still abit confused, I thought that the fonts get rendered onto a sprite sheet, so if you exclude that ▯, from the range, it would show up with nothing, but maybe it puts the ▯ in as a default onto every font sprite sheet
     
  11. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,536
    If you disable the tab character, the placeholder character will be used instead. Same problem, different cause. Disabling that one as well can cause other side effects, though. You'd end up with characters that aren't included in your font literally not being visible at all, without any indicator that they're even missing, so I'd advise against doing so.

    To answer the question anyway, the tab character is character 9. Removing that from the font stops it from being rendered, if it is even present in the front in the first place (and not zero-width). Removing the placeholder character (9647) as well stops the placeholder from being rendered instead.


    ... the proper solution would be to simply not have tab characters in your strings in the first place, though. There's no reason to put a wet bandaid around a wound when you can bandage it up properly. The reason why the code in the tutorial that's being discussed works is a pure coincidence which breaks depending on user settings, anyway, and should not be considered a good practice.

    If you need a multi-line string, use the newline escape sequence.
    Code:
    draw_text(x, y, "This is a multi-line string\nwhich will not screw up drawing.");
    If you want it to visually match the drawn text in your code, use string concatenation as well.
    Code:
    draw_text(x, y, "This is a multi-line string\n"
                  + "which will not screw up drawing.");
     
    Joe Ellis likes this.
  12. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    891
    I appreciate your explanation but I'm also confused why you didn't post this at the start of the thread. It would've been one answer and one reply then.
     
    TsukaYuriko likes this.
  13. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,536
    Because I figured a long-winded explanation about possible workarounds won't explain it any better than this. :)
    I intentionally left the solution open as I figured that deriving it from the cause would provide a much better learning experience.

    As you can see, the natural progression of this topic has not only resulted in a suitable solution, but also with an exploration of why the original attempt was flawed at the core and why it shouldn't be considered.
     
    Binsk, woods, Joe Ellis and 1 other person like this.
  14. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    891
    That makes alot of sense, and I love your way of thinking.
    I did think originally, just don't use anything that would cause the tab character to be drawn. I wouldn't, but I thought there was a workaround so I wanted to help lol, I guess this was another time where I'm pointless. No actually, I've got plenty of knowledge and always want to help. It just depends where\when that knowledge is useful
     
    Last edited: Jul 17, 2019
    TsukaYuriko likes this.
  15. lindsay

    lindsay Member

    Joined:
    Jul 5, 2019
    Posts:
    20
    Im using the same font she has
     
  16. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,536
    That is not the problem.

    Focus on the fact that there are tabs in your string. Don't focus on the font, which characters are in the font, which of them aren't, or what the person in the tutorial does.

    Remove the tabs from your string.
     
  17. lindsay

    lindsay Member

    Joined:
    Jul 5, 2019
    Posts:
    20
    I don't have any "tabs" that appear in my code. It only appears like that when I run the game. I don't know how to remove them. I did everything she did
     
  18. BaBiA Game Studio

    BaBiA Game Studio Member

    Joined:
    Jun 20, 2016
    Posts:
    826
    Yes you do (I took this from your linked posts), and I have circled them for you:
    upload_2019-7-18_10-49-51.png
    Delete all of those blanks so that the text is back at the very left of the editor and try again.

    Now, if you have actually changed this already but not shown us the change, then please do so, so that we can look again.
     
  19. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,536
    Doing everything the person in the tutorial does is not always the right thing.


    Then let's do this with screenshots, as that seems to be your favored medium anyway. :)

    [​IMG]
     
  20. curato

    curato Member

    Joined:
    Jun 30, 2016
    Posts:
    324
    Why would a tutorial tell you to do that. It is bad form for just the reasons mentioned above.
     
  21. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,536
    The tutorial doesn't specifically tell you to add tabs to your strings. It just involves carelessly using tabs in a string and the placeholder character happens to not be in the used font resource, so the visual problem that's a result of this combination is never encountered by sheer chance.
     
  22. curato

    curato Member

    Joined:
    Jun 30, 2016
    Posts:
    324
    Never take chance with special characters in your strings.

    Code:
    \n    Newline
    \r    Carriage return
    \b    Backspace (0x08)
    \f    Form Feed (0x0c)
    \t    Horizontal Tab (0x09)
    \v    Vertical Tab (0x0b)
    \\    Backslash itself (0x5c)
    \a    Alert (0x07)
    \u[Hex Digits]    Insert hex unicode character
    \x[Hex Digits]    Insert hex unicode character
    \[Octal Digits]    Insert octal unicode character
     
  23. lindsay

    lindsay Member

    Joined:
    Jul 5, 2019
    Posts:
    20
    Oh okay. Lol thank you for showing me what a tab looks like.
     
  24. lindsay

    lindsay Member

    Joined:
    Jul 5, 2019
    Posts:
    20
    I don't know why she did it. Maybe to center it but she should have done it another way
     
  25. lindsay

    lindsay Member

    Joined:
    Jul 5, 2019
    Posts:
    20
    Thank you to everyone for helping me resolve this issue
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice