Using MFGG's Online High Scores System

From Mario Fan Games Galaxy Wiki
Revision as of 02:21, 23 December 2017 by VinnyVideo (talk | contribs) (Created page with "MFGG has an online high scores system for storing record scores. The following documentation is designed for Game Maker 8.0, but because the system is JSON-based, you could proba...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MFGG has an online high scores system for storing record scores. The following documentation is designed for Game Maker 8.0, but because the system is JSON-based, you could probably use it in other game-making development environments.

MFGG Online High Scores in GM 8.0

Step 1: Get the DLL

Download the HTTP DLL.

Step 2: Add the DLL

Add the HTTP DLL to the list of extension packages for your game. Make sure that it's listed in the "Used" column.

Step 3: Create a New Game

Go here and create a new game. Enter your game's name and the password you want to use for generating a key. Be sure to store the password in a safe place - you'll need this if you ever need to retrieve your key.

Step 4: Generate the Key

Copy down the key that's generated. You'll need this to communicate with the server.

Step 5: Create Script for Submitting Scores

In GM, create the following script and name it "scr_submitscores":

key = argument0;
myScore = argument1;
myAux = argument2;

var httprequest, st;
httprequest = httprequest_create();
httprequest_set_post_parameter(httprequest, "secret_key", key);
httprequest_set_post_parameter(httprequest, "name", global.name);
httprequest_set_post_parameter(httprequest, "score", string(myScore));
httprequest_set_post_parameter(httprequest, "aux", string(myAux));
httprequest_connect(httprequest, "http://highscores.mfgg.net/setscore?", true);
while true {
    httprequest_update(httprequest);
    st = httprequest_get_state(httprequest);
    if st=4 or st=5 {
        break;
    }
    sleep(10);
}
if st=5 {
    scr_dialog("Score submission failed.",font1,c_black,c_black,c_white,300);
} else {
    scr_dialog("Score submission successful!",font1,c_black,c_black,c_white,300);
    contents = httprequest_get_message_body(httprequest);
}
httprequest_destroy(httprequest);

Step 6: What's Your Name?

Make sure that there's a name entry prompt somewhere in your game - global.name needs to have a value, since that's the name that will appear next to the high score on the leaderboard.

Step 7: We Have Liftoff!

Now you can add the function that actually connects to the server to submit your scores! Here's an example:

scr_submitscores("key", finalScore, global.auxValue);
  • "key" is the key generated when you create a new game on the MFGG High Scores page. Be sure to include the quotes!
  • finalScore is an example of the variable name that holds the top score - whatever you want to submit to the server.
  • global.auxValue is an example of the variable name that holds extra data about your top score - for example, the character or level you used for gaining the top score. If you don't want to include this information, feel free to set it to 0.[/list]

Terms

Use of the online high score system is free for MFGG members. The system can be used for Mario fangames, non-Mario fangames, and indie games, although we'd prefer that you not use it for commercial purposes. We reserve the right to remove games from the system if they start doing really glitchy things, although that shouldn't be a problem if you follow these directions.