Game Jolt API

This extension allows you to easily implement the Game Jolt API using a public domain library.

Blocks

Blocks that the extension uses to send requests to the Game Jolt API.

<On Game Jolt? :: #2F7F6F>

Checks to see if the URL is the Game Jolt website.

Session Blocks

Operating on the game's session.

Set game ID to (0) and private key [private key] :: #2F7F6F

This block is required for all requests to work.


[Open v] session :: #2F7F6F

Opens/closes a game session.

When you login the session is opened automatically.


Ping session :: #2F7F6F

Pings an open session.

When the session is opened it is pinged every 30 seconds automatically.


Set session status to [active v] :: #2F7F6F

Sets the session status to active/idle.


<Session open? :: #2F7F6F>

Checks to see if there is an open session for the user.

User Blocks

Login, logout and fetch users.

Login with [username] and [private token] :: #2F7F6F

This block is required for all user based requests to work.

Requires to not be logged in.


Login automatically :: #2F7F6F

Does automatic login after logout.

Requires to not be logged in.


Autologin available? :: #2F7F6F

Checks to see if the user is logged in on the Game Jolt website and the game is played on Game Jolt.


Logout :: #2F7F6F

Logs out the user, the game session is then closed.

Requires to be logged in.


<Logged in? :: #2F7F6F>

Checks to see if the user is logged in.


Logged in user's username :: #2F7F6F

Returns the logged in user's username.

Requires to be logged in.


Fetch user's [username] by [username v] :: #2F7F6F

Fetches user data based on the user's username or the ID


Fetch logged in user :: #2F7F6F

Fetches logged in user data.

Requires to be logged in.


