Game Jolt Separate Library: Installation
Game Jolt Separate Library: Installation
The current library is available from Game Jolt and contains all necessary files.
It is made for browser-based JavaScript applications - for Unity please look at a separate library.
2. include (link) the library into your main HTML-file with <script src="gj-js-
api.js"></script> (or copy & paste the whole code as you like)
Testing
The library may not work properly on a local environment, because some browsers restrict
scripted HTTP requests from a file:/// path.
In this case you have to upload the project to Game Jolt, setup a local server process, or change
the (browser-specific) configuration, to test it.
https://gamejolt.com/api/doc/game/users/
User Functions
GJAPI.UserFetchID (iUserID, pCallback)
GJAPI.UserFetchID(1, function(pResponse)
{
if(!pResponse.users) return;
console.info(pResponse.users[0].username + " - " + pResponse.users[0].developer_description);
});
GJAPI.UserFetchName (sUserName, pCallback)
GJAPI.UserFetchName("CROS", function(pResponse)
{
if(!pResponse.users) return;
console.info(pResponse.users[0].username + " - " + pResponse.users[0].developer_description);
});
GJAPI.UserFetchCurrent (pCallback)
GJAPI.UserFetchCurrent(function(pResponse)
{
if(!pResponse.users) return;
console.info(pResponse.users[0].username + " - " + pResponse.users[0].developer_description);
});
https://gamejolt.com/api/doc/game/trophies/
Trophy Functions
GJAPI.TrophyAchieve (iTrophyID, pCallback)
GJAPI.TrophyFetch (iAchieved, pCallback)
GJAPI.TROPHY_ONLY_ACHIEVED = 1
GJAPI.TROPHY_ONLY_NOTACHIEVED = -1
GJAPI.TROPHY_ALL = 0
GJAPI.TrophyFetch(GJAPI.TROPHY_ALL, function(pResponse)
{
if(!pResponse.trophies) return;
GJAPI.TrophyFetchSingle (iTrophyID, pCallback)
GJAPI.TrophyFetchSingle(1234, function(pResponse)
{
if(!pResponse.trophies) return;
console.info(pResponse.trophies[0].id + " - " + pResponse.trophies[0].title);
});
https://gamejolt.com/api/doc/game/scores/
Score Functions
boolean bOnlyUser - Fetch only score entries from the current main user (GJAPI.SCORE_*)
GJAPI.SCORE_ONLY_USER = true
GJAPI.SCORE_ALL = false
https://gamejolt.com/api/doc/game/data-store/
GJAPI.DATA_STORE_USER = 0
GJAPI.DATA_STORE_GLOBAL = 1
GJAPI.DataStoreGetKeys (iStore, pCallback)
GJAPI.DataStoreGetKeys(GJAPI.DATA_STORE_USER, function(pResponse)
{
if(!pResponse.keys) return;
Miscellaneous
Properties
Read-Only
Read-and-Write
boolean GJAPI.bSessionActive - Set Session Active or Idle (default: true)
Other
Custom Requests
GJAPI.SEND_USER = true
GJAPI.SEND_GENERAL = false
Activity Log
The library logs useful information into the JavaScript console of your browser,
consisting of some basic information, generated requests, and returned data from the server.
Credits
Author: Martin Mauersics
Special Thanks to: David "CROS" DeCarmine, Bruno Assarisse, Jani "JNyknn" Nykänen, Travis
"Clonze" Miller, Garden Variety
This is a 3rd party software which is not directly affiliated with Game Jolt or Lucent Web Creative,
LLC.
Additional Libraries
JavaScript implementation of the RSA Data Security, Inc. MD5 Message Digest Algorithm by Paul
Johnston (http://pajhome.org.uk/)
Software License
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.