Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b03ef9d
Lily/MoreEvents -- Fix 'when () changed' not affecting clones
SharkPool-SP Jul 15, 2026
04d7aa6
godslayerakp/http -- Correct casting
SharkPool-SP Jul 15, 2026
5dd514c
true-fantom/math -- Use proper casting (where necessary)
SharkPool-SP Jul 15, 2026
cbcff29
true-fantom/network-- Use proper casting
SharkPool-SP Jul 15, 2026
a0308e9
CST1229/images -- Use proper casting
SharkPool-SP Jul 15, 2026
4fdd426
Lily/TempVariables2 -- Fix incorrect cast method
SharkPool-SP Jul 15, 2026
31487f5
Batch update, use correct casting methods
SharkPool-SP Jul 15, 2026
941a011
Deprecate 'sound' extension
SharkPool-SP Jul 15, 2026
34ead52
vercte/dictionaries -- Fix parse accepting arrays and non-objects
SharkPool-SP Jul 15, 2026
66cf989
Skyhigh173/bigint -- Fix bigint parsing and mod
SharkPool-SP Jul 15, 2026
e2786b7
[Automated] Format code
DangoCat Jul 15, 2026
572311a
Lily/LooksPlus -- Prevent layer softlocking
SharkPool-SP Jul 15, 2026
10bd78b
remove boolean cast change
SharkPool-SP Jul 16, 2026
43aa8ca
Refactor 'dict_parse', garbo say sharkpool do
SharkPool-SP Jul 16, 2026
6544de8
[Automated] Format code
DangoCat Jul 16, 2026
039da77
sound.js -- Refactor media player to work with project controls
SharkPool-SP Jul 18, 2026
5083eb5
[Automated] Format code
DangoCat Jul 18, 2026
8a73fa6
bigint -- Fix scientific notation reader issue with decimals
SharkPool-SP Jul 18, 2026
e734571
Http -- Allow loose cast method in parseType
SharkPool-SP Jul 18, 2026
5c08043
BigInt -- Ignore bit numbers when reading sciNotation
SharkPool-SP Jul 18, 2026
1d9a7c6
BigInt -- oops dont replace, substring
SharkPool-SP Jul 18, 2026
a5d7686
typo
SharkPool-SP Jul 18, 2026
f4fba47
[Automated] Format code
DangoCat Jul 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions extensions/CST1229/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