(Fetched user's [ID v] :: #2F7F6F)

Returns fetched user's data by passed key.


(Fetched user's data in JSON :: #2F7F6F)

Returns fetched user's data in JSON.


Fetch user's friend IDs :: #2F7F6F

Fetches user's friend IDs.

Requires to be logged in.


(Fetched user's friend ID at index (0) :: #2F7F6F)

Returns fetched user's friend ID at passed index.


(Fetched user's friend IDs in JSON :: #2F7F6F)

Returns fetched user's friend IDs in JSON.

Trophy Blocks

Achieve, remove and fetch trophies.

Achieve trophy of ID (0) :: #2F7F6F

Achieves trophy of passed ID.

Requires to be logged in and for the trophy to not be achieved.


Remove trophy of ID (0) :: #2F7F6F

Removes trophy of passed ID.

Requires to be logged in and for the trophy to be achieved.


Fetch trophy of ID (0) :: #2F7F6F

Fetches trophy of passed ID.

Requires to be logged in.


Fetch [all v] trophies :: #2F7F6F

Fetches game trophies:

Requires to be logged in.


(Fetched trophy [ID v] at index (0) :: #2F7F6F)

Returns fetched trophy data at passed index by passed key.


(Fetched trophies in JSON :: #2F7F6F)

Returns fetched trophy data in JSON

Score Blocks

Add score (1) in table of ID (0) with text [1 point] and comment [optional] :: #2F7F6F

Adds a score in table of an ID with a text and an optional comment.

Requires to be logged in.


Add [guest] score (1) in table of ID (0) with text [1 point] and comment [optional] :: #2F7F6F

Adds a score in table of an ID with text and optional comment for the a guest.


Fetch (1) [global v] score/s in table of ID (0) :: #2F7F6F

Fetches global/user scores in table of an ID.

Requires to be logged in.


Fetch (1) [global v] score/s [better v] than (1) in table of ID (0) :: #2F7F6F

Fetches global/user scores better/worse than a value in table of an ID.

Requires to be logged in.


Fetch (1) [guest] score/s in table of ID (0) :: #2F7F6F

Fetches guest's scores in table of an ID.


Fetch (1) [guest] score/s [better v] than (1) in table of ID (0) :: #2F7F6F

Fetched quest's scores better/worse than a value in table of an ID.


(Fetched score [value v] at index (0) :: #2F7F6F)

Returns fetched score data at passed index by passed key.


(Fetched score data in JSON :: #2F7F6F)

Returns fetched score data in JSON.


(Fetched rank of (1) in table of ID (0) :: #2F7F6F)

Fetches and returns a rank of passed value in table of passed ID.


Fetch score tables :: #2F7F6F

Fetches score tables.


(Fetched table [ID v] at index (0) :: #2F7F6F)

Returns fetched table data at passed index by passed key.


(Fetched tables in JSON :: #2F7F6F)

Returns fetched tables in JSON.

Data Storage Blocks

Operate on Game Jolt's cloud variables.

Set [global v] data at [key] to [data] :: #2F7F6F

Sets global/user data at passed key to passed data.

User option requires to be logged in.


(Fetched [global v] data at [key] :: #2F7F6F)

Fetches and returns global/user data at passed key.

User option requires to be logged in.


Update [global v] data at [key] by [adding v](1) :: #2F7F6F

Updates global/user data at key by operation with value.

User option requires to be logged in.


Remove [global v] data at [key] :: #2F7F6F

Removes global/user data at passed key.

User option requires to be logged in.


Fetch all [global v] keys :: #2F7F6F

Fetches all global/user keys.

User option requires to be logged in.


Fetch [global v] keys matching with [*] :: #2F7F6F

Fetches global/user keys matching with passed pattern.

User option requires to be logged in.


(Fetched key at index (0) :: #2F7F6F)

Returns fetched key at passed index.


(Fetched keys in JSON :: #2F7F6F)

Returns fetched keys in JSON.

Time Blocks

Track server's time.

Fetch server's time :: #2F7F6F

Fetches server's time.


(Fetched server's [timestamp v] :: #2F7F6F)

Returns fetched server's time data by passed key.


(Fetched server's time in JSON :: #2F7F6F)

Returns fetched server's time data in JSON.

Batch Blocks

Fetch more data per request.

Add [data-store/set] request with [{"key":"key", "data":"data"}] to batch :: #2F7F6F

Adds passed arguments to the batch.


Clear batch :: #2F7F6F

Clears the batch of all sub requests.


(Batch in JSON :: #2F7F6F)

Returns the batch in JSON.


Fetch batch [sequentially v] :: #2F7F6F

Fetches the batch.

You can call the batch request in different ways:

User based sub requests require to be logged in.


(Fetched batch data in JSON :: #2F7F6F)

Returns fetched batch data in JSON.

Debug Blocks

Blocks used for debugging.

Turn debug mode [off v] :: #2F7F6F

Turns debug mode on/off.


<In debug mode? :: #2F7F6F>

Checks to see if debug mode is on.


(Last API error :: #2F7F6F)

Returns the last API error.

Handling Common Errors

Handling commonly encountered errors.

// Error: The game ID you passed in does not point to a valid game.

This error occurs when the game ID you set is invalid.

Handling

This error can be avoided by using this block:

Set game ID to [0] and private key to [private key] :: #2F7F6F

// Error: The signature you entered for the request is invalid.

This error occurs when the private key you set is invalid.

Handling

This error can be avoided by using this block:

Set game ID to [0] and private key to [private key] :: #2F7F6F

// Error: No user logged in.

This error occurs when no user is logged in.

Handling

This error can be avoided with a manual login option.

when flag clicked if <not<Autologin available? :: #2F7F6F>> then ask [login or continue as guest?] and wait if <(answer) = [login]> then ask [enter your username] and wait set [username v] to (answer) ask [enter your private game token] and wait set [private game token v] to (answer) Login with (username :: variables) and (private game token) :: #2F7F6F end end

// Error: No such user with the credentials passed in could be found.

This error occurs when manual login failed to recognize the user credentials you passed in.

Handling

This error can be avoided by modifying the previous example to try again after a failed login attempt.

when flag clicked if <not<Autologin available? :: #2F7F6F>> then ask [login or continue as guest?] and wait if <(answer) = [login]> then repeat until <Logged in? :: #2F7F6F> ask [enter your username] and wait set [username v] to (answer) ask [enter your private game token] and wait set [private game token v] to (answer) Login with (username :: variables) and (private game token) :: #2F7F6F end end end

// Error: Data not found. // Error: Data at such index not found.

These errors occur when you are trying to access non-existent data.