packager icon indicating copy to clipboard operation
packager copied to clipboard

Load custom extension locally in the packager

Open Alestore opened this issue 2 years ago • 2 comments

I'm not sure if this is possible, but I would like to understand if there is a way to be able to locally load an extension without having to go through external links when packaging the project. This is because in an attempt to load a Controller extension from a link uploaded by me and a collaborator of mine on GitHub we were unable to start the extension on the project exported by the packager. The extension works correctly when using the TurboWarp editor, either locally using http://localhost:8000/controller.js or from the link uploaded by us https://blurryknight.github.io/controller.js. I don't understand what the problem is.

Alestore avatar Oct 10 '22 20:10 Alestore

The packager has had an unfortunate issue for the last while where it uses the legacy Worker sandbox while the main site uses an iframe, which affects extensions that try to use some APIs, such as this one.

I'll see if that's something that can be fixed

In fact, in the packager, we might be able to just remove the sandbox entirely ???

GarboMuffin avatar Oct 10 '22 21:10 GarboMuffin

The plan is:

  • finish unsandboxed extension support (~1wk)
  • then the packager will always load extensions unsandboxed

GarboMuffin avatar Oct 23 '22 04:10 GarboMuffin

Turns out your extension still won't work because it's a ScratchX extension. You could consider switching to the gamepad extension on https://extensions.turbowarp.org/ instead, which should work in the packager and the unsandboxed extensions experiment.

GarboMuffin avatar Nov 06 '22 09:11 GarboMuffin

Turns out your extension still won't work because it's a ScratchX extension. You could consider switching to the gamepad extension on https://extensions.turbowarp.org/ instead, which should work in the packager and the unsandboxed extensions experiment.

oh ok then. thanks a lot!

Alestore avatar Nov 06 '22 09:11 Alestore

The gamepad extension is known to be very lacking right now. If there's any blocks you want, just ask

GarboMuffin avatar Nov 06 '22 09:11 GarboMuffin

The gamepad extension is known to be very lacking right now. If there's any blocks you want, just ask

I was extremely comfortable with the ability to point the sprite in the direction of a stick

Alestore avatar Nov 06 '22 09:11 Alestore

I have added some new blocks to the extension to help with that

GarboMuffin avatar Nov 06 '22 22:11 GarboMuffin

I have added some new blocks to the extension to help with that

I looked now, phenomenal! Thanks again.

Alestore avatar Nov 06 '22 23:11 Alestore

@GarboMuffin I don't know if this is possible, but is it possible to add a block that detects the controller layout? For example see if it uses an Xbox, PlayStation or Nintendo layout?

Alestore avatar Nov 06 '22 23:11 Alestore

Browsers don't directly tell us that information, unfortunately. Sometimes they do tell us the name of the device, but each browser does it in a different way and I imagine there are a lot of differently named devices out there. In most cases, the placement of eg. button 1 should be the same on every controller, it just might have a different symbol on it.

GarboMuffin avatar Nov 07 '22 00:11 GarboMuffin

Browsers don't directly tell us that information, unfortunately. Sometimes they do tell us the name of the device, but each browser does it in a different way and I imagine there are a lot of differently devices out there. In most cases, the placement of eg. button 1 should be the same on every controller, it just might have a different symbol on it.

Oh, okay then. I will put in the settings a button to select the layout as I had already done. Thank you very much for the information!

Alestore avatar Nov 07 '22 05:11 Alestore

I have added some new blocks to the extension to help with that

I was thinking: can you add a "any button pressed on controller" block inside of the "if controller button pressed" list block?

Alestore avatar Nov 08 '22 18:11 Alestore

I've added "any" options to all the button and gamepad dropdowns.

GarboMuffin avatar Nov 12 '22 17:11 GarboMuffin

@GarboMuffin I was actually working on a contribution that would do that 😄👍

joshpinto6 avatar Nov 12 '22 17:11 joshpinto6

Can it support more then 4 controllers?

GamersUnited6001 avatar Nov 22 '22 02:11 GamersUnited6001

Chrome/Electron only support up to 4 controllers, but if you're using another browser you can insert join blocks in the dropdown to type any number in there.

GarboMuffin avatar Nov 22 '22 03:11 GarboMuffin

Can it support a controller with more then 16 buttons? When I look in the dropdown menu there are 16 buttons it can detect, but if I plug a different controller with more then 16 buttons would it still be able to detect them?

GamersUnited6001 avatar Nov 22 '22 13:11 GamersUnited6001

Similar to the controller number input, you can just insert a join block in there, type in whatever number you want, and if the controller has that many buttons then it will just work.

GarboMuffin avatar Nov 24 '22 05:11 GarboMuffin

Closing as the issue has been worked around and if the original extension is run unsandboxed (as in the packager), it does behave exactly as the code says it should which may or may not include some bugs

GarboMuffin avatar Nov 24 '22 05:11 GarboMuffin

I've added "any" options to all the button and gamepad dropdowns.

Would it be possible to also add a block "when the stick is moved", both in a specific way (stick L or R) and in a general way (one of the two sticks moved)?

Alestore avatar Dec 18 '22 21:12 Alestore