GM:S 1.4 [Tutorial] Automatic Update Checker!

Discussion in 'Tutorials' started by Gamerev147, Sep 23, 2016.

  1. Gamerev147

    Gamerev147 Member

    Joined:
    Sep 12, 2016
    Posts:
    444
    GM Version: Studio Pro
    Target Platform: Windows
    Download: NA (see video)
    Links: NA

    Hello everyone!

    Description:
    This is just a in depth tutorial on how to make a simple object that can download an INI file and check to see if a new version is available. If you have errors, please paste them in the comments or to this thread.

    Thanks!

    Tutorial:
     
    Last edited by a moderator: Sep 23, 2016
    Crashic, Alireza, KurtBlissZ and 3 others like this.
  2. foose

    foose Guest

    Works pretty good. Thanks a lot! This has solved something that I wanted to incorporate into my some of my educational games. I am now ready to go onto bigger and better things. Thanks for keeping open your link! It really helped me to verify that this works.
     
    Gamerev147 likes this.
  3. Gamerev147

    Gamerev147 Member

    Joined:
    Sep 12, 2016
    Posts:
    444
    I'm glad it worked for you! I was able to completely modify this engine to make a professional update checker. So if you take a close look at the code you can do a lot! Good luck!
     
  4. GLaD0S

    GLaD0S Member

    Joined:
    Dec 3, 2017
    Posts:
    2
    Hey, I'm kinda new to Game Maker and wanted to include this in my own App. It seems to work fine, but sometimes, when starting ( and checking for update ) this appears:
    FATAL ERROR in action number 1 of Async Event: HTTP for object Updater:

    file_text_write_string argument 2 incorrect Type ( undefined ) expecting a String ( YYGS )
    at gml_Object_Updater_Other_62

    I honestly were not able to find a difference between your and my code, but here it is:
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    The problem only occurs sometimes and i think it could be related to the internet connection. But it works fine in flight mode...
    Hope you still can reply to this
    Thanks ^^
     
    Last edited: Dec 3, 2017
  5. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,549
    This is the tutorial author's fault for neglecting to check async_load[? "status"]. In adverse connection conditions or when the file is large enough, you will get one or more "progress" HTTP events that carry a status of 1, a loading progress but no content.

    To avoid getting errors from hitting blanks like you did, check both the ID and the status like this:
    Code:
    if (async_load[? "id"] == async_ini) {
      if (async_load[? "status"] == 0) {
        // Only here is it safe to assume the download is successful.
        // Lines 8-11 plus 16-28 in your original HTTP event code go here
      }
    }
    
    Whenever you are dealing with HTTP functions, you must check both async_load[? "id"] AND async_load[? "status"] for expected values. Anything less is asking for trouble down the line.

    PS: Please stop posting code in screenshots. Use [code] and [/code] tags and paste in the code in text.
     
  6. GLaD0S

    GLaD0S Member

    Joined:
    Dec 3, 2017
    Posts:
    2
    Thank you,
    got it to work and now everything is going as it should. And yes from now on i will use
    Code:
     ^^
     
  7. Moises Abraham

    Moises Abraham Member

    Joined:
    Dec 27, 2017
    Posts:
    12
    Thats a very nice feature to have! I would love to have such a thing for android or the other mobile platforms since this could help a developer maintain an anti-pirating system since mobile games are easily breached D:
     
    Gamerev147 likes this.

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