Used for setting a player / bot's body colors + assets.
Used internally by the library to create and distribute Brick Hill legacy client-compatible packets.
This is intended for advanced users, but allows you to have complete control over the client.
The smart-buffer package on npm.
Used for setting or reading object positions / scale / etc.
Used for locking functions until a specified time has passed.
Game.on("playerJoin", (player) => {
player.on("mouseclick", debounce(() => {
console.log("You clicked! But now you can't for 5 seconds.")
}, 5000))
})
Rest
...args: string[]Used for locking functions for a player until a specified time has passed.
let brick = world.bricks.find(b => b.name === "teleporter")
brick.touching(debouncePlayer(p => {
p.setPosition(brick.position)
}, 5000))
Modules in start.js are built in host (outside of the vm). It is highly recommended to use this function to require them in a VM context. If you opt to use require() instead, you may have issues.
Example:
// Inside of start.js: modules: ["discord.js", "fs"]
// Now inside of a sample script:
// You can now use discord.js
let discord = getModule("discord.js")
// Login to a discord account, etc.
discord.login("myToken")
A promisified version of setTimeout, useful for writing timeouts syncronously.
Game.on("playerJoin", async(player) => {
player.message("After 5 seconds, you're gone!")
await sleep(5000)
player.kick("Time's up!")
})
Will eventually contain handy functions. But for now only contains randomHexColor().
Shortcut to world
Contains all the global variables that are copied into the VM.