With this function you can create a new leaderboard for your game. The first argument is a string which defines the name of your leaderboard, and this name should be used in any further function calls relating to the leaderboard being created. You can then define the sort method (see the constants listed below) as well as the way in which the information is displayed (again, one of the constants listed below). The function will return a value of -1 if it fails to create the leaderboard or a value greater than -1 if it has succeeded.
NOTE: If you have previously created a leaderboard with the same name (either through code or through your Steam page for the game) this function will be ignored!
Sort Constant Description lb_sort_none No sorting. The information will be displayed "as is". lb_sort_ascending Sort the leaderboard in ascending order. lb_sort_descending Sort the leaderboard in descending order.
Display Constant Description lb_disp_none Show the leaderboard "as is". lb_disp_numeric Show the leaderboard as a numeric display. lb_disp_time_sec Show the leaderboard values as times, with the base value being seconds. lb_disp_time_ms Show the leaderboard values as times, with the base value being milli-seconds.
steam_create_leaderboard(lb_name, sort_method, display_type);
Argument | Description |
---|---|
lb_name | The name of the leaderboard that you are creating (a string). |
sort_method | The method for sorting the leaderboard entries (see constants listed below). |
display_type | The way to display the leaderboard to the user (see constants listed below). |
Real
steam_create_leaderboard("Game Times", lb_sort_ascending, lb_disp_time_sec);
The above code will create a leaderboard called "Game Times", and set it to display the results in ascending order and with a display in seconds.