1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Basic Fundamentals of GML

Discussion in 'Tutorials' started by Beef Erikson, Nov 18, 2016.

  1. Beef Erikson

    Beef Erikson Guest

    GM Version: v1.4.1763
    Target Platform: ALL
    Download: Project Files
    Links: N/A

    Summary:
    Greetings and I hope you find this informative! I created this for reference/learning for myself and figured it may be useful to others for reference/those who are just learning GML.

    Tutorial:
    Once you open the project up in gamemaker (download project above), browse the objects folder.
    All basic programming functions/fundamentals will be listed there.

    Simply open up 'room0' under the folder rooms, navigate to the objects tab,
    select which object you'd like to see an example of and click on the map to place it. At that point, you can run to see the obj and/or scripts in action.

    I highly recommend modifying and playing around with these objects so that you may have a better understanding of what they do.

    I've tried to comment things as best as I can. However, if anyone runs into a question regarding this tutorial, please reply to thread and I'll be sure to help how I can.

    Thanks and code on!
    Beef Erikson

    Edit 11-27-16: Updated files and clarified a few things. Huge thanks to FrostyCat for pointing out all my errors.
     
    Last edited by a moderator: Nov 28, 2016
  2. chance

    chance predictably random Forum Staff Moderator

    Joined:
    Apr 22, 2016
    Posts:
    799
    I approved this... somewhat reluctantly. Because I'm not sure what you're trying to achieve. Or what audience this is aimed at.

    It doesn't qualify as a tutorial, because many of the examples are provided without detailed explanation. And where explanation is provided, it seems to assume the reader already understands that particular programming structure, and just needs an example of how GM employs it.

    That said, some of the examples extend what the manual provides. So they might be useful to intermediate programmers looking for more examples of usage, beyond the manual. So perhaps some users will find it useful.
     
    Last edited: Nov 18, 2016
  3. Beef Erikson

    Beef Erikson Guest

    yeah I wasn't entirely certain how useful this would be to anyone... I wrote that up myself for reference / while I was learning. Figured I'd spread it just in case someone want some clarification on how GM handles certain operations.

    Debated on even posting it but hopefully someone finds it useful!
     
    KingdomOfGamez likes this.
  4. Maximus

    Maximus Guest

    Beef Erikson likes this.
  5. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,612
    I'd wish that when people post guides teaching GML, they'd set better examples and be stricter about their style.
    • In scr_example, you have a script that is meant to take a fixed number of arguments but received them using the array form (argument[0] and argument[1]). This won't enforce the fixed number of arguments.
    • In obj_conditionals, you are teaching single = for comparisons, a clearly deprecated syntax.
      Code:
      varFour = varOne == varTwo || varThree = 8;
    • In obj_scope, you presented instance variables as "available object-wide". Not distinguishing instances from objects causes a large number of easily preventable headaches for novices.
    • In obj_scope2, you relied on instance order to make the reference to global.myVariable work. This is a brittle setup that also causes novices a lot of headaches.
    • In obj_functions, you said show_message() must take strings as arguments, which is no longer true in GMS 1.2+. You also repeatedly passed real arguments to show_message() throughout the project. Don't be a hypocrite.
    • In obj_while_dountil_loops, you compared Boolean values to true and false, a tell-tale sign of rookie work. This just shows how deficient you are about how expressions are evaluated.
    • In obj_2d_array, you left holes in your array declaration but tried accessing them anyways. This is poorly defined behaviour.
    • In obj_alarms, once again you used single = for comparisons, and you started the alarm cycle by hacking it into the Step event instead of just using the Create event.
    • In obj_keyboard_ord, more comparisons to true and false.
     
    Beef Erikson and Maximus like this.
  6. Beef Erikson

    Beef Erikson Guest

    I appreciate the (very helpful) constructive criticism. I'm still rather new to this and am simply trying to share as I learn.
    I'll be updating that file; while I don't necessarily appreciate the tone, I certainly appreciate the time spent correcting me.
     
    Rukola likes this.
  7. Beef Erikson

    Beef Erikson Guest

    Thanks again for all your help. Updated the file since the holiday is over; I believe I fixed everything you covered here. I learned a bit fixing these, so I really do appreciate you taking the time to point all this out to me.
     

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