From 541a78baf106145af248c6d9aa1241bbe08226bb Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:21:04 +0100 Subject: [PATCH 01/23] Add files via upload --- extensions/Lily/Assets.js | 626 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 626 insertions(+) create mode 100644 extensions/Lily/Assets.js diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js new file mode 100644 index 0000000000..a2cc04781a --- /dev/null +++ b/extensions/Lily/Assets.js @@ -0,0 +1,626 @@ +// TheShovel is so epic and cool and awesome + +(function (Scratch) { + 'use strict'; + + const vm = Scratch.vm; + const runtime = vm.runtime; + const Cast = Scratch.Cast; + + class Assets { + getInfo() { + return { + id: 'lmsAssets', + color1: '#5779ca', + color2: '#4e6db6', + color3: '#4661a2', + name: 'Asset Manager', + blocks: [ + { + opcode: 'addSprite', + blockType: Scratch.BlockType.COMMAND, + text: 'add sprite from URL [URL]', + arguments: { + URL: { + type: Scratch.ArgumentType.STRING + } + } + }, + { + opcode: 'addCostume', + blockType: Scratch.BlockType.COMMAND, + text: 'add costume from URL [URL] named [NAME]', + arguments: { + URL: { + type: Scratch.ArgumentType.STRING + }, + NAME: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'costume1' + } + } + }, + { + opcode: 'addSound', + blockType: Scratch.BlockType.COMMAND, + text: 'add sound from URL [URL] named [NAME]', + arguments: { + URL: { + type: Scratch.ArgumentType.STRING + }, + NAME: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'idk sound1?? like-' + } + } + }, + '---', + { + opcode: 'renameSprite', + blockType: Scratch.BlockType.COMMAND, + text: 'rename sprite [TARGET] to [NAME]', + arguments: { + TARGET: { + type: Scratch.ArgumentType.STRING, + menu: 'targets' + }, + NAME: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'Sprite1' + } + } + }, + { + opcode: 'renameCostume', + blockType: Scratch.BlockType.COMMAND, + text: 'rename costume [COSTUME] to [NAME]', + arguments: { + COSTUME: { + type: Scratch.ArgumentType.COSTUME + }, + NAME: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'costume1' + } + } + }, + { + opcode: 'renameSound', + blockType: Scratch.BlockType.COMMAND, + text: 'rename sound [SOUND] to [NAME]', + arguments: { + SOUND: { + type: Scratch.ArgumentType.SOUND + }, + NAME: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'idk sound1?? like-' + } + } + }, + '---', + { + opcode: 'deleteSprite', + blockType: Scratch.BlockType.COMMAND, + text: 'delete sprite [TARGET]', + arguments: { + TARGET: { + type: Scratch.ArgumentType.STRING, + menu: 'targets' + }, + NAME: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'Sprite1' + } + } + }, + { + opcode: 'deleteCostume', + blockType: Scratch.BlockType.COMMAND, + text: 'delete costume [COSTUME]', + arguments: { + COSTUME: { + type: Scratch.ArgumentType.COSTUME + }, + NAME: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'costume1' + } + } + }, + { + opcode: 'deleteSound', + blockType: Scratch.BlockType.COMMAND, + text: 'delete sound [SOUND]', + arguments: { + SOUND: { + type: Scratch.ArgumentType.SOUND + }, + NAME: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'idk sound1?? like-' + } + } + }, + '---', + { + opcode: 'getAllSprites', + blockType: Scratch.BlockType.REPORTER, + text: 'all sprites' + }, + { + opcode: 'getAllCostumes', + blockType: Scratch.BlockType.REPORTER, + text: 'all costumes' + }, + { + opcode: 'getAllSounds', + blockType: Scratch.BlockType.REPORTER, + text: 'all sounds' + }, + { + opcode: 'getSpriteName', + blockType: Scratch.BlockType.REPORTER, + text: 'sprite name' + }, + '---', + { + opcode: 'reorderCostume', + blockType: Scratch.BlockType.COMMAND, + text: 'reorder costume # [INDEX1] to index [INDEX2]', + arguments: { + INDEX1: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 1 + }, + INDEX2: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 2 + } + } + }, + { + opcode: 'reorderSound', + blockType: Scratch.BlockType.COMMAND, + text: 'reorder sound # [INDEX1] to index [INDEX2]', + arguments: { + INDEX1: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 1 + }, + INDEX2: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 2 + } + } + }, + '---', + { + opcode: 'getSoundData', + blockType: Scratch.BlockType.REPORTER, + text: '[ATTRIBUTE] of [SOUND]', + arguments: { + ATTRIBUTE: { + type: Scratch.ArgumentType.STRING, + menu: 'attribute' + }, + SOUND: { + type: Scratch.ArgumentType.SOUND + } + } + }, + { + opcode: 'getCostumeData', + blockType: Scratch.BlockType.REPORTER, + text: '[ATTRIBUTE] of [COSTUME]', + arguments: { + ATTRIBUTE: { + type: Scratch.ArgumentType.STRING, + menu: 'attribute' + }, + COSTUME: { + type: Scratch.ArgumentType.COSTUME + } + } + }, + '---', + { + opcode: 'getCostumeAtIndex', + blockType: Scratch.BlockType.REPORTER, + text: 'name of costume # [INDEX]', + arguments: { + INDEX: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 1 + } + } + }, + { + opcode: 'getSoundAtIndex', + blockType: Scratch.BlockType.REPORTER, + text: 'name of sound # [INDEX]', + arguments: { + INDEX: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 1 + } + } + }, + '---', + { + opcode: 'openProject', + blockType: Scratch.BlockType.COMMAND, + text: 'open project from URL [URL]', + arguments: { + URL: { + type: Scratch.ArgumentType.STRING + } + } + }, + { + opcode: 'getProjectJSON', + blockType: Scratch.BlockType.REPORTER, + text: 'project JSON' + }, + '---', + { + opcode: 'loadExtension', + blockType: Scratch.BlockType.COMMAND, + text: 'load extension from URL [URL]', + arguments: { + URL: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'https://extensions.turbowarp.org/Skyhigh173/json.js' + } + } + }, + { + opcode: 'getLoadedExtensions', + blockType: Scratch.BlockType.REPORTER, + text: 'loaded extensions' + } + ], + menus: { + targets: { + acceptReporters: true, + items: '_getTargets' + }, + attribute: { + acceptReporters: false, + items: ['index', 'dataURI', 'format', 'header', 'asset ID'] + } + } + }; + } + + async addSprite(args, util) { + const url = Cast.toString(args.URL); + if (!(await Scratch.canFetch(url))) return; + + const response = await Scratch.fetch(url); + const json = await response.arrayBuffer(); + await vm.addSprite(json); + } + + // Thank you PenguinMod for providing this code. + addCostume(args, util) { + const targetId = util.target.id; + const assetName = Cast.toString(args.NAME); + return new Promise(resolve => { + Scratch.fetch(args.URL, { + method: 'GET' + }).then(x => x.blob().then(blob => { + if (!( + (this._typeIsBitmap(blob.type)) || + (blob.type === 'image/svg+xml') + )) { + resolve(); + throw new Error(`Invalid mime type: "${blob.type}"`); + } + + const assetType = this._typeIsBitmap(blob.type) ? + runtime.storage.AssetType.ImageBitmap : + runtime.storage.AssetType.ImageVector; + + const dataType = blob.type === 'image/svg+xml' ? + 'svg' : + blob.type.split('/')[1]; + + blob.arrayBuffer() + .then(buffer => { + const data = dataType === 'image/svg+xml' ? + buffer : + new Uint8Array(buffer); + const asset = runtime.storage.createAsset(assetType, dataType, data, null, true); + const name = `${asset.assetId}.${asset.dataFormat}`; + const spriteJson = { + asset: asset, + md5ext: name, + name: assetName + }; + const request = vm.addCostume(name, spriteJson, targetId); + if (request.then) { + request.then(resolve); + } else { + resolve(); + } + }) + .catch(err => { + console.error(`Failed to Load Costume: ${err}`); + console.warn(err); + resolve(); + }); + })); + }); + } + + addSound(args, util) { + const targetId = util.target.id; + const assetName = Cast.toString(args.NAME); + return new Promise((resolve) => { + Scratch.fetch(args.URL) + .then((r) => r.arrayBuffer()) + .then((arrayBuffer) => { + const storage = runtime.storage; + const asset = new storage.Asset( + storage.AssetType.Sound, + null, + storage.DataFormat.MP3, + new Uint8Array(arrayBuffer), + true + ); + resolve(vm.addSound({ + md5: asset.assetId + '.' + asset.dataFormat, + asset: asset, + name: assetName; + }, targetId)); + }).catch(resolve); + }); + } + // End of PenguinMod + + renameSprite(args, util) { + let target = runtime.getTargetById(args.TARGET); + if (!target) target = this._getTargetFromMenu(args.TARGET, util); + if (!target || target.isStage) return; + + const name = Cast.toString(args.NAME); + target.sprite.name = name; + } + + renameCostume(args, util) { + const target = util.target; + const costumeName = Cast.toString(args.COSTUME); + const costumeIndex = target.getCostumeIndexByName(costumeName); + if (costumeIndex < 0) return; + + const name = Cast.toString(args.NAME); + target.renameCostume(costumeIndex, name); + } + + renameSound(args, util) { + const target = util.target; + const soundName = Cast.toString(args.SOUND); + const soundIndex = this._getSoundIndexByName(soundName, util); + if (soundIndex < 0) return; + + const name = Cast.toString(args.NAME); + target.renameSound(soundIndex, name); + } + + deleteSprite(args, util) { + let target = runtime.getTargetById(args.TARGET); + if (!target) target = runtime.getSpriteTargetByName(args.TARGET); + if (!target || target.isStage) return; + + Scratch.vm.deleteSprite(target.id); + } + + deleteCostume(args, util) { + const target = util.target; + const costumeName = Cast.toString(args.COSTUME); + const costumeIndex = target.getCostumeIndexByName(costumeName); + if (costumeIndex < 0) return; + + if (target.sprite.costumes.length > 0) { + target.deleteCostume(costumeIndex); + } + } + + deleteSound(args, util) { + const target = util.target; + const soundName = Cast.toString(args.SOUND); + const soundIndex = this._getSoundIndexByName(soundName, util); + if (soundIndex < 0) return; + + if (target.sprite.sounds.length > 0) { + target.deleteSound(soundIndex); + } + } + + getAllSprites() { + const spriteNames = []; + const targets = Scratch.vm.runtime.targets; + for (const target of targets) { + // People reckoned the stage shouldn't be included + if (target.isOriginal && !target.isStage) { + spriteNames.push(target.sprite.name); + } + } + return JSON.stringify(spriteNames); + } + + getAllCostumes(args, util) { + const costumeNames = []; + const costumes = util.target.sprite.costumes; + for (const costume of costumes) { + costumeNames.push(costume.name); + } + return JSON.stringify(costumeNames); + } + + getAllSounds(args, util) { + const soundNames = []; + const sounds = util.target.sprite.sounds; + for (const sound of sounds) { + soundNames.push(sound.name); + } + return JSON.stringify(soundNames); + } + + getSpriteName(args, util) { + return util.target.sprite.name ?? ''; + } + + reorderCostume(args, util) { + const target = util.target; + const index1 = Cast.toNumber(args.INDEX1); + const index2 = Cast.toNumber(args.INDEX2); + const costumes = target.sprite.costumes; + + if (!(0 < index1 < costumes.length + 1)) return; + if (!(0 < index2 < costumes.length + 1)) return; + + target.reorderCostume(index1 - 1, index2 - 1); + } + + reorderSound(args, util) { + const target = util.target; + const index1 = Cast.toNumber(args.INDEX1); + const index2 = Cast.toNumber(args.INDEX2); + const sounds = target.sprite.sounds; + + if (!(0 < index1 < sounds.length + 1)) return; + if (!(0 < index2 < sounds.length + 1)) return; + + target.reorderSound(index1 - 1, index2 - 1); + } + + getCostumeData(args, util) { + const target = util.target; + const attribute = Cast.toString(args.ATTRIBUTE); + const costumeName = Cast.toString(args.COSTUME); + const costumeIndex = target.getCostumeIndexByName(costumeName); + if (costumeIndex < 0) return ''; + + const costume = target.sprite.costumes[costumeIndex]; + switch (attribute) { + case ('dataURI'): return costume.asset.encodeDataURI(); + case ('index'): return costumeIndex + 1; + case ('format'): return costume.asset.assetType.runtimeFormat; + case ('header'): return costume.asset.assetType.contentType; + case ('asset ID'): return costume.asset.assetId; + } + } + + getSoundData(args, util) { + const target = util.target; + const attribute = Cast.toString(args.ATTRIBUTE); + const soundName = Cast.toString(args.SOUND); + const soundIndex = this._getSoundIndexByName(soundName, util); + if (soundIndex < 0) return ''; + + const sound = target.sprite.sounds[soundIndex]; + switch (attribute) { + case ('dataURI'): return sound.asset.encodeDataURI(); + case ('index'): return soundIndex + 1; + case ('format'): return sound.asset.assetType.runtimeFormat; + case ('header'): return sound.asset.assetType.contentType; + case ('asset ID'): return sound.asset.assetId; + } + } + + getCostumeAtIndex(args, util) { + const target = util.target; + const index = Math.round(Cast.toNumber(args.INDEX - 1)); + const costumes = target.sprite.costumes; + if (!(0 < index < costumes.length)) return; + + return costumes[index].name; + } + + getSoundAtIndex(args, util) { + const target = util.target; + const index = Math.round(Cast.toNumber(args.INDEX - 1)); + const sounds = target.sprite.sounds; + if (!(0 < index < sounds.length)) return; + + return sounds[index].name; + } + + openProject(args) { + const url = Cast.toString(args.URL); + Scratch.fetch(url) + .then(r => r.arrayBuffer()) + .then(buffer => vm.loadProject(buffer)); + } + + getProjectJSON() { + return Scratch.vm.toJSON(); + } + + loadExtension(args) { + const url = Cast.toString(args.URL); + vm.extensionManager.loadExtensionURL(url); + } + + getLoadedExtensions(args) { + return JSON.stringify(Array.from(vm.extensionManager._loadedExtensions.keys())); + } + + /* Utility Functions */ + + _getSoundIndexByName(soundName, util) { + const sounds = util.target.sprite.sounds; + for (let i = 0; i < sounds.length; i++) { + if (sounds[i].name === soundName) { + return i; + } + } + return -1; + } + + // PenguinMod + _typeIsBitmap(type) { + return ( + type === 'image/png' || + type === 'image/bmp' || + type === 'image/jpg' || + type === 'image/jpeg' || + type === 'image/jfif' || + type === 'image/webp' || + type === 'image/gif' + ); + } + + _getTargetFromMenu (targetName, util) { + let target = Scratch.vm.runtime.getSpriteTargetByName(targetName); + if (targetName === '_myself_') target = util.target.sprite.clones[0]; + return target; + } + + _getTargets() { + const spriteNames = []; + const targets = Scratch.vm.runtime.targets; + for (let index = 1; index < targets.length; index++) { + const target = targets[index]; + if (target.isOriginal) { + const targetName = target.getName(); + const targetId = target.id; + spriteNames.push({ + text: targetName, + // We, rather unfortunately, have to rely on Target IDs. This is a terrible idea. + value: targetId + }); + } + } + if (spriteNames.length > 0) { + return spriteNames; + } else { + return ['']; + } + } + + } + Scratch.extensions.register(new Assets()); +})(Scratch); \ No newline at end of file From d9ab5401ad216d5eb710fab0319d703687c963e6 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:22:09 +0100 Subject: [PATCH 02/23] Update index.ejs --- website/index.ejs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/website/index.ejs b/website/index.ejs index d2b314a15f..c3d7d5c759 100644 --- a/website/index.ejs +++ b/website/index.ejs @@ -638,6 +638,12 @@

A bunch of miscellaneous blocks. Created by TheShovel.

+
+ <%- banner('Lily/Assets') %> +

Asset Manager

+

Add, remove, and get data from sprites, costumes and sounds. Created by LilyMakesThings

+
+
<%- banner('Skyhigh173/json') %>

JSON

From 883c0266a70e9fb0cefd98bff58ec9282a549771 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:22:28 +0100 Subject: [PATCH 03/23] Add files via upload --- images/Lily/Assets.svg | 1 + 1 file changed, 1 insertion(+) create mode 100644 images/Lily/Assets.svg diff --git a/images/Lily/Assets.svg b/images/Lily/Assets.svg new file mode 100644 index 0000000000..56e67cdaa6 --- /dev/null +++ b/images/Lily/Assets.svg @@ -0,0 +1 @@ + \ No newline at end of file From 2e909c7167f9b83ec38c18d57733a11bbaab7714 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:23:13 +0100 Subject: [PATCH 04/23] Update README.md --- images/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/images/README.md b/images/README.md index 0600c79be7..bea4750a42 100644 --- a/images/README.md +++ b/images/README.md @@ -252,3 +252,7 @@ All images in this folder are licensed under the [GNU General Public License ver - Created by [@LilyMakesThings](https://github.com/LilyMakesThings). - Dango based on dango from [Twemoji](https://twemoji.twitter.com/) under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). - Background "blobs" by Scratch. + +## Lily/Assets.svg + - Created by [@LilyMakesThings](https://github.com/LilyMakesThings). + - Dango based on dango from [Twemoji](https://twemoji.twitter.com/) under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). From 5643bc36a57aee39346a240b11501c0998da6e86 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:27:49 +0100 Subject: [PATCH 05/23] Update Assets.js --- extensions/Lily/Assets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index a2cc04781a..b8102890aa 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -372,7 +372,7 @@ resolve(vm.addSound({ md5: asset.assetId + '.' + asset.dataFormat, asset: asset, - name: assetName; + name: assetName }, targetId)); }).catch(resolve); }); @@ -623,4 +623,4 @@ } Scratch.extensions.register(new Assets()); -})(Scratch); \ No newline at end of file +})(Scratch); From d2dd81c132805a34894658e2e3e33b565d285610 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:13:59 +0100 Subject: [PATCH 06/23] Update Assets.js --- extensions/Lily/Assets.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index b8102890aa..b4aad45093 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -474,26 +474,26 @@ reorderCostume(args, util) { const target = util.target; - const index1 = Cast.toNumber(args.INDEX1); - const index2 = Cast.toNumber(args.INDEX2); + const index1 = Cast.toNumber(args.INDEX1) - 1; + const index2 = Cast.toNumber(args.INDEX2) - 1; const costumes = target.sprite.costumes; - if (!(0 < index1 < costumes.length + 1)) return; - if (!(0 < index2 < costumes.length + 1)) return; + if (!(0 <= index1 < costumes.length)) return; + if (!(0 <= index2 < costumes.length)) return; - target.reorderCostume(index1 - 1, index2 - 1); + target.reorderCostume(index1, index2); } reorderSound(args, util) { const target = util.target; - const index1 = Cast.toNumber(args.INDEX1); - const index2 = Cast.toNumber(args.INDEX2); + const index1 = Cast.toNumber(args.INDEX1) - 1; + const index2 = Cast.toNumber(args.INDEX2) - 1; const sounds = target.sprite.sounds; - if (!(0 < index1 < sounds.length + 1)) return; - if (!(0 < index2 < sounds.length + 1)) return; + if (!(0 <= index1 < sounds.length)) return; + if (!(0 <= index2 < sounds.length)) return; - target.reorderSound(index1 - 1, index2 - 1); + target.reorderSound(index1, index2); } getCostumeData(args, util) { From 39e54bc3a6711b4a03ac808dee6184a2098d2c96 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:42:49 +0100 Subject: [PATCH 07/23] Return value --- extensions/Lily/Assets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index b4aad45093..9dbc47566a 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -534,7 +534,7 @@ const target = util.target; const index = Math.round(Cast.toNumber(args.INDEX - 1)); const costumes = target.sprite.costumes; - if (!(0 < index < costumes.length)) return; + if (!(0 < index < costumes.length)) return ''; return costumes[index].name; } @@ -543,7 +543,7 @@ const target = util.target; const index = Math.round(Cast.toNumber(args.INDEX - 1)); const sounds = target.sprite.sounds; - if (!(0 < index < sounds.length)) return; + if (!(0 < index < sounds.length)) return ''; return sounds[index].name; } From af47fffe577f0913c455dd30441677d8dd914833 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Mon, 21 Aug 2023 01:10:37 +0100 Subject: [PATCH 08/23] Update Assets.js --- extensions/Lily/Assets.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index 9dbc47566a..89085bd684 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -1,3 +1,7 @@ +// Name: Asset Manager +// ID: lmsAssets +// Description: Add, remove, and get data from sprites, costumes and sounds. + // TheShovel is so epic and cool and awesome (function (Scratch) { From 630e01b30798e55ee6f5f27aacde7fed5ed86b04 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Mon, 21 Aug 2023 01:10:47 +0100 Subject: [PATCH 09/23] Delete index.ejs --- website/index.ejs | 816 ---------------------------------------------- 1 file changed, 816 deletions(-) delete mode 100644 website/index.ejs diff --git a/website/index.ejs b/website/index.ejs deleted file mode 100644 index 47c9c27cfa..0000000000 --- a/website/index.ejs +++ /dev/null @@ -1,816 +0,0 @@ - - - - - - TurboWarp Extension Gallery - - - - - - -
-

- -
TurboWarp Extension Gallery
-

- -

Unlike custom extensions on other websites, these aren't limited by the extension sandbox, so they are a lot more powerful. All extensions are reviewed for safety.

-

- <% if (mode === 'desktop') { %> - To use these extensions in TurboWarp Desktop, hover over the extension and press the add button. - <% } else { %> - To use multiple of these extensions in TurboWarp, hover over the extension and press the button to copy its URL. Then go to the editor, open the extension chooser, then choose the "Custom Extension" option at the bottom, and enter the URL. - <% } %> -

- -
-
These extensions are not compatible with Scratch.
- Projects that use these extensions can't be uploaded to the Scratch website. - They can, however, be used in the packager. -
- -
- <% if (mode === 'desktop') { %> -
Some extensions may be outdated or missing.
- <% - const now = new Date(); - const date = `${now.getFullYear()}-${(now.getMonth() + 1).toString().padStart(2, '0')}-${now.getDate().toString().padStart(2, '0')}`; - %> - For compatibility, security, and offline support, TurboWarp Desktop includes an offline copy of extensions.turbowarp.org from this update's release date (<%= date %>). - Compared to the live website, some extensions may be missing or outdated. - <% } else { %> -
Some extensions may not work in TurboWarp Desktop.
- For compatibility, security, and offline support, each TurboWarp Desktop update contains an offline copy of these extensions from its release date, so some extensions may be outdated or missing. - Use the latest update for best results. - <% } %> -
-
- - <% - const getLinkToRun = (extensionPath) => `https://turbowarp.org/editor?extension=${host}${extensionPath}`; - %> - - <% if (mode === "development") { %> -
-
-

Development Server Tools

-

- Most recently modified extensions: - <% for (const extension of mostRecentExtensions) { %> - <%= extension %> - <% } %> -

-
-
- <% } %> - - - - <% if (mode === 'desktop') { %> - - <% } %> - - <% - const banner = (extensionFile, options = {}) => { - if (extensionFile.endsWith('.js')) { - return `Do not add .js when calling banner(): ${extensionFile}`; - } - const imageSource = extensionImages[extensionFile] ? `images/${extensionImages[extensionFile]}` : 'images/unknown.svg'; - const imageClasses = ["extension-image"]; - if (options.invertDark) imageClasses.push("invert-dark"); - return ` -
- -
- - ${mode === "desktop" ? (` - - `) : (` - Open Extension - `)} -
-
` - }; - - const img = (extensionFile) => { - if (extensionImages[extensionFile]) return `images/${extensionImages[extensionFile]}`; - return 'images/unknown.svg'; - }; - %> - -
-
-
- <%- banner('lab/text') %> -

Animated Text

-

An easy way to display and animate text. Compatible with Scratch Lab's Animated Text experiment.

-
- -
- <%- banner('stretch') %> -

Stretch

-

Stretch sprites horizontally or vertically.

-
- -
- <%- banner('gamepad') %> -

Gamepad

-

Directly access gamepads instead of just mapping buttons to keys.

-
- -
- <%- banner('box2d') %> -

Box2D Physics

-

Two dimensional physics. Originally created by griffpatch.

-
- -
- <%- banner('files') %> -

Files

-

Read and download files.

-
- -
- <%- banner('pointerlock') %> -

Pointerlock

-

Adds blocks for mouse locking. Mouse x & y blocks will report the change since the previous frame while the pointer is locked. Replaces the pointerlock experiment.

-
- -
- <%- banner('cursor') %> -

Mouse Cursor

-

Use custom cursors or hide the cursor. Also allows replacing the cursor with any costume image.

-
- -
- <%- banner('runtime-options') %> -

Runtime Options

-

Get and modify turbo mode, framerate, interpolation, clone limit, stage size, and more.

-
- -
- <%- banner('fetch') %> -

Fetch

-

Make requests to the broader internet.

-
- -
- <%- banner('text') %> -

Text

-

Manipulate characters and text. Originally created by CST1229.

-
- -
- <%- banner('local-storage') %> -

Local Storage

-

Store data persistently. Like cookies, but better.

-
- -
- <%- banner('true-fantom/base') %> -

Base

-

Convert numbers between bases. Created by TrueFantom.

-
- -
- <%- banner('bitwise') %> -

Bitwise

-

Blocks that operate on the binary representation of numbers in computers. Modified by TrueFantom.

-
- -
- <%- banner('Skyhigh173/bigint') %> -

BigInt

-

Math blocks that work on infinitely large integers (no decimals). Created by Skyhigh173.

-
- -
- <%- banner('utilities') %> -

Utilities

-

A bunch of interesting blocks. Originally created by Sheep_maker.

-
- -
- <%- banner('sound') %> -

Sound

-

Play sounds from URLs.

-
- -
- <%- banner('Xeltalliv/clippingblending') %> -

Clipping & Blending

-

Clipping outside of a specified rectangular area and additive color blending. Created by Vadik1.

-
- -
- <%- banner('clipboard') %> -

Clipboard

-

Read and write from the system clipboard.

-
- -
- <%- banner('penplus') %> -

Pen Plus

-

Advanced rendering capabilities. Created by ObviousAlexC.

-
- -
- <%- banner('Lily/Skins') %> -

Skins

-

Have your sprites render as other images or costumes. Created by LilyMakesThings.

-
- -
- <%- banner('obviousAlexC/SensingPlus') %> -

Sensing Plus

-

An extension to the sensing category. Created by ObviousAlexC.

-
- -
- <%- banner('Lily/ClonesPlus') %> -

Clones Plus

-

Expansion of Scratch's clone features. Created by LilyMakesThings.

-
- -
- <%- banner('Lily/LooksPlus') %> -

Looks Plus

-

Expands upon the looks category, allowing you to show/hide, get costume data and edit SVG skins on sprites. Created by LilyMakesThings.

-
- -
- <%- banner('NexusKitten/moremotion') %> -

More Motion

-

More motion-related blocks. Created by NamelessCat.

-
- -
- <%- banner('navigator') %> -

Navigator

-

Details about the user's browser and operating system.

-
- -
- <%- banner('battery') %> -

Battery

-

Access information about the battery of phones or laptops. May not work on all devices and browsers.

-
- -
- <%- banner('TheShovel/CustomStyles') %> -

Custom Styles

-

Customize the appearance of variable monitors and prompts in your project. Created by TheShovel.

-
- -
- <%- banner('mdwalters/notifications') %> -

Notifications

-

Display notifications.

-
- -
- <%- banner('XeroName/Deltatime') %> -

Deltatime

-

Precise delta timing blocks. Created by XeroName.

-
- -
- <%- banner('ar') %> -

Augmented Reality

-

Shows image from camera and performs motion tracking, allowing 3D projects to correctly overlay virtual objects on real world. Created by Vadik1.

-
- -
- <%- banner('encoding') %> -

Encoding

-

Encode and decode strings into their unicode numbers, base 64, or URLs. Created by -SIPC-.

-
- -
- <%- banner('Lily/TempVariables2') %> -

Temporary Variables

-

Create disposable runtime or thread variables. Created by LilyMakesThings.

-
- -
- <%- banner('Lily/MoreTimers') %> -

More Timers

-

Control several timers at once. Created by LilyMakesThings.

-
- -
- <%- banner('clouddata-ping') %> -

Ping Cloud Data

-

Determine whether a cloud variable server is probably up. Originally created by TheShovel.

-
- -
- <%- banner('cloudlink') %> -

Cloudlink

-

Powerful WebSocket extension for Scratch 3. Created by MikeDEV.

-
- -
- <%- banner('true-fantom/network') %> -

Network

-

Various blocks for interacting with the network. Created by TrueFantom.

-
- -
- <%- banner('true-fantom/math') %> -

Math

-

A lot of operators blocks, from exponentiation to trigonometric functions. Created by TrueFantom.

-
- -
- <%- banner('true-fantom/regexp') %> -

RegExp

-

Full interface for working with Regular Expressions. Created by TrueFantom.

-
- -
- <%- banner('true-fantom/couplers') %> -

Couplers

-

A few adapter blocks. Created by TrueFantom.

-
- -
- <%- banner('Lily/AllMenus') %> -

All Menus

-

Special category with every menu from every Scratch category and extensions. Created by LilyMakesThings

-
- -
- <%- banner('Lily/Cast') %> -

Cast

-

Convert values between types. Created by LilyMakesThings

-
- -
- <%- banner('-SIPC-/time') %> -

Time

-

Blocks for interacting with unix timestamps and other date strings. Created by -SIPC-.

-
- -
- <%- banner('-SIPC-/consoles') %> -

Consoles

-

Blocks that interact the JavaScript console built in to your browser's developer tools. Created by -SIPC-.

-
- -
- <%- banner('ZXMushroom63/searchApi') %> -

Search Params

-

Interact with URL search parameters: the part of the URL after a question mark. Created by ZXMushroom63.

-
- -
- <%- banner('TheShovel/ShovelUtils') %> -

ShovelUtils

-

A bunch of miscellaneous blocks. Created by TheShovel.

-
- -
- <%- banner('Lily/Assets') %> -

Asset Manager

-

Add, remove, and get data from sprites, costumes and sounds. Created by LilyMakesThings

-
- -
- <%- banner('Skyhigh173/json') %> -

JSON

-

Handle JSON strings and arrays. Created by Skyhigh173.

-
- -
- <%- banner('cs2627883/numericalencoding') %> -

Numerical Encoding

-

Encode strings as numbers for cloud variables. Created by cs2627883.

-
- -
- <%- banner('DT/cameracontrols') %> -

Camera Controls

-

Move the visible part of the stage. Created by DT.

-
- -
- <%- banner('TheShovel/CanvasEffects') %> -

Canvas Effects

-

Apply visual effects to the entire stage. Created by TheShovel.

-
- -
- <%- banner('Longboost/color_channels') %> -

RGB Channels

-

Only render or stamp certain RGB channels.

-
- -
- <%- banner('CST1229/zip') %> -

Zip

-

Create and edit .zip format files, including .sb3 files. Created by CST1229.

-
- -
- <%- banner('TheShovel/LZ-String') %> -

LZ Compress

-

Compress and decompress text using lz-string.

-
- -
- <%- banner('0832/rxFS2') %> -

rxFS

-

Blocks for interacting with a virtual in-memory filesystem. Created by 0832.

-
- -
- <%- banner('NexusKitten/sgrab') %> -

S-Grab

-

Get information about Scratch projects and Scratch users. Created by NamelessCat.

-
- -
- <%- banner('NOname-awa/graphics2d') %> -

Graphics 2D

-

Blocks to compute lengths, angles, and areas in two dimensions. Created by NOname-awa.

-
- -
- <%- banner('NOname-awa/more-comparisons') %> -

More Comparisons

-

More comparison blocks. Created by NOname-awa.

-
- -
- <%- banner('JeremyGamer13/tween') %> -

Tween

-

Easing methods for smooth animations. Created by JeremyGamer13

-
- -
- <%- banner('rixxyx') %> -

RixxyX

-

Various utility blocks. Created by RixTheTyrunt.

-
- -
- <%- banner('qxsck/data-analysis') %> -

Data Analysis

-

Blocks to compute means, medians, maximums, minimums, variances, and modes. Created by qxsck.

-
- -
- <%- banner('qxsck/var-and-list') %> -

Variable and list

-

More blocks related to variables and lists. Created by qxsck.

-
- -
- <%- banner('vercte/dictionaries') %> -

Dictionaries

-

Use the power of dictionaries in your project. Created by Vercte.

-
- -
- <%- banner('godslayerakp/http') %> -

HTTP

-

Comprehensive extension for interacting with external websites. Created by RedMan13.

-
- -
- <%- banner('Lily/CommentBlocks') %> -

Comment Blocks

-

Annotate your scripts. Created by LilyMakesThings.

-
- -
- <%- banner('veggiecan/LongmanDictionary') %> -

Longman Dictionary

-

Get the definitions of words from the Longman Dictionary in your projects. Created by veggiecan0419

-
- -
- <%- banner('CubesterYT/TurboHook') %> -

TurboHook

-

Allows you to use webhooks. Created by CubesterYT.

-
- -
- <%- banner('Alestore/nfcwarp') %> -

NFCWarp

-

Allows reading data from NFC (NDEF) devices. Only works in Chrome on Android. Created by Alestore Games.

-
- -
- <%- banner('itchio') %> -

itch.io

-

Blocks that interact with the itch.io website. Unofficial. Created by softed.

-
- -
- <%- banner('gamejolt') %> -

GameJolt

-

Blocks that allow games to interact with the GameJolt API. Unofficial. Created by softed.

-
- -
- <%- banner('obviousAlexC/newgroundsIO') %> -

Newgrounds

-

Blocks that allow games to interact with the Newgrounds API. Unofficial. Created by ObviousAlexC.

-
- -
- <%- banner('Lily/McUtils') %> -

McUtils

-

Helpful utilities for any fast food employee. Created by LilyMakesThings.

-
-
-
- - - - From 6b4cc7359ea7795bde5ecc037bdb56da4cf448ce Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Mon, 21 Aug 2023 01:11:48 +0100 Subject: [PATCH 10/23] Update extensions.json --- extensions/extensions.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/extensions.json b/extensions/extensions.json index 7ec0ffa91d..29cced7d9f 100644 --- a/extensions/extensions.json +++ b/extensions/extensions.json @@ -44,6 +44,7 @@ "-SIPC-/consoles", "ZXMushroom63/searchApi", "TheShovel/ShovelUtils", + "Lily/Assets", "Skyhigh173/json", "cs2627883/numericalencoding", "DT/cameracontrols", @@ -69,4 +70,4 @@ "gamejolt", "obviousAlexC/newgroundsIO", "Lily/McUtils" -] \ No newline at end of file +] From 5ba6b1edba830df434aac85cf21026b5a7d86d55 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Wed, 23 Aug 2023 05:16:42 +0100 Subject: [PATCH 11/23] Update Assets.js --- extensions/Lily/Assets.js | 442 ++++++++++++++++++++------------------ 1 file changed, 234 insertions(+), 208 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index 89085bd684..6c7b472fcd 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -1,11 +1,11 @@ // Name: Asset Manager // ID: lmsAssets -// Description: Add, remove, and get data from sprites, costumes and sounds. +// Description: Add, remove, and get data from various types of assets. // TheShovel is so epic and cool and awesome (function (Scratch) { - 'use strict'; + "use strict"; const vm = Scratch.vm; const runtime = vm.runtime; @@ -14,286 +14,287 @@ class Assets { getInfo() { return { - id: 'lmsAssets', - color1: '#5779ca', - color2: '#4e6db6', - color3: '#4661a2', - name: 'Asset Manager', + id: "lmsAssets", + color1: "#5779ca", + color2: "#4e6db6", + color3: "#4661a2", + name: "Asset Manager", blocks: [ { - opcode: 'addSprite', + opcode: "addSprite", blockType: Scratch.BlockType.COMMAND, - text: 'add sprite from URL [URL]', + text: "add sprite from URL [URL]", arguments: { URL: { - type: Scratch.ArgumentType.STRING - } - } + type: Scratch.ArgumentType.STRING, + }, + }, }, { - opcode: 'addCostume', + opcode: "addCostume", blockType: Scratch.BlockType.COMMAND, - text: 'add costume from URL [URL] named [NAME]', + text: "add costume from URL [URL] named [NAME]", arguments: { URL: { - type: Scratch.ArgumentType.STRING + type: Scratch.ArgumentType.STRING, }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: 'costume1' - } - } + defaultValue: "costume1", + }, + }, }, { - opcode: 'addSound', + opcode: "addSound", blockType: Scratch.BlockType.COMMAND, - text: 'add sound from URL [URL] named [NAME]', + text: "add sound from URL [URL] named [NAME]", arguments: { URL: { - type: Scratch.ArgumentType.STRING + type: Scratch.ArgumentType.STRING, }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: 'idk sound1?? like-' - } - } + defaultValue: "idk sound1?? like-", + }, + }, }, - '---', + "---", { - opcode: 'renameSprite', + opcode: "renameSprite", blockType: Scratch.BlockType.COMMAND, - text: 'rename sprite [TARGET] to [NAME]', + text: "rename sprite [TARGET] to [NAME]", arguments: { TARGET: { type: Scratch.ArgumentType.STRING, - menu: 'targets' + menu: "targets", }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: 'Sprite1' - } - } + defaultValue: "Sprite1", + }, + }, }, { - opcode: 'renameCostume', + opcode: "renameCostume", blockType: Scratch.BlockType.COMMAND, - text: 'rename costume [COSTUME] to [NAME]', + text: "rename costume [COSTUME] to [NAME]", arguments: { COSTUME: { - type: Scratch.ArgumentType.COSTUME + type: Scratch.ArgumentType.COSTUME, }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: 'costume1' - } - } + defaultValue: "costume1", + }, + }, }, { - opcode: 'renameSound', + opcode: "renameSound", blockType: Scratch.BlockType.COMMAND, - text: 'rename sound [SOUND] to [NAME]', + text: "rename sound [SOUND] to [NAME]", arguments: { SOUND: { - type: Scratch.ArgumentType.SOUND + type: Scratch.ArgumentType.SOUND, }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: 'idk sound1?? like-' - } - } + defaultValue: "idk sound1?? like-", + }, + }, }, - '---', + "---", { - opcode: 'deleteSprite', + opcode: "deleteSprite", blockType: Scratch.BlockType.COMMAND, - text: 'delete sprite [TARGET]', + text: "delete sprite [TARGET]", arguments: { TARGET: { type: Scratch.ArgumentType.STRING, - menu: 'targets' + menu: "targets", }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: 'Sprite1' - } - } + defaultValue: "Sprite1", + }, + }, }, { - opcode: 'deleteCostume', + opcode: "deleteCostume", blockType: Scratch.BlockType.COMMAND, - text: 'delete costume [COSTUME]', + text: "delete costume [COSTUME]", arguments: { COSTUME: { - type: Scratch.ArgumentType.COSTUME + type: Scratch.ArgumentType.COSTUME, }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: 'costume1' - } - } + defaultValue: "costume1", + }, + }, }, { - opcode: 'deleteSound', + opcode: "deleteSound", blockType: Scratch.BlockType.COMMAND, - text: 'delete sound [SOUND]', + text: "delete sound [SOUND]", arguments: { SOUND: { - type: Scratch.ArgumentType.SOUND + type: Scratch.ArgumentType.SOUND, }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: 'idk sound1?? like-' - } - } + defaultValue: "idk sound1?? like-", + }, + }, }, - '---', + "---", { - opcode: 'getAllSprites', + opcode: "getAllSprites", blockType: Scratch.BlockType.REPORTER, - text: 'all sprites' + text: "all sprites", }, { - opcode: 'getAllCostumes', + opcode: "getAllCostumes", blockType: Scratch.BlockType.REPORTER, - text: 'all costumes' + text: "all costumes", }, { - opcode: 'getAllSounds', + opcode: "getAllSounds", blockType: Scratch.BlockType.REPORTER, - text: 'all sounds' + text: "all sounds", }, { - opcode: 'getSpriteName', + opcode: "getSpriteName", blockType: Scratch.BlockType.REPORTER, - text: 'sprite name' + text: "sprite name", }, - '---', + "---", { - opcode: 'reorderCostume', + opcode: "reorderCostume", blockType: Scratch.BlockType.COMMAND, - text: 'reorder costume # [INDEX1] to index [INDEX2]', + text: "reorder costume # [INDEX1] to index [INDEX2]", arguments: { INDEX1: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 1 + defaultValue: 1, }, INDEX2: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 2 - } - } + defaultValue: 2, + }, + }, }, { - opcode: 'reorderSound', + opcode: "reorderSound", blockType: Scratch.BlockType.COMMAND, - text: 'reorder sound # [INDEX1] to index [INDEX2]', + text: "reorder sound # [INDEX1] to index [INDEX2]", arguments: { INDEX1: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 1 + defaultValue: 1, }, INDEX2: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 2 - } - } + defaultValue: 2, + }, + }, }, - '---', + "---", { - opcode: 'getSoundData', + opcode: "getSoundData", blockType: Scratch.BlockType.REPORTER, - text: '[ATTRIBUTE] of [SOUND]', + text: "[ATTRIBUTE] of [SOUND]", arguments: { ATTRIBUTE: { type: Scratch.ArgumentType.STRING, - menu: 'attribute' + menu: "attribute", }, SOUND: { - type: Scratch.ArgumentType.SOUND - } - } + type: Scratch.ArgumentType.SOUND, + }, + }, }, { - opcode: 'getCostumeData', + opcode: "getCostumeData", blockType: Scratch.BlockType.REPORTER, - text: '[ATTRIBUTE] of [COSTUME]', + text: "[ATTRIBUTE] of [COSTUME]", arguments: { ATTRIBUTE: { type: Scratch.ArgumentType.STRING, - menu: 'attribute' + menu: "attribute", }, COSTUME: { - type: Scratch.ArgumentType.COSTUME - } - } + type: Scratch.ArgumentType.COSTUME, + }, + }, }, - '---', + "---", { - opcode: 'getCostumeAtIndex', + opcode: "getCostumeAtIndex", blockType: Scratch.BlockType.REPORTER, - text: 'name of costume # [INDEX]', + text: "name of costume # [INDEX]", arguments: { INDEX: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 1 - } - } + defaultValue: 1, + }, + }, }, { - opcode: 'getSoundAtIndex', + opcode: "getSoundAtIndex", blockType: Scratch.BlockType.REPORTER, - text: 'name of sound # [INDEX]', + text: "name of sound # [INDEX]", arguments: { INDEX: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 1 - } - } + defaultValue: 1, + }, + }, }, - '---', + "---", { - opcode: 'openProject', + opcode: "openProject", blockType: Scratch.BlockType.COMMAND, - text: 'open project from URL [URL]', + text: "open project from URL [URL]", arguments: { URL: { - type: Scratch.ArgumentType.STRING - } - } + type: Scratch.ArgumentType.STRING, + }, + }, }, { - opcode: 'getProjectJSON', + opcode: "getProjectJSON", blockType: Scratch.BlockType.REPORTER, - text: 'project JSON' + text: "project JSON", }, - '---', + "---", { - opcode: 'loadExtension', + opcode: "loadExtension", blockType: Scratch.BlockType.COMMAND, - text: 'load extension from URL [URL]', + text: "load extension from URL [URL]", arguments: { URL: { type: Scratch.ArgumentType.STRING, - defaultValue: 'https://extensions.turbowarp.org/Skyhigh173/json.js' - } - } + defaultValue: + "https://extensions.turbowarp.org/Skyhigh173/json.js", + }, + }, }, { - opcode: 'getLoadedExtensions', + opcode: "getLoadedExtensions", blockType: Scratch.BlockType.REPORTER, - text: 'loaded extensions' - } + text: "loaded extensions", + }, ], menus: { targets: { acceptReporters: true, - items: '_getTargets' + items: "_getTargets", }, attribute: { acceptReporters: false, - items: ['index', 'dataURI', 'format', 'header', 'asset ID'] - } - } + items: ["index", "dataURI", "format", "header", "asset ID"], + }, + }, }; } @@ -310,51 +311,59 @@ addCostume(args, util) { const targetId = util.target.id; const assetName = Cast.toString(args.NAME); - return new Promise(resolve => { + return new Promise((resolve) => { Scratch.fetch(args.URL, { - method: 'GET' - }).then(x => x.blob().then(blob => { - if (!( - (this._typeIsBitmap(blob.type)) || - (blob.type === 'image/svg+xml') - )) { - resolve(); - throw new Error(`Invalid mime type: "${blob.type}"`); - } - - const assetType = this._typeIsBitmap(blob.type) ? - runtime.storage.AssetType.ImageBitmap : - runtime.storage.AssetType.ImageVector; - - const dataType = blob.type === 'image/svg+xml' ? - 'svg' : - blob.type.split('/')[1]; - - blob.arrayBuffer() - .then(buffer => { - const data = dataType === 'image/svg+xml' ? - buffer : - new Uint8Array(buffer); - const asset = runtime.storage.createAsset(assetType, dataType, data, null, true); - const name = `${asset.assetId}.${asset.dataFormat}`; - const spriteJson = { - asset: asset, - md5ext: name, - name: assetName - }; - const request = vm.addCostume(name, spriteJson, targetId); - if (request.then) { - request.then(resolve); - } else { - resolve(); - } - }) - .catch(err => { - console.error(`Failed to Load Costume: ${err}`); - console.warn(err); + method: "GET", + }).then((x) => + x.blob().then((blob) => { + if ( + !(this._typeIsBitmap(blob.type) || blob.type === "image/svg+xml") + ) { resolve(); - }); - })); + throw new Error(`Invalid mime type: "${blob.type}"`); + } + + const assetType = this._typeIsBitmap(blob.type) + ? runtime.storage.AssetType.ImageBitmap + : runtime.storage.AssetType.ImageVector; + + const dataType = + blob.type === "image/svg+xml" ? "svg" : blob.type.split("/")[1]; + + blob + .arrayBuffer() + .then((buffer) => { + const data = + dataType === "image/svg+xml" + ? buffer + : new Uint8Array(buffer); + const asset = runtime.storage.createAsset( + assetType, + dataType, + data, + null, + true + ); + const name = `${asset.assetId}.${asset.dataFormat}`; + const spriteJson = { + asset: asset, + md5ext: name, + name: assetName, + }; + const request = vm.addCostume(name, spriteJson, targetId); + if (request.then) { + request.then(resolve); + } else { + resolve(); + } + }) + .catch((err) => { + console.error(`Failed to Load Costume: ${err}`); + console.warn(err); + resolve(); + }); + }) + ); }); } @@ -373,12 +382,18 @@ new Uint8Array(arrayBuffer), true ); - resolve(vm.addSound({ - md5: asset.assetId + '.' + asset.dataFormat, - asset: asset, - name: assetName - }, targetId)); - }).catch(resolve); + resolve( + vm.addSound( + { + md5: asset.assetId + "." + asset.dataFormat, + asset: asset, + name: assetName, + }, + targetId + ) + ); + }) + .catch(resolve); }); } // End of PenguinMod @@ -473,7 +488,7 @@ } getSpriteName(args, util) { - return util.target.sprite.name ?? ''; + return util.target.sprite.name ?? ""; } reorderCostume(args, util) { @@ -505,15 +520,20 @@ const attribute = Cast.toString(args.ATTRIBUTE); const costumeName = Cast.toString(args.COSTUME); const costumeIndex = target.getCostumeIndexByName(costumeName); - if (costumeIndex < 0) return ''; + if (costumeIndex < 0) return ""; const costume = target.sprite.costumes[costumeIndex]; switch (attribute) { - case ('dataURI'): return costume.asset.encodeDataURI(); - case ('index'): return costumeIndex + 1; - case ('format'): return costume.asset.assetType.runtimeFormat; - case ('header'): return costume.asset.assetType.contentType; - case ('asset ID'): return costume.asset.assetId; + case "dataURI": + return costume.asset.encodeDataURI(); + case "index": + return costumeIndex + 1; + case "format": + return costume.asset.assetType.runtimeFormat; + case "header": + return costume.asset.assetType.contentType; + case "asset ID": + return costume.asset.assetId; } } @@ -522,15 +542,20 @@ const attribute = Cast.toString(args.ATTRIBUTE); const soundName = Cast.toString(args.SOUND); const soundIndex = this._getSoundIndexByName(soundName, util); - if (soundIndex < 0) return ''; + if (soundIndex < 0) return ""; const sound = target.sprite.sounds[soundIndex]; switch (attribute) { - case ('dataURI'): return sound.asset.encodeDataURI(); - case ('index'): return soundIndex + 1; - case ('format'): return sound.asset.assetType.runtimeFormat; - case ('header'): return sound.asset.assetType.contentType; - case ('asset ID'): return sound.asset.assetId; + case "dataURI": + return sound.asset.encodeDataURI(); + case "index": + return soundIndex + 1; + case "format": + return sound.asset.assetType.runtimeFormat; + case "header": + return sound.asset.assetType.contentType; + case "asset ID": + return sound.asset.assetId; } } @@ -538,7 +563,7 @@ const target = util.target; const index = Math.round(Cast.toNumber(args.INDEX - 1)); const costumes = target.sprite.costumes; - if (!(0 < index < costumes.length)) return ''; + if (!(0 < index < costumes.length)) return ""; return costumes[index].name; } @@ -547,7 +572,7 @@ const target = util.target; const index = Math.round(Cast.toNumber(args.INDEX - 1)); const sounds = target.sprite.sounds; - if (!(0 < index < sounds.length)) return ''; + if (!(0 < index < sounds.length)) return ""; return sounds[index].name; } @@ -555,8 +580,8 @@ openProject(args) { const url = Cast.toString(args.URL); Scratch.fetch(url) - .then(r => r.arrayBuffer()) - .then(buffer => vm.loadProject(buffer)); + .then((r) => r.arrayBuffer()) + .then((buffer) => vm.loadProject(buffer)); } getProjectJSON() { @@ -569,7 +594,9 @@ } getLoadedExtensions(args) { - return JSON.stringify(Array.from(vm.extensionManager._loadedExtensions.keys())); + return JSON.stringify( + Array.from(vm.extensionManager._loadedExtensions.keys()) + ); } /* Utility Functions */ @@ -587,19 +614,19 @@ // PenguinMod _typeIsBitmap(type) { return ( - type === 'image/png' || - type === 'image/bmp' || - type === 'image/jpg' || - type === 'image/jpeg' || - type === 'image/jfif' || - type === 'image/webp' || - type === 'image/gif' + type === "image/png" || + type === "image/bmp" || + type === "image/jpg" || + type === "image/jpeg" || + type === "image/jfif" || + type === "image/webp" || + type === "image/gif" ); } - _getTargetFromMenu (targetName, util) { + _getTargetFromMenu(targetName, util) { let target = Scratch.vm.runtime.getSpriteTargetByName(targetName); - if (targetName === '_myself_') target = util.target.sprite.clones[0]; + if (targetName === "_myself_") target = util.target.sprite.clones[0]; return target; } @@ -614,17 +641,16 @@ spriteNames.push({ text: targetName, // We, rather unfortunately, have to rely on Target IDs. This is a terrible idea. - value: targetId + value: targetId, }); } } if (spriteNames.length > 0) { return spriteNames; } else { - return ['']; + return [""]; } } - } Scratch.extensions.register(new Assets()); })(Scratch); From 8c3ce30ffc31dcc849e4a3a2d5f7094189837dd5 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Sun, 27 Aug 2023 04:57:48 +0100 Subject: [PATCH 12/23] Return *something* --- extensions/Lily/Assets.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index 6c7b472fcd..b1d5fa422d 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -534,6 +534,8 @@ return costume.asset.assetType.contentType; case "asset ID": return costume.asset.assetId; + default: + return ''; } } From 307e78c4659b0da69419dbd6c81994193494090a Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Sun, 27 Aug 2023 04:58:26 +0100 Subject: [PATCH 13/23] Await extension load --- extensions/Lily/Assets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index b1d5fa422d..c14c101405 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -590,9 +590,9 @@ return Scratch.vm.toJSON(); } - loadExtension(args) { + async loadExtension(args) { const url = Cast.toString(args.URL); - vm.extensionManager.loadExtensionURL(url); + await vm.extensionManager.loadExtensionURL(url); } getLoadedExtensions(args) { From 42d5a60add64de04fa54205ebb318316fbf48923 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Sun, 27 Aug 2023 05:32:54 +0100 Subject: [PATCH 14/23] format --- extensions/Lily/Assets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index c14c101405..d5bcd2a41b 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -535,7 +535,7 @@ case "asset ID": return costume.asset.assetId; default: - return ''; + return ""; } } From 3431ce5e9718634ce0015a3dd0208ef2268eb057 Mon Sep 17 00:00:00 2001 From: Muffin Date: Sat, 23 Sep 2023 23:49:25 -0500 Subject: [PATCH 15/23] Fix how sprite names work --- extensions/Lily/Assets.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index d5bcd2a41b..d585d952cb 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -399,8 +399,7 @@ // End of PenguinMod renameSprite(args, util) { - let target = runtime.getTargetById(args.TARGET); - if (!target) target = this._getTargetFromMenu(args.TARGET, util); + const target = this._getTargetFromMenu(args.TARGET, util); if (!target || target.isStage) return; const name = Cast.toString(args.NAME); @@ -428,8 +427,7 @@ } deleteSprite(args, util) { - let target = runtime.getTargetById(args.TARGET); - if (!target) target = runtime.getSpriteTargetByName(args.TARGET); + const target = this._getTargetFromMenu(args.TARGET); if (!target || target.isStage) return; Scratch.vm.deleteSprite(target.id); @@ -634,17 +632,17 @@ _getTargets() { const spriteNames = []; + if (Scratch.vm.editingTarget && !Scratch.vm.editingTarget.isStage) { + spriteNames.push({ + text: 'myself', + value: '_myself_' + }); + } const targets = Scratch.vm.runtime.targets; for (let index = 1; index < targets.length; index++) { const target = targets[index]; if (target.isOriginal) { - const targetName = target.getName(); - const targetId = target.id; - spriteNames.push({ - text: targetName, - // We, rather unfortunately, have to rely on Target IDs. This is a terrible idea. - value: targetId, - }); + spriteNames.push(target.getName()); } } if (spriteNames.length > 0) { From ca6a29112b524da8de3c7dbcebe55c4e2be3ac03 Mon Sep 17 00:00:00 2001 From: Muffin Date: Sun, 24 Sep 2023 00:00:23 -0500 Subject: [PATCH 16/23] Finish addSprite --- extensions/Lily/Assets.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index d585d952cb..b85576a25d 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -300,11 +300,13 @@ async addSprite(args, util) { const url = Cast.toString(args.URL); - if (!(await Scratch.canFetch(url))) return; - const response = await Scratch.fetch(url); const json = await response.arrayBuffer(); + try { await vm.addSprite(json); + } catch (e) { + console.error(e); + } } // Thank you PenguinMod for providing this code. From d1662ab79d0b2e681ec78ee2c2a759b80f31b32a Mon Sep 17 00:00:00 2001 From: Muffin Date: Sun, 24 Sep 2023 00:03:07 -0500 Subject: [PATCH 17/23] finish addCostume --- extensions/Lily/Assets.js | 90 +++++++++++++++------------------------ 1 file changed, 35 insertions(+), 55 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index b85576a25d..c79d12539d 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -303,70 +303,50 @@ const response = await Scratch.fetch(url); const json = await response.arrayBuffer(); try { - await vm.addSprite(json); + await vm.addSprite(json); } catch (e) { console.error(e); } } // Thank you PenguinMod for providing this code. - addCostume(args, util) { + async addCostume(args, util) { const targetId = util.target.id; const assetName = Cast.toString(args.NAME); - return new Promise((resolve) => { - Scratch.fetch(args.URL, { - method: "GET", - }).then((x) => - x.blob().then((blob) => { - if ( - !(this._typeIsBitmap(blob.type) || blob.type === "image/svg+xml") - ) { - resolve(); - throw new Error(`Invalid mime type: "${blob.type}"`); - } - - const assetType = this._typeIsBitmap(blob.type) - ? runtime.storage.AssetType.ImageBitmap - : runtime.storage.AssetType.ImageVector; - - const dataType = - blob.type === "image/svg+xml" ? "svg" : blob.type.split("/")[1]; - - blob - .arrayBuffer() - .then((buffer) => { - const data = - dataType === "image/svg+xml" - ? buffer - : new Uint8Array(buffer); - const asset = runtime.storage.createAsset( - assetType, - dataType, - data, - null, - true - ); - const name = `${asset.assetId}.${asset.dataFormat}`; - const spriteJson = { - asset: asset, - md5ext: name, - name: assetName, - }; - const request = vm.addCostume(name, spriteJson, targetId); - if (request.then) { - request.then(resolve); - } else { - resolve(); - } - }) - .catch((err) => { - console.error(`Failed to Load Costume: ${err}`); - console.warn(err); - resolve(); - }); - }) - ); + + const res = await Scratch.fetch(args.URL); + const blob = await res.blob(); + + if (!(this._typeIsBitmap(blob.type) || blob.type === "image/svg+xml")) { + console.error(`Invalid MIME type: ${blob.type}`); + return; + } + + const assetType = this._typeIsBitmap(blob.type) + ? runtime.storage.AssetType.ImageBitmap + : runtime.storage.AssetType.ImageVector; + const dataType = blob.type === "image/svg+xml" ? "svg" : blob.type.split("/")[1]; + + const arrayBuffer = await new Promise((resolve, reject) => { + const fr = new FileReader(); + fr.onload = () => resolve(fr.result); + fr.onerror = () => reject(new Error(`Failed to read as array buffer: ${fr.error}`)); + fr.readAsArrayBuffer(blob); }); + + const asset = runtime.storage.createAsset( + assetType, + dataType, + new Uint8Array(arrayBuffer), + null, + true + ); + const name = `${asset.assetId}.${asset.dataFormat}`; + await vm.addCostume(name, { + asset, + md5ext: name, + name: assetName, + }, targetId); } addSound(args, util) { From 10491f303643cf69bb644ee83826966ce4872adb Mon Sep 17 00:00:00 2001 From: Muffin Date: Sun, 24 Sep 2023 00:06:12 -0500 Subject: [PATCH 18/23] finish addSound --- extensions/Lily/Assets.js | 49 ++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index c79d12539d..ba88f01699 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -349,34 +349,31 @@ }, targetId); } - addSound(args, util) { + async addSound(args, util) { const targetId = util.target.id; const assetName = Cast.toString(args.NAME); - return new Promise((resolve) => { - Scratch.fetch(args.URL) - .then((r) => r.arrayBuffer()) - .then((arrayBuffer) => { - const storage = runtime.storage; - const asset = new storage.Asset( - storage.AssetType.Sound, - null, - storage.DataFormat.MP3, - new Uint8Array(arrayBuffer), - true - ); - resolve( - vm.addSound( - { - md5: asset.assetId + "." + asset.dataFormat, - asset: asset, - name: assetName, - }, - targetId - ) - ); - }) - .catch(resolve); - }); + + const res = await Scratch.fetch(args.URL) + const buffer = await res.arrayBuffer(); + + const storage = runtime.storage; + const asset = storage.createAsset( + storage.AssetType.Sound, + storage.DataFormat.MP3, + new Uint8Array(buffer), + null, + true + ); + + try { + await vm.addSound({ + asset, + md5: asset.assetId + "." + asset.dataFormat, + name: assetName, + }, targetId); + } catch (e) { + console.error(e); + } } // End of PenguinMod From a552845cea84c4bac22a91f866676314eace075b Mon Sep 17 00:00:00 2001 From: Muffin Date: Sun, 24 Sep 2023 00:07:40 -0500 Subject: [PATCH 19/23] cleanup --- extensions/Lily/Assets.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index ba88f01699..10041bbd30 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -300,8 +300,10 @@ async addSprite(args, util) { const url = Cast.toString(args.URL); + const response = await Scratch.fetch(url); const json = await response.arrayBuffer(); + try { await vm.addSprite(json); } catch (e) { @@ -321,7 +323,6 @@ console.error(`Invalid MIME type: ${blob.type}`); return; } - const assetType = this._typeIsBitmap(blob.type) ? runtime.storage.AssetType.ImageBitmap : runtime.storage.AssetType.ImageVector; @@ -341,12 +342,17 @@ null, true ); - const name = `${asset.assetId}.${asset.dataFormat}`; - await vm.addCostume(name, { - asset, - md5ext: name, - name: assetName, - }, targetId); + const md5ext = `${asset.assetId}.${asset.dataFormat}`; + + try { + await vm.addCostume(md5ext, { + asset, + md5ext, + name: assetName, + }, targetId); + } catch (e) { + console.error(e); + } } async addSound(args, util) { From 85b10655f1aa42c78531e3bfe2c4421fe676fa4f Mon Sep 17 00:00:00 2001 From: Muffin Date: Sun, 24 Sep 2023 00:11:27 -0500 Subject: [PATCH 20/23] have to return something --- extensions/Lily/Assets.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index 10041bbd30..f55df2fa2f 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -541,6 +541,8 @@ return sound.asset.assetType.contentType; case "asset ID": return sound.asset.assetId; + default: + return ""; } } From 750fcb68a9e2fa87d5451d15a292f5fa299dc910 Mon Sep 17 00:00:00 2001 From: Muffin Date: Sun, 24 Sep 2023 00:13:56 -0500 Subject: [PATCH 21/23] That syntax looks cool but it does not actually work --- extensions/Lily/Assets.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index f55df2fa2f..5e56001f82 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -480,8 +480,8 @@ const index2 = Cast.toNumber(args.INDEX2) - 1; const costumes = target.sprite.costumes; - if (!(0 <= index1 < costumes.length)) return; - if (!(0 <= index2 < costumes.length)) return; + if (index1 < 0 || index1 >= costumes.length) return; + if (index2 < 0 || index2 >= costumes.length) return; target.reorderCostume(index1, index2); } @@ -492,8 +492,8 @@ const index2 = Cast.toNumber(args.INDEX2) - 1; const sounds = target.sprite.sounds; - if (!(0 <= index1 < sounds.length)) return; - if (!(0 <= index2 < sounds.length)) return; + if (index1 < 0 || index1 >= sounds.length) return; + if (index2 < 0 || index2 >= sounds.length) return; target.reorderSound(index1, index2); } @@ -550,7 +550,7 @@ const target = util.target; const index = Math.round(Cast.toNumber(args.INDEX - 1)); const costumes = target.sprite.costumes; - if (!(0 < index < costumes.length)) return ""; + if (index < 0 || index >= costumes.length) return ""; return costumes[index].name; } @@ -559,7 +559,7 @@ const target = util.target; const index = Math.round(Cast.toNumber(args.INDEX - 1)); const sounds = target.sprite.sounds; - if (!(0 < index < sounds.length)) return ""; + if (index < 0 || index >= sounds.length) return ""; return sounds[index].name; } From b11781426714c97682e928cc12ebd40cf1e9484f Mon Sep 17 00:00:00 2001 From: Muffin Date: Sun, 24 Sep 2023 00:14:14 -0500 Subject: [PATCH 22/23] npm run format --- extensions/Lily/Assets.js | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index 5e56001f82..19c82bb8fd 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -326,12 +326,14 @@ const assetType = this._typeIsBitmap(blob.type) ? runtime.storage.AssetType.ImageBitmap : runtime.storage.AssetType.ImageVector; - const dataType = blob.type === "image/svg+xml" ? "svg" : blob.type.split("/")[1]; + const dataType = + blob.type === "image/svg+xml" ? "svg" : blob.type.split("/")[1]; const arrayBuffer = await new Promise((resolve, reject) => { const fr = new FileReader(); fr.onload = () => resolve(fr.result); - fr.onerror = () => reject(new Error(`Failed to read as array buffer: ${fr.error}`)); + fr.onerror = () => + reject(new Error(`Failed to read as array buffer: ${fr.error}`)); fr.readAsArrayBuffer(blob); }); @@ -345,11 +347,15 @@ const md5ext = `${asset.assetId}.${asset.dataFormat}`; try { - await vm.addCostume(md5ext, { - asset, + await vm.addCostume( md5ext, - name: assetName, - }, targetId); + { + asset, + md5ext, + name: assetName, + }, + targetId + ); } catch (e) { console.error(e); } @@ -359,7 +365,7 @@ const targetId = util.target.id; const assetName = Cast.toString(args.NAME); - const res = await Scratch.fetch(args.URL) + const res = await Scratch.fetch(args.URL); const buffer = await res.arrayBuffer(); const storage = runtime.storage; @@ -372,11 +378,14 @@ ); try { - await vm.addSound({ - asset, - md5: asset.assetId + "." + asset.dataFormat, - name: assetName, - }, targetId); + await vm.addSound( + { + asset, + md5: asset.assetId + "." + asset.dataFormat, + name: assetName, + }, + targetId + ); } catch (e) { console.error(e); } @@ -621,8 +630,8 @@ const spriteNames = []; if (Scratch.vm.editingTarget && !Scratch.vm.editingTarget.isStage) { spriteNames.push({ - text: 'myself', - value: '_myself_' + text: "myself", + value: "_myself_", }); } const targets = Scratch.vm.runtime.targets; From 6c90e5bebed4f2e70bfa24b0ad97b691bbc7b50d Mon Sep 17 00:00:00 2001 From: Muffin Date: Sun, 24 Sep 2023 00:15:26 -0500 Subject: [PATCH 23/23] Finish metadata --- extensions/Lily/Assets.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index 19c82bb8fd..ad5e3aaebb 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -54,7 +54,7 @@ }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: "idk sound1?? like-", + defaultValue: "sound1", }, }, }, @@ -98,7 +98,7 @@ }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: "idk sound1?? like-", + defaultValue: "sound1", }, }, }, @@ -142,7 +142,7 @@ }, NAME: { type: Scratch.ArgumentType.STRING, - defaultValue: "idk sound1?? like-", + defaultValue: "sound1", }, }, }, @@ -175,11 +175,11 @@ arguments: { INDEX1: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 1, + defaultValue: "1", }, INDEX2: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 2, + defaultValue: "2", }, }, }, @@ -190,11 +190,11 @@ arguments: { INDEX1: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 1, + defaultValue: "1", }, INDEX2: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 2, + defaultValue: "2", }, }, }, @@ -235,7 +235,7 @@ arguments: { INDEX: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 1, + defaultValue: "1", }, }, }, @@ -246,7 +246,7 @@ arguments: { INDEX: { type: Scratch.ArgumentType.NUMBER, - defaultValue: 1, + defaultValue: "1", }, }, },