(function (Scratch) {
"use strict";

const Cast = Scratch.Cast;

const QueryImage = {
WIDTH: "width",
HEIGHT: "height",
Expand Down Expand Up @@ -214,7 +217,7 @@
}

async getImage({ IMAGEURL }) {
IMAGEURL = Scratch.Cast.toString(IMAGEURL);
IMAGEURL = Cast.toString(IMAGEURL);
try {
const resp = await Scratch.fetch(IMAGEURL);
const type = resp.headers.get("Content-Type");
Expand Down Expand Up @@ -273,8 +276,8 @@
img.updateVisible(false);
img.skin = this.render._allSkins[IMG];

img.updatePosition([Number(X) || 0, Number(Y) || 0]);
img.updateScale([Number(XSCALE) || 0, Number(YSCALE) || 0]);
img.updatePosition([Cast.toNumber(X), Cast.toNumber(Y)]);
img.updateScale([Cast.toNumber(XSCALE), Cast.toNumber(YSCALE)]);
this.render.penStamp(this.render._penSkinId, drawableID);
} catch (e) {
console.error("Error drawing image:", e);
Expand All @@ -288,7 +291,7 @@

deleteImage({ IMG }) {
try {
IMG = Scratch.Cast.toNumber(IMG);
IMG = Cast.toNumber(IMG);
if (!this.render._allSkins[IMG] || !this.createdImages.has(IMG)) return;

const targetsToReset = [];
Expand Down Expand Up @@ -332,7 +335,7 @@
}

switchToImage({ IMG }, util) {
IMG = Scratch.Cast.toNumber(IMG);
IMG = Cast.toNumber(IMG);
if (!this.render._allSkins[IMG] || !this.validImages.has(IMG)) return;

const drawableID = util.target.drawableID;
Expand All @@ -354,7 +357,7 @@
queryImage({ QUERY, IMG }) {
if (!this.render._allSkins[IMG] || !this.validImages.has(IMG)) return "";

IMG = Scratch.Cast.toNumber(IMG);
IMG = Cast.toNumber(IMG);

let returnValue = 0;
let drawableID = null;
Expand Down
7 changes: 5 additions & 2 deletions extensions/Lily/LooksPlus.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,13 @@
if (!target) {
return;
}

const drawableID = target.drawableID;
const layerOrder = target.getLayerOrder();
const newLayer = args.LAYER - layerOrder;
renderer.setDrawableOrder(drawableID, newLayer, "sprite", true);
const newLayer = Scratch.Cast.toNumber(args.LAYER) - layerOrder;
if (!isNaN(newLayer) && Number.isFinite(newLayer)) {
renderer.setDrawableOrder(drawableID, newLayer, "sprite", true);
}
}

spriteLayerNumber(args, util) {
Expand Down Expand Up @@ -474,7 +477,7 @@
costume.skinId,
Scratch.Cast.toString(content)
);
renderer._allSkins[costume.skinId].differsFromAsset = true;

Check warning on line 480 in extensions/Lily/LooksPlus.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'differsFromAsset' does not exist on type 'Skin'.
} catch (e) {
console.error(e);
}
Expand Down Expand Up @@ -503,7 +506,7 @@
return;
}

if (!renderer._allSkins[costume.skinId].differsFromAsset) {

Check warning on line 509 in extensions/Lily/LooksPlus.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'differsFromAsset' does not exist on type 'Skin'.
return;
}

Expand All @@ -515,7 +518,7 @@
rotationCenterX,
rotationCenterY,
]);
renderer._allSkins[costume.skinId].differsFromAsset = false;

Check warning on line 521 in extensions/Lily/LooksPlus.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'differsFromAsset' does not exist on type 'Skin'.
} catch (e) {
console.error(e);
}
Expand Down
11 changes: 6 additions & 5 deletions extensions/Lily/MoreEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@
class MoreEvents {
constructor() {
// Stop Sign Clicked contributed by @CST1229
runtime.shouldExecuteStopClicked = true;

Check warning on line 179 in extensions/Lily/MoreEvents.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'shouldExecuteStopClicked' does not exist on type 'Runtime'.
runtime.on("BEFORE_EXECUTE", () => {
runTimer++;
runtime.shouldExecuteStopClicked = false;

Check warning on line 182 in extensions/Lily/MoreEvents.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'shouldExecuteStopClicked' does not exist on type 'Runtime'.

runtime.startHats("lmsMoreEvents_forever");
runtime.startHats("lmsMoreEvents_whileTrueFalse");
Expand All @@ -192,17 +192,17 @@
});
runtime.on("PROJECT_STOP_ALL", () => {
runTimer = 0;
if (runtime.shouldExecuteStopClicked)

Check warning on line 195 in extensions/Lily/MoreEvents.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'shouldExecuteStopClicked' does not exist on type 'Runtime'.
queueMicrotask(() =>
runtime.startHats("lmsMoreEvents_whenStopClicked")
);
});
runtime.on("AFTER_EXECUTE", () => {
runtime.shouldExecuteStopClicked = true;

Check warning on line 201 in extensions/Lily/MoreEvents.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'shouldExecuteStopClicked' does not exist on type 'Runtime'.
});
const originalGreenFlag = vm.greenFlag;
vm.greenFlag = function () {
runtime.shouldExecuteStopClicked = false;

Check warning on line 205 in extensions/Lily/MoreEvents.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'shouldExecuteStopClicked' does not exist on type 'Runtime'.
originalGreenFlag.call(this);
};
}
Expand Down Expand Up @@ -551,11 +551,12 @@
}

whenValueChanged(args, util) {
const blockId = util.thread.peekStack();
if (!lastValues[blockId])
lastValues[blockId] = Scratch.Cast.toString(args.INPUT);
if (lastValues[blockId] !== Scratch.Cast.toString(args.INPUT)) {
lastValues[blockId] = Scratch.Cast.toString(args.INPUT);
const cacheId = util.thread.getId();
if (!lastValues[cacheId]) {
lastValues[cacheId] = Scratch.Cast.toString(args.INPUT);
}
if (lastValues[cacheId] !== Scratch.Cast.toString(args.INPUT)) {
lastValues[cacheId] = Scratch.Cast.toString(args.INPUT);
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion extensions/Lily/TempVariables2.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
if (!Object.prototype.hasOwnProperty.call(util.stackFrame, "index")) {
util.stackFrame.index = 0;
}
if (util.stackFrame.index < Number(args.NUM)) {
if (util.stackFrame.index < Scratch.Cast.toNumber(args.NUM)) {
util.stackFrame.index++;
vars[args.VAR] = util.stackFrame.index;
return true;
Expand Down Expand Up @@ -313,6 +313,6 @@
// The expose format follows TurboWarp's convention of `ext_${extensionId}`.
// Expose the extension on runtime for others to use.
const extension = new TempVars();
Scratch.vm.runtime.ext_lmsTempVars2 = extension;

Check warning on line 316 in extensions/Lily/TempVariables2.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'ext_lmsTempVars2' does not exist on type 'Runtime'.
Scratch.extensions.register(extension);
})(Scratch);
58 changes: 32 additions & 26 deletions extensions/Lily/lmsutils.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion extensions/NOname-awa/math-and-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,8 @@
repeat_i_inc >= 0 ? repeat_i <= args.n : repeat_i >= args.n;
repeat_i += repeat_i_inc
) {
repeat_j = String(repeat_j) + String(args.text);
repeat_j =
Scratch.Cast.toString(repeat_j) + Scratch.Cast.toString(args.text);
}
return repeat_j;
}
Expand Down
33 changes: 30 additions & 3 deletions extensions/Skyhigh173/bigint.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
return x;
}
if (typeof x === "string") {
x = x.toLowerCase();

// Try to parse things like '8n'
if (x.charAt(x.length - 1) === "n") {
try {
Expand All @@ -25,13 +27,35 @@
// ignore
}
}

if (x.includes("e") && !x.includes("x")) {
// read scientific notation
const [mantissa, exponentStr] = x.split("e");
const exponent = parseInt(exponentStr, 10);

if (!isNaN(exponent) && exponent >= 0) {
const [integerPart, fractionalPart = ""] = mantissa.split(".");
if (exponent >= fractionalPart.length) {
// Pad with trailing zeros
x =
integerPart +
fractionalPart +
"0".repeat(exponent - fractionalPart.length);
} else {
// Shift decimal point right
x = integerPart + fractionalPart.slice(0, exponent);
}
}
}

// Must remove decimal using string operations. Math.trunc will convert to float
// which ruins the point of using bigints.
const decimalIndex = x.indexOf(".");
const withoutDecimal =
const xWithoutDecimal =
decimalIndex === -1 ? x : x.substring(0, decimalIndex);

try {
return BigInt(withoutDecimal);
return BigInt(xWithoutDecimal);
} catch (e) {
return 0n;
}
Expand Down Expand Up @@ -406,7 +430,10 @@
}
mod({ a, b }) {
if (Number(b) == 0) return "NaN";
return (bi(a) % bi(b)).toString();

const modulo = bi(b);
if (modulo === 0n) return "NaN";
return (bi(a) % modulo).toString();
}

and({ a, b }) {
Expand Down
4 changes: 2 additions & 2 deletions extensions/Skyhigh173/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@

json_array_from({ json }) {
try {
return JSON.stringify(Array.from(String(json)));
return JSON.stringify(Array.from(Scratch.Cast.toString(json)));
} catch {
return "";
}
Expand Down Expand Up @@ -981,7 +981,7 @@
}

json_array_create({ text, d }) {
return JSON.stringify(String(text).split(d));
return JSON.stringify(Scratch.Cast.toString(text).split(d));
}

json_array_join({ json, d }) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/TheShovel/profanity.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
checkProfanity({ TEXT, REPLACEMENT }) {
// Use a function as the second argument so that replacing with "$&" does not allow
// bypass.
return String(TEXT).replace(regex, () => REPLACEMENT);
return Scratch.Cast.toString(TEXT).replace(regex, () => REPLACEMENT);
}
}

Expand Down
Loading