Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect two spike essential hubs to scratch #10

Open
w1ngedshadow opened this issue Jun 1, 2022 · 1 comment
Open

connect two spike essential hubs to scratch #10

w1ngedshadow opened this issue Jun 1, 2022 · 1 comment

Comments

@w1ngedshadow
Copy link

w1ngedshadow commented Jun 1, 2022

Hello, is there any way to connect two spike essential hubs (or any other two devices at one time) to scratch link? previously it was possible by using s2bot with scratch 2.0

@w1ngedshadow w1ngedshadow changed the title connect twp to scratch connect two to scratch Jun 2, 2022
@w1ngedshadow w1ngedshadow changed the title connect two to scratch connect two spike essential hubs to scratch Jun 2, 2022
@alm-2000
Copy link

I did it for 2 PoweredUp trains.
What You need to do:

  1. copy scratch-gui/src/lib/libraries/extensions/poweredup to scratch-gui/src/lib/libraries/extensions/poweredup2
  2. rename all poweredup-* to poweredup2*- files
  3. edit index.jsx and replace all "poweredup" strings to "poweredup2"
    4)copy scratch-vm/src/extensions/scratch3_poweredup to scratch-vm/src/extensions/scratch3_poweredup2
  4. edit index.js and replace string return "'poweredup2';" to "return 'poweredup2';"
  5. optional:in index.js constanst blockIconURI contain base64 encoded icon in png format. You can decode, edit, encode and replace It.
    7)edit package.json in the root folder
    insert lines
    "register:poweredup2": "node ./scripts/register.js --link -C --id=\"poweredup2\" --block=\"./scratch-vm/src/extensions/scratch3_poweredup2\" --entry=\"./scratch-gui/src/lib/libraries/extensions/poweredup2\" --gui=\"../scratch-gui\"",
    "build:poweredup2": "npx xcratch-build --module=\"poweredup\" --block=\"scratch-vm/src/extensions/scratch3_poweredup2\" --entry=\"scratch-gui/src/lib/libraries/extensions/poweredup2\" --gui=\"../scratch-gui\"",

and change "register" and "build"
to

    "register": "npm run register:legoble && npm run register:spikeessential && npm run register:legoremote && npm run register:controlplus && npm run register:poweredup && npm run register:poweredup2 && npm run register:duplotrain && npm run register:legopeach && npm run register:legoluigi && npm run register:legomario",
    "build": "npm run build:legoble && npm run build:spikeessential && npm run build:legoremote && npm run build:controlplus && npm run build:poweredup && npm run build:poweredup2 && npm run build:duplotrain && npm run build:legopeach && npm run build:legoluigi && npm run build:legomario",
  1. If you do this after building and installing the extension, you need to do it (7) manually:
    edit file scratch-gui/src/lib/libraries/extensions/index.jsx and add after extensions.unshift(poweredup);
// Injected for extra extension poweredup
import poweredup2 from './poweredup2/index.jsx';
extensions.unshift(poweredup2);

edit file scratch-vm/src/extensions/virtual-machine.js and add after CORE_EXTENSIONS.push('poweredup');

CORE_EXTENSIONS.push('poweredup2');

edit file scratch-vm/src/extensions/extension-support/extension-manager.js and add after builtinExtensions.poweredup = () => require('../extensions/scratch3_poweredup');

builtinExtensions.poweredup2 = () => require('../extensions/scratch3_poweredup2');

This is an example. I hid a couple of extensions that are not relevant to me.
example

example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants