ZenithRogue / ext2to3

Converting Scratch 2.0 Extensions to Scratch 3.0
8 stars 3 forks source link

Name args same way as functions #4

Closed jamesbmadden closed 5 years ago

jamesbmadden commented 5 years ago

Allow data to be passed from the arguments to the functions without renaming the variables in the functions by setting the argument names to the function's property names.

With this change, reporter blocks should work properly: https://sheeptester.github.io/scratch-gui/?url=https://jamesbmadden.github.io/scratch-extensions/extension-converter-test.js

ZenithRogue commented 5 years ago

Swweeeet

ZenithRogue commented 5 years ago

A few blocks aren't working, but most reporters are. Any ideas?

https://sheeptester.github.io/scratch-gui/?url=https://nitrocipher.github.io/ext2to3/ext-test.js

jamesbmadden commented 5 years ago

Scratch 3 Extensions are run in workers, so things like prompt and alert won't work. I think as long as a worker has access to the APIs the code relies on, then it will work.

jamesbmadden commented 5 years ago

I made a simple extension for logging text, errors, and warnings (https://jamesbmadden.github.io/scratch-extensions/log-2.js) and converted it to Scratch 3 and it works fine: https://sheeptester.github.io/scratch-gui/?url=https://jamesbmadden.github.io/scratch-extensions/log.js

I think the only issue is that the APIs for the demo extension are unavailable in workers.