Trophy – Giavapps Game Jolt API

 

About Trophy Functions

 

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

 

Trophy Functions

 

gj_trophy_fetch_achieved() Returns only the achieved trophies for the user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/trophies/fetch/

 

gj_trophy_fetch_missed() Returns only trophies the user hasn’t achieved yet. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/trophies/fetch/

 

gj_trophy_fetch_all() Returns all trophies. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/trophies/fetch/

 

gj_trophy_fetch_id(string trophy_id) If you would like to return just one trophy, you may pass the trophy_id with this function. If you do so, only that trophy will be returned in the response. You may also pass multiple trophy_ids as a comma separated list here if you want to return a subset of all the trophies. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/trophies/fetch/

string trophy_id: the id of the trophy that you’d like to fetch.

 

gj_trophy_add_achieved(string trophy_id) Sets a trophy as achieved for a particular user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/trophies/add-achieved/

string trophy_id: the id of the trophy you’d like to add for the user.

 

Code Examples

 

Setting A Trophy As Achieved

 

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_trophy_add_achieved = –1;//Request for setting a trophy as achieved

 

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_trophy_add_achieved = gj_trophy_add_achieved("trophy_id");//Sets the specified trophy as achieved
}
else
{
show_debug_message("THE USER’S CREDENTIALS ARE INVALID!");
}

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

if(gj_result_success())
{
show_debug_message("TROPHY IS ACHIEVED!");
}
else
{
show_debug_message("TROPHY IS NOT ACHIEVED!");
}

}

 

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.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*