Score – Giavapps Game Jolt API

 

About Score Functions

 

For more info about Score functions please visit the following link: http://gamejolt.com/api/doc/game/scores

 

Score Functions

 

gj_score_fetch_primary(double limit) Retrieves a list of scores from primary score table. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/fetch

double limit: the number of scores you’d like to return. The maximum amount of scores you can retrieve is 100.

 

gj_score_fetch_table(string table_id, double limit) Retrieves a list of scores from a specific score table. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/fetch

string table_id: the id of the high score table that you want to get high scores for.

double limit: the number of scores you’d like to return. The maximum amount of scores you can retrieve is 100.

 

gj_score_fetch_user_primary(double limit) Retrieves a list of scores from primary score table for the user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/fetch

double limit: the number of scores you’d like to return. The maximum amount of scores you can retrieve is 100.

 

gj_score_fetch_user_table(string table_id, double limit) Retrieves a list of scores from a specific score table for the user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/fetch

string table_id: the id of the high score table that you want to get high scores for.

double limit: the number of scores you’d like to return. The maximum amount of scores you can retrieve is 100.

 

gj_score_add_user_primary(string score, double sort, string extra_data) Adds a score for the user in the primary score table. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/add

string score: this is a string value associated with the score. (Example: “100 Points”)

double sort: this is a numerical sorting value associated with the score. All sorting will work off of this number. (Example: 100).

string extra_data: If there’s any extra data you would like to store (as a string), you can use this variable.

 

gj_score_add_user_table(string table_id, string score, double sort, string extra_data) Adds a score for the user in a specific score table. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/add

string table_id: the id of the high score table that you want to submit to.

string score: this is a string value associated with the score. (Example: “100 Points”)

double sort: this is a numerical sorting value associated with the score. All sorting will work off of this number. (Example: 100).

string extra_data: If there’s any extra data you would like to store (as a string), you can use this variable.

 

gj_score_add_guest_primary(string guest, string score, double sort, string extra_data) Adds a score for a guest in the primary score table. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/add

string guest: the guest’s name.

string score: this is a string value associated with the score. (Example: “100 Points”)

double sort: this is a numerical sorting value associated with the score. All sorting will work off of this number. (Example: 100).

string extra_data: If there’s any extra data you would like to store (as a string), you can use this variable.

 

gj_score_add_guest_table(string guest, string table_id, string score, double sort, string extra_data) Adds a score for a guest in a specific score table. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/add

string guest: the guest’s name.

string table_id: the id of the high score table that you want to submit to.

string score: this is a string value associated with the score. (Example: “100 Points”)

double sort: this is a numerical sorting value associated with the score. All sorting will work off of this number. (Example: 100).

string extra_data: If there’s any extra data you would like to store (as a string), you can use this variable.

 

gj_score_tables() Returns a list of high score tables for a game. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/scores/tables

 

Code Examples

 

Adding A Score For The User

 

Create Event

 

gj_init("game_id","private_key");//Initializes Giavapps Game Jolt API
request_user_auth = gj_user_auth("username","user_token");//Authenticates the user
request_score_add_user_primary = –1;//Request for fetching all trophies

 

Game End Event

 

gj_deinit();//Deinitializes Giavapps Game Jolt API

 

Async – HTTP Event

 

if(gj_http_status() != 0){exit;}//Checks if the status is complete

gj_http_result();//Retrieves result data for gj_result_* functions

if(gj_http_id() == request_user_auth)//Checks if the id is equal to the http request id
{

if(gj_result_success())
{
show_debug_message("THE USER’S CREDENTIALS ARE VALID!");
request_score_add_user_primary = gj_score_add_user_primary("100 Points",100,"");//Adds a new score
}
else
{
show_debug_message("THE USER’S CREDENTIALS ARE INVALID!");
}

}
else if(gj_http_id() == request_score_add_user_primary)//Checks if the id is equal to the http request id
{

if(gj_result_success())
{
show_debug_message("SCORE HAS BEEN ADDED!");
}
else
{
show_debug_message("SCORE HAS NOT BEEN ADDED!");
}

}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.