Skip to content
This repository was archived by the owner on Mar 5, 2021. It is now read-only.

Using Blooket.JS

RedYetiDev edited this page Mar 1, 2021 · 3 revisions

Using Blooket.JS

Part 1: Joining

To join a game using Blooket.js, use the following command:

game.join(PIN,"NAME","BLOOK")

This runs the join function, which then connects you to the game.

Part 2: Events

Throughout the game, blooket.js emits events. For more information on these events, see Events at blooket.js.org

Part 3: Answering

To answer a question, catch QuestionStart like so:

game.on("QuestionStart", function() {
  game.answer(game.autocorrect())
})

or

game.on("QuestionStart", function() {
  game.answer(/* Number 1-4 */)
})

Part 4: Gold Quest Only Events

The blooket.js package has 3 events only for Gold Quest. Those events are getgold, swap, and steal.

Part 4A: getgold

The getgold event is emitted after the correct event. It is emitted to tell you to collect your gold. When this event runs, you NEED to handle it with this function game.getgold(/* 1,2 or 3 */). So, a good example is the one below:

game.on("getgold", function() {
game.getgold(1)
})

Part 4B: swap

The swap event is emitted when the prize chosen by game.getgold() is a swap. While handling swap you MUST use the game.swap(/* Player name or example below*/) function, for a better example, see below:

game.on("swap", function(p) {
game.swap(Object.keys(p)[0]) /* This function steals from the first player received from the server. */
})

Blooket.JS Wiki Page

Installing

Setup

Using

Clone this wiki locally