P
ProjectPurityTeam
Guest
Well, I use Steam leaderboars in my game to upload high scores of the players, but I would like to show these leaderboards inside the game. In this way, players do not have to exit the game to check in what rank they are after beating a record. However, I read Steam API Documentation, and tried it with this example code:
var async_id = ds_map_find_value(async_load, "id");
if async_id == score_get
{
var entries = ds_map_find_value(async_load, "entries");
var map = json_decode(entries);
if ds_map_exists(map, "default")
{
ds_map_destroy(map);
exit;
}
else
{
var list = ds_map_find_value(map, "entries");
var len = ds_list_size(list);
var entry;
for(var i = 0; i < len; i++; )
{
entry = ds_list_find_value(list, i );
steam_name = ds_map_find_value(entry, "name");
steam_score = ds_map_find_value(entry, "score");
steam_rank = ds_map_find_value(entry, "rank");
ds_map_destroy(entry);
}
ds_list_destroy(list)
}
ds_map_destroy(map)
}
I know that to make leaderboards in my game, I will need to download entries in Steam leaderboards and then show them in the screen. However, I do not understand at all this example code with the explanation in Yoyo Games site. Code has to be in a async Steam event or something like that, and entries information is stored in different arrays. If someone knows other way of doing this or undesrtands the code could you help me?
var async_id = ds_map_find_value(async_load, "id");
if async_id == score_get
{
var entries = ds_map_find_value(async_load, "entries");
var map = json_decode(entries);
if ds_map_exists(map, "default")
{
ds_map_destroy(map);
exit;
}
else
{
var list = ds_map_find_value(map, "entries");
var len = ds_list_size(list);
var entry;
for(var i = 0; i < len; i++; )
{
entry = ds_list_find_value(list, i );
steam_name = ds_map_find_value(entry, "name");
steam_score = ds_map_find_value(entry, "score");
steam_rank = ds_map_find_value(entry, "rank");
ds_map_destroy(entry);
}
ds_list_destroy(list)
}
ds_map_destroy(map)
}
I know that to make leaderboards in my game, I will need to download entries in Steam leaderboards and then show them in the screen. However, I do not understand at all this example code with the explanation in Yoyo Games site. Code has to be in a async Steam event or something like that, and entries information is stored in different arrays. If someone knows other way of doing this or undesrtands the code could you help me?