content top

Trophy – Giavapps Game Jolt API

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...

Read More

Session – Giavapps Game Jolt API

Session – Giavapps Game Jolt API

  About Session Functions   For more info about Session functions please visit the following link: http://gamejolt.com/api/doc/game/sessions   Session Functions   gj_session_open() Opens a game session for a particular user. Allows you to tell Game Jolt that a user is playing your game. You must ping the session with gj_session_ping() function to keep it active and you must close it with gj_session_close() function when you’re done with it. Note that you can only have one open session at a time. If you try to open a new session while one is running, the system will close out your current one before opening a new one. Please note that this function also sets the default alarm for session ping (see gj_alarm_id and gj_alarm_time local variables in the Initialization And Deinitialization paragraph). This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/sessions/open   gj_session_ping(double status) Pings an open session to tell the system that it’s still active. If the session hasn’t been pinged within 120 seconds, the system will close the session and you will have to open another one. It’s recommended that you ping every 30 seconds or so to keep the system from cleaning up your session. You can also let the system know whether the player is in an “active” or “idle” state within your game through this call. Please note that this function also resets the default alarm for session ping (see gj_alarm_id and gj_alarm_time local variables in the Initialization And Deinitialization paragraph). This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/sessions/ping/ double status: sets the idle (false) or active (true) status.   gj_session_close() Closes the active session. Please note that this function also stops the default alarm for session ping (see gj_session_alarm and gj_session_time local variables in the Initialization And Deinitialization paragraph).This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/sessions/close/   gj_session_alarm(double alarm_id, double alarm_time) You can use this function to customize the id and time of the Alarm used for pinging an open Session. Please note that this function also stores the alarm_id and alarm_time values into gj_alarm_id and gj_alarm_time local variables. double alarm_id: sets the id of the Alarm. double alarm_time: sets the time of the Alarm (in steps).   Code Examples   Running A Session   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_session_open = –1;//Request for opening a new session request_session_ping = –1;//Request for pinging an open session   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() ==...

Read More

HTTP – Giavapps Game Jolt API

HTTP – Giavapps Game Jolt API

  About HTTP Functions   HTTP functions are ment for easy-access to the various values stored in the default HTTP ds_map (async_load).   HTTP Functions   gj_http_id() Returns the value for the key "id" stored in the default HTTP ds_map (async_load).   gj_http_status() Returns the value for the key "status" stored n the default HTTP ds_map (async_load).   gj_http_status_code() Returns the value for the key "http_status" stored in the default HTTP ds_map (async_load).   gj_http_data_size() Returns the value for the key "contentLength" stored in the default HTTP ds_map (async_load).   gj_http_data_downloaded() Returns the value for the key "sizeDownloaded" stored in the default HTTP ds_map (async_load).   gj_http_result() Retrieves result data for gj_result_* functions from any http request sent to the Game Jolt API. This function returns the value of the specified key ("return") stored in the default HTTP ds_map (async_load).   Code Examples   Authenticating User’s Information   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   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!"); } else { show_debug_message("THE USER’S CREDENTIALS ARE INVALID!"); } }   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...

Read More

Result – Giavapps Game Jolt API

Result – Giavapps Game Jolt API

  About Result Functions   Result functions are ment for processing result data returned from any HTTP request to the Game Jolt API.   Result Functions   Once you called gj_http_result function you can then process the retrieved result data with the following functions:   gj_result_success() Returns true if the current HTTP request succeed and so the success field is equal to "true" or false otherwise.   gj_result_message() Returns the value (a string) of the message field. The server sends a message field when the current HTTP request fails and so the success field is equal to "false".   gj_result_count() Returns the total number of results for the current HTTP request.   gj_result_field_count() Returns the total number of fields (or parameters) available for the current HTTP request.   gj_result_field_name(double field_id) Returns the name of the given field available for the current HTTP request.. double field_id: zero-based index of the field.   gj_result_field_value(double result_id, string field_name) Returns the value (a string) for the specific result and the given field available for the current HTTP request.. double result_id: zero-based index of the result. string field_name: name of the field.   Code Examples   Processing Multiple Results   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_fetch_all = –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_trophy_fetch_all = gj_trophy_fetch_all();//Fetches all trophies } else { show_debug_message("THE USER’S CREDENTIALS ARE INVALID!"); } } else if(gj_http_id() == request_trophy_fetch_all)//Checks if the id is equal to the http request id { if(gj_result_success()) { show_debug_message("TROPHIES HAVE BEEN FETCHED!"); for(var r=0; r<gj_result_count(); r++)//Processes all results { show_debug_message("RESULT ID "+string(r)+":"); for(var f=0; f<gj_result_field_count(); f++)//Processes all fields { show_debug_message(gj_result_field_name(f)+"="+gj_result_field_value(r, gj_result_field_name(f))); } } } else { show_debug_message("TROPHIES HAVE NOT BEEN FETCHED!"); } }   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...

Read More

Score – Giavapps Game Jolt API

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,...

Read More

User – Giavapps Game Jolt API

User – Giavapps Game Jolt API

  About User Functions   For more info about User functions please visit the following link: http://gamejolt.com/api/doc/game/users   User Functions   gj_user_fetch_user_id(string user_id) You must enter an user_id to fetch the user. To fetch multiple users you can pass multiple user_ids as a comma separated list. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/users/fetch/ string user_id: the id of the user that you’d like to fetch.   gj_user_fetch_username(string username) You must enter a username to fetch the user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/users/fetch/ string username: the username of the user that you’d like to fetch. Usernames only contain alphanumeric characters, hyphens and underscores.   gj_user_auth(string username, string user_token) Authenticates the user’s information. This should be done before you make any calls for the user, to make sure that the user’s credentials (username/token) are valid. This function stores username and user_token arguments into gj_username and gj_user_token local variables. You can find your personal user_token on http://gamejolt.com by clicking on your avatar icon located on the top-right corner of the screen and then you will have to select Game Token. This function returns the id of the HTTP request. For more info: http://gamejolt.com/api/doc/game/users/auth/ string username: the username of the user. string user_token: the user’s token.   Code Examples   Authenticating User’s Information   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   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!"); } else { show_debug_message("THE USER’S CREDENTIALS ARE INVALID!"); } }   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...

Read More
content top