// Easy Rounding — one-block TurboWarp custom extension // Supports decimal places and significant figures in a single reporter block. (function (Scratch) { 'use strict'; class EasyRounding { getInfo() { return { id: 'easyrounding', name: 'Easy Rounding', color1: '#5B8DEF', color2: '#4778D6', color3: '#3562B8', blocks: [ { opcode: 'roundNumber', blockType: Scratch.BlockType.REPORTER, text: 'round [NUMBER] to [PLACES] [MODE]', arguments: { NUMBER: { type: Scratch.ArgumentType.NUMBER, defaultValue: 123.4567 }, PLACES: { type: Scratch.ArgumentType.NUMBER, defaultValue: 2 }, MODE: { type: Scratch.ArgumentType.STRING, menu: 'MODE_MENU' } } } ], menus: { MODE_MENU: { acceptReporters: true, items: [ 'decimal places', 'significant figures' ] } } }; } roundHalfAwayFromZero(value) { return Math.sign(value) * Math.round(Math.abs(value)); } roundDecimalPlaces(value, places) { if (!Number.isFinite(value)) return value; const factor = Math.pow(10, places); if (!Number.isFinite(factor) || factor === 0) { return value; } return this.roundHalfAwayFromZero(value * factor) / factor; } roundSignificantFigures(value, figures) { if (!Number.isFinite(value) || value === 0) { return value; } const magnitude = Math.floor(Math.log10(Math.abs(value))); const places = figures - 1 - magnitude; return this.roundDecimalPlaces(value, places); } roundNumber(args) { const value = Number(args.NUMBER); const requestedPlaces = Number(args.PLACES); const mode = String(args.MODE || 'decimal places'); if (!Number.isFinite(value)) { return value; } let places = Number.isFinite(requestedPlaces) ? Math.trunc(requestedPlaces) : 0; if (mode === 'significant figures') { // JavaScript numbers are safely represented to about 15 significant digits. places = Math.max(1, Math.min(15, places)); return this.roundSignificantFigures(value, places); } // Decimal places: allow 0–15. places = Math.max(0, Math.min(15, places)); return this.roundDecimalPlaces(value, places); } } Scratch.extensions.register(new EasyRounding()); })(Scratch);
just copy the code in the instructions with crtl + A go to Turbowarp click extensions and look for custom extension then click it and select text then paste the copied code inside the textbox, don't click "run without sandbox" then click load and then you get your extension, @qwerty-the-qwert said I should make this so here it is, don't forget to follow for more stuff like this please it helps a lot