Utilities

This example will showcase the different utility functions available.

import { Utils } from 'pixelplacejs'
import fs from 'fs'

const CANVAS_ID = 7;
let canvasBuffer: Buffer = Utils.getLatestCanvasPNG(CANVAS_ID);
let pixelplaceColor: number = Utils.getColorFromRGB(255, 255, 255);
let palive: string = Utils.generatePingAlive();

fs.writeFileSync(canvasBuffer, "map.png");

console.log(`White's PixelPlace color ID is: ${pixelplaceColor}`);
console.log(`Valid palive at the current second is ${palive}`);

Last updated

Was this helpful?