Steam leaderboard upload

eh_azza

Member
Hi, Hoping I am posting in the right area, as I think I might be doing come code wrong, but I have been trying to make it so at the end of my game the score is uploaded to a Steam leaderboard. I am unsure what I am doing wrong, I have followed the documentation in the steam leaderboard section on the GMS2 manual, and copied the code over, but changed it for my game. Put the below in the "Step" event.
GML:
if (global.Steam_loadboard)
    {
    upload_ID = steam_upload_score("Game Scores", global.score);
    if (!upload_ID)
        {
        alarm[0] = room_speed;
        }
    }
and then put the below in the async - steam event
GML:
var type = ds_map_find_value(async_load, "event_type");
if (type == "leaderboard_upload")
    {
    var lb_ID = ds_map_find_value(async_load, "post_id");
    if lb_ID == upload_ID
        {
        var lb_name = ds_map_find_value(async_load, "lb_name");
        var lb_done = ds_map_find_value(async_load, "success");
        var lb_score = ds_map_find_value(async_load, "score");
        var lb_updated = ds_map_find_value(async_load, "updated");
        show_debug_message("leaderboard post id:" + string(lb_ID) + " to lb:" + string(lb_name) + " with score:" + string(lb_score) + " updated=" + string(lb_updated));
        if (lb_done)
            {
            show_debug_message("- Succeeded");
            }
        else
            {
            show_debug_message("- Failed");
            }
        }
    }
but whenever I put the build in steam and try and test it, it doesn't work. I know the game can interact with steam as the achievements work. I've not been able to find a tutorial on this so not sure if Ive missed a fundimental step.

any suggestions would be helpful as not sure what to do now.
 

O.Stogden

Member
Is your alarm 0 event running at all? And is your Steam Leaderboard called exactly "Game Scores" in Steamworks?

Does the "- Succeeded" or "- Failed" debug messages show?

Would help to narrow down the problem. The code itself looks fine, provided Steam has been set-up correctly.
 

eh_azza

Member
Is your alarm 0 event running at all? And is your Steam Leaderboard called exactly "Game Scores" in Steamworks?

Does the "- Succeeded" or "- Failed" debug messages show?

Would help to narrow down the problem. The code itself looks fine, provided Steam has been set-up correctly.
in the alarm event I have
GML:
if (global.Steam_loadboard)
    {
    upload_ID = steam_upload_score("Game Scores", global.score);
    if (!upload_ID)
        {
        alarm[0] = room_speed;
        }
    }
and neither of the messages appear, and yes the leaderboard in the "Name" section not the "community name" section is called Game Scores
 

O.Stogden

Member
Do you have a debug message set to appear in the alarm[0] event? In which case I'm guessing that'll be firing off, which means the game isn't able to contact Steam. Usually that means either the leaderboard name, in this case "Game Scores" hasn't been created on Steamworks, or Steam hasn't been initialized at the start of your game.

I'd just make sure you place some debug messages, to make sure global.Steam_loadboard is set correctly, and to see if the alarm 0 is just retrying over and over due to not being able to either contact Steam or find a valid leaderboard.

Your output console might also be showing errors if you are uploading to a non-existent leaderboard.
 

eh_azza

Member
Do you have a debug message set to appear in the alarm[0] event? In which case I'm guessing that'll be firing off, which means the game isn't able to contact Steam. Usually that means either the leaderboard name, in this case "Game Scores" hasn't been created on Steamworks, or Steam hasn't been initialized at the start of your game.

I'd just make sure you place some debug messages, to make sure global.Steam_loadboard is set correctly, and to see if the alarm 0 is just retrying over and over due to not being able to either contact Steam or find a valid leaderboard.

Your output console might also be showing errors if you are uploading to a non-existent leaderboard.
I realise the issue, I had the wrong steam_api.dll had the 64bit when needed the 32
 
Top