Interface VM_GLOBALS

Contains all the global variables that are copied into the VM.

Hierarchy

  • VM_GLOBALS

Properties

AssetDownloader: typeof AssetDownloader
Bot: typeof Bot

Global

Brick: typeof Brick

Global

Game: typeof Game

Global

Outfit: typeof Outfit

Global

Used for setting a player / bot's body colors + assets.

PacketBuilder: typeof PacketBuilder

Global

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.

Sanction: typeof Sanction
SmartBuffer: typeof SmartBuffer

The smart-buffer package on npm.

Team: typeof Team

Global

Tool: typeof Tool

Global

Vector3: typeof Vector3

Global

Used for setting or reading object positions / scale / etc.

debounce: ((callback: ((...args: string[]) => void), delay: number) => void)

Type declaration

    • (callback: ((...args: string[]) => void), delay: number): void
    • Used for locking functions until a specified time has passed.

      Global

      Example

      Game.on("playerJoin", (player) => {
      player.on("mouseclick", debounce(() => {
      console.log("You clicked! But now you can't for 5 seconds.")
      }, 5000))
      })

      Parameters

      • callback: ((...args: string[]) => void)
          • (...args: string[]): void
          • Parameters

            • Rest ...args: string[]

            Returns void

      • delay: number

      Returns void

debouncePlayer: ((callback: ((player: Player, ...args: string[]) => void), delay: number) => void)

Type declaration

    • (callback: ((player: Player, ...args: string[]) => void), delay: number): void
    • Used for locking functions for a player until a specified time has passed.

      Global

      Example

      let brick = world.bricks.find(b => b.name === "teleporter")

      brick.touching(debouncePlayer(p => {
      p.setPosition(brick.position)
      }, 5000))

      Parameters

      • callback: ((player: Player, ...args: string[]) => void)
          • (player: Player, ...args: string[]): void
          • Parameters

            • player: Player
            • Rest ...args: string[]

            Returns void

      • delay: number

      Returns void

getModule: ((module: string) => NodeModule)

Type declaration

    • (module: string): NodeModule
    • 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

      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")

      Parameters

      • module: string

      Returns NodeModule

sleep: Promise<void>

A promisified version of setTimeout, useful for writing timeouts syncronously.

Global

Example

Game.on("playerJoin", async(player) => {
player.message("After 5 seconds, you're gone!")
await sleep(5000)
player.kick("Time's up!")
})
util: Utilities

Global

Will eventually contain handy functions. But for now only contains randomHexColor().

world: World

Global

Shortcut to world