PenguinMod isn't letting me make a new extension! Does this mean I reached the extension limit?
if (!Scratch.extensions.unsandboxed) {
alert("This extension needs to be unsandboxed to run!")
return
}
const ExtForge = {
Broadcasts: new function() {
this.raw_ = {};
this.register = (name, blocks) => {
this.raw_[name] = blocks;
};
this.execute = async (name) => {
if (this.raw_[name]) {
await this.raw_[name]();
};
};
},
Variables: new function() {
this.raw_ = {};
this.set = (name, value) => {
this.raw_[name] = value;
};
this.get = (name) => {
return this.raw_[name] ?? null;
}
},
Vector: class {
constructor(x, y) {
this.x = x;
this.y = y;
}
static from(v) {
if (v instanceof ExtForge.Vector) return v
if (v instanceof Array) return new ExtForge.Vector(Number(v[0]), Number(v[1]))
if (v instanceof Object) return new ExtForge.Vector(Number(v.x), Number(v.y))
return new ExtForge.Vector()
}
add(v) {
return new Vector(this.x + v.x, this.y + v.y);
}
set(x, y) {
return new Vector(x ?? this.x, y ?? this.y)
}
},
Utils: {
setList: (list, index, value) => {
[...list][index] = value;
return list;
},
lists_foreach: {
index: [0],
value: [null],
depth: 0
},
countString: (x, y) => {
return y.length == 0 ? 0 : x.split(y).length - 1
}
}
}
class Extension {
getInfo() {
return {
"id": "gearspang",
"name": "Gears",
"color1": "#00b7db",
"blocks": [{
"opcode": "block_56f0ca079b72dfd8",
"text": "gear direction",
"blockType": "reporter",
"arguments": {}
}, {
"opcode": "block_d2cf8fd7e5226344",
"text": "turn gear clockwise [3413e0be0f4ddea6] degrees",
"blockType": "command",
"arguments": {
"3413e0be0f4ddea6": {
"type": "number",
"defaultValue": 15
}
}
}, {
"opcode": "block_c715e8a57fd77527",
"text": "turn gear counterclockwise [2f0a54a4c4dc8f4b] degrees",
"blockType": "command",
"arguments": {
"2f0a54a4c4dc8f4b": {
"type": "number",
"defaultValue": 15
}
}
}, {
"opcode": "block_8f334fcb2b3defce",
"text": "point gear in direction [df252d205f84f98b]",
"blockType": "command",
"arguments": {
"df252d205f84f98b": {
"type": "number",
"defaultValue": 90
}
}
}, {
"opcode": "block_71e67e0004c947e0",
"text": "move gear to x: [e8d0ac2e25e54495] y: [d2468a45af35abb1]",
"blockType": "command",
"arguments": {
"e8d0ac2e25e54495": {
"type": "number",
"defaultValue": 0
},
"d2468a45af35abb1": {
"type": "number",
"defaultValue": 0
}
}
}, {
"opcode": "block_5a986c61e87e6323",
"text": "set gear x to [a64a83e310487248]",
"blockType": "command",
"arguments": {
"a64a83e310487248": {
"type": "number",
"defaultValue": 0
}
}
}, {
"opcode": "block_f93261a93a92b68e",
"text": "set gear y to [7b8fe59abccc7e7b]",
"blockType": "command",
"arguments": {
"7b8fe59abccc7e7b": {
"type": "number",
"defaultValue": 0
}
}
}, {
"opcode": "block_cb1b37dc8cbc7d3f",
"text": "change gear x by [b6c7a24b6a06088f]",
"blockType": "command",
"arguments": {
"b6c7a24b6a06088f": {
"type": "number",
"defaultValue": 10
}
}
}, {
"opcode": "block_7a1f832b325b810a",
"text": "change gear y by [824d726fb5c2e040]",
"blockType": "command",
"arguments": {
"824d726fb5c2e040": {
"type": "number",
"defaultValue": 10
}
}
}, {
"opcode": "block_118b7bea0d29d3e0",
"text": "change by gear x: [ddda75129de20da3] y: [c6805d4e21fccb32]",
"blockType": "command",
"arguments": {
"ddda75129de20da3": {
"type": "number",
"defaultValue": 10
},
"c6805d4e21fccb32": {
"type": "number",
"defaultValue": 10
}
}
}, {
"opcode": "block_aa479d9fa599d8c3",
"text": "gear x",
"blockType": "reporter",
"arguments": {}
}, {
"opcode": "block_0e14a5e33d250e79",
"text": "gear y",
"blockType": "reporter",
"arguments": {}
}, {
"opcode": "block_beb0b0046b996e34",
"text": "move gear [7dad219f2152cfb7] steps",
"blockType": "command",
"arguments": {
"7dad219f2152cfb7": {
"type": "number",
"defaultValue": 10
}
}
}, {
"opcode": "block_623fe95bc56cf249",
"text": "move gear back [660d43b34ac378c7] steps",
"blockType": "command",
"arguments": {
"660d43b34ac378c7": {
"type": "number",
"defaultValue": 10
}
}
}]
}
}
async block_56f0ca079b72dfd8(args) {
return (ExtForge.Variables.get("gear direction"))
}
async block_d2cf8fd7e5226344(args) {
ExtForge.Variables.set("gear direction", (Number(await extension["block_56f0ca079b72dfd8"]({})) + args["3413e0be0f4ddea6"]))
}
async block_c715e8a57fd77527(args) {
ExtForge.Variables.set("gear direction", (Number(await extension["block_56f0ca079b72dfd8"]({})) - null))
}
async block_8f334fcb2b3defce(args) {
ExtForge.Variables.set("gear direction", args["df252d205f84f98b"])
}
async block_71e67e0004c947e0(args) {
ExtForge.Variables.set("gear x", args["e8d0ac2e25e54495"])
ExtForge.Variables.set("gear y", args["d2468a45af35abb1"])
}
async block_5a986c61e87e6323(args) {
ExtForge.Variables.set("gear x", args["a64a83e310487248"])
}
async block_f93261a93a92b68e(args) {
ExtForge.Variables.set("gear y", args["7b8fe59abccc7e7b"])
}
async block_cb1b37dc8cbc7d3f(args) {
await extension["block_5a986c61e87e6323"]({
"a64a83e310487248": (ExtForge.Variables.get("gear x") +
args["b6c7a24b6a06088f"])
})
}
async block_7a1f832b325b810a(args) {
await extension["block_f93261a93a92b68e"]({
"7b8fe59abccc7e7b": (ExtForge.Variables.get("gear y") +
args["824d726fb5c2e040"])
})
}
async block_118b7bea0d29d3e0(args) {
await extension["block_cb1b37dc8cbc7d3f"]({
"b6c7a24b6a06088f": args["ddda75129de20da3"]
}) await extension["block_7a1f832b325b810a"]({
"824d726fb5c2e040": args["c6805d4e21fccb32"]
})
}
async block_aa479d9fa599d8c3(args) {
return (ExtForge.Variables.get("gear x"))
}
async block_0e14a5e33d250e79(args) {
return (ExtForge.Variables.get("gear y"))
}
async block_beb0b0046b996e34(args) {
await extension["block_cb1b37dc8cbc7d3f"]({
"b6c7a24b6a06088f": args["7dad219f2152cfb7"]
})
}
async block_623fe95bc56cf249(args) {
await extension["block_beb0b0046b996e34"]({
"7dad219f2152cfb7": (Number(await extension["block_aa479d9fa599d8c3"]({})) - args["660d43b34ac378c7"])
})
}
}
let extension = new Extension();
// code compiled from extforge
(async () => {
ExtForge.Variables.set("gear direction", Scratch.Cast.toNumber((90)))
ExtForge.Variables.set("gear x", Scratch.Cast.toNumber((0)))
ExtForge.Variables.set("gear y", Scratch.Cast.toNumber((0)))
})();
Scratch.extensions.register(extension);
PenguinMod isn't letting me make a new extension! Does this mean I reached the extension limit?
What I tried to do:
`/*
Created with ExtForge
https://jwklong.github.io/extforge
*/
(async function(Scratch) {
const variables = {};
})(Scratch);`
I AM EXPECTING AN APOLOGY!! 😭😭