Data Store – Giavapps Game Jolt API

 

About Data Store Functions

 

For more info about Data Store functions please visit the following link: http://gamejolt.com/game-api/doc/data-store

 

Score Functions

 

gj_datastore_fetch_global(string key) Returns data from the Data Store. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/fetch

string key: the key of the data item you’d like to fetch.

 

gj_datastore_fetch_user(string key) Returns data from the Data Store for the user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/fetch

string key: the key of the data item you’d like to fetch.

 

gj_datastore_set_global(string key, string data) Sets data in the Data Store. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/set

string key: the key of the data item you’d like to set.

string data: the data you’d like to set.

 

gj_datastore_set_user(string key, string data) Sets data in the Data Store for the user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/set

string key: the key of the data item you’d like to set.

string data: the data you’d like to set.

 

gj_datastore_update_global(string key, string operation, string value) Updates data in the Data Store. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/update

string key: the key of the data item you’d like to update.

string operation: the operation that you’d like to perform. The mathematic operations are add, subtract, multiply and divide. The string operations are append and prepend.

string value: the value that you’d like to work with on the data store.

 

gj_datastore_update_user(string key, string operation, string value) Updates data in the Data Store for the user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/update

string key: the key of the data item you’d like to update.

string operation: the operation that you’d like to perform. The mathematic operations are add, subtract, multiply and divide. The string operations are append and prepend.

string value: the value that you’d like to work with on the data store.

 

gj_datastore_remove_global(string key) Removes data from the Data Store. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/remove

string key: the key of the data item you’d like to remove.

 

gj_datastore_remove_user(string key) Removes data from the Data Store for the user. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/remove

string key: the key of the data item you’d like to remove.

 

gj_datastore_get_keys_global(string pattern) Returns all the keys in the game’s global Data Store. Only keys with applicable key names will be returned. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/get-keys

string pattern: the pattern to apply to the key names in the data store. The placeholder character for patterns is "*".

 

gj_datastore_get_keys_user(string pattern) Returns all the keys in the game’s user Data Store. Only keys with applicable key names will be returned. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/data-store/get-keys

string pattern: the pattern to apply to the key names in the data store. The placeholder character for patterns is "*".

 

Code Examples

 

Setting Data In The Game’s Global Data Store

 

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_datastore_set_global = –1;//Request for setting data in the Data Store

 

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_datastore_set_global = gj_datastore_set_global("global","data");//Sets data in the Data Store

}
else
{

show_debug_message("THE USER’S CREDENTIALS ARE INVALID!");

}

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

if(gj_result_success())
{

show_debug_message("DATA HAS BEEN SET!");

}
else
{

show_debug_message("DATA HAS NOT BEEN SET!");

}

}

 

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.