Discuss Scratch

ogadaki
Scratcher
100+ posts

Leopard: Edit Scratch projects as JavaScript code

LotsOLizzards wrote:

is it just me or is the ‘edit as javascript’ option down for everyone?

It works for me (with the default project).
AppelAnimator
Scratcher
14 posts

Leopard: Edit Scratch projects as JavaScript code

Ah this leopard program is Great! coz now i can start with Jvs coz you put in scratch to Jvs translations and a Jvs editor!
Thanks so much coz now am gonna start learning Jvs and when i make a good game or something on it i'll send you a link!

Thanks: AppelAnimator

Last edited by AppelAnimator (Nov. 27, 2020 20:09:15)

Basic88
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

How do you import a project from the js to scratch?
Basic88
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

Basic88 wrote:

How do you import a project from the js to scratch?
Basic88
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

Basic88 wrote:

Basic88 wrote:

How do you import a project from the js to scratch?
Basic88
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

Basic88 wrote:

Basic88 wrote:

Basic88 wrote:

How do you import a project from the js to scratch?
PullJosh
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

Basic88 wrote:

How do you import a project from the js to scratch?
Good question! Unfortunately, JS to Scratch is not possible with Leopard. Only Scratch to JS.

(Also, please don't repost the same thing multiple times. Thanks. ;))

Last edited by PullJosh (Nov. 28, 2020 05:30:39)

-AwesomeGuy46125-
Scratcher
12 posts

Leopard: Edit Scratch projects as JavaScript code

y
JAC77Games
Scratcher
100+ posts

Leopard: Edit Scratch projects as JavaScript code

Make leopard be able to When Backdrop Switches to …
because it breaks my games
DC382
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

Hi, I seem to be having an issue, I can't even get on to the page it's self.
And, yes, I did test other mods, it's just this one.
(I went to Turbowarp and Phosphorous, Snap)

rlegris
Scratcher
5 posts

Leopard: Edit Scratch projects as JavaScript code

Why is there a “*” at the beginning of a procedure name and after the keyword “Yield” ?
I didn't find that in the documentation.
rlegris
Firegod101exe_yt
Scratcher
22 posts

Leopard: Edit Scratch projects as JavaScript code

hi @riegis
PullJosh
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

rlegris wrote:

Why is there a “*” at the beginning of a procedure name and after the keyword “Yield” ?
I didn't find that in the documentation.
rlegris
It's a little detail surrounding generator functions. You can learn about it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield*

Some of the built-in Leopard methods (especially the blocks that take a long time to run) are generators, and in those cases you have to use yield*. If you just copy what the translator does, you should be all good.

Last edited by PullJosh (Dec. 16, 2020 20:05:34)

Maximouse
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

PullJosh wrote:

rlegris wrote:

Why is there a “*” at the beginning of a procedure name and after the keyword “Yield” ?
I didn't find that in the documentation.
rlegris
It's a little detail surrounding generator functions. You can learn about it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield*

Some of the built-in Leopard methods (especially the blocks that take a long time to run) are generators, and in those cases you have to use yield*. If you just copy what the translator does, you should be all good.
So it's basically Python's yield from?
JAC77Games
Scratcher
100+ posts

Leopard: Edit Scratch projects as JavaScript code

Make leopard be able to When Backdrop Switches to …
because it breaks my games
Pufferfish_Test
Scratcher
500+ posts

Leopard: Edit Scratch projects as JavaScript code

Maximouse wrote:

PullJosh wrote:

rlegris wrote:

Why is there a “*” at the beginning of a procedure name and after the keyword “Yield” ?
I didn't find that in the documentation.
rlegris
It's a little detail surrounding generator functions. You can learn about it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield*

Some of the built-in Leopard methods (especially the blocks that take a long time to run) are generators, and in those cases you have to use yield*. If you just copy what the translator does, you should be all good.
So it's basically Python's yield from?
Yep. yeild* = yeild from, yeild = yeild - but yeild* can only be used to yeild generator functions, not to loop and yeild an array or something of the sort.
rlegris
Scratcher
5 posts

Leopard: Edit Scratch projects as JavaScript code

Thanks to all these good people who answered my question .. but only in part.
Here is the second part with more details.
In the source code generated by Leopard
(which I find marvellous despite the fact that I didn't yet take a look at its script, but I will for sure)
procedures (or methods) are defined this way :

*procedureName (param, param…) {
statement;
statement;
statement
}
As I can see, there is a “ * ” before the name of the procedure, despite the fact
that in my Scratch script my procedure doesn't start with such a “ * ”.
I'm not criticising nor am I pointing to any bug. I am curious as much as you are,
R.L.

Pufferfish_Test
Scratcher
500+ posts

Leopard: Edit Scratch projects as JavaScript code

rlegris wrote:

Thanks to all these good people who answered my question .. but only in part.
Here is the second part with more details.
In the source code generated by Leopard
(which I find marvellous despite the fact that I didn't yet take a look at its script, but I will for sure)
procedures (or methods) are defined this way :

*procedureName (param, param…) {
statement;
statement;
statement
}
As I can see, there is a “ * ” before the name of the procedure, despite the fact
that in my Scratch script my procedure doesn't start with such a “ * ”.
I'm not criticising nor am I pointing to any bug. I am curious as much as you are,
R.L.

Procedures that start with “*” are generator functions, that use yeild or yeild* rather than return to return values, and they use return to stop the genetator. These can be used as“ for (i in procedure()) …” or as “procedure.next()”. Read more at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
The reason these are needed is because of tge way scratch's threading works; there's a good explanation at https://github.com/TurboWarp/scratch-vm#javascript-generation - some of it's specific to turbowarp, but a lot is very relevant to leopard.
Sheep_maker
Scratcher
1000+ posts

Leopard: Edit Scratch projects as JavaScript code

Pufferfish_Test wrote:

Maximouse wrote:

PullJosh wrote:

So it's basically Python's yield from?
Yep. yeild* = yeild from, yeild = yeild - but yeild* can only be used to yeild generator functions, not to loop and yeild an array or something of the sort.
Au contraire,
function * owo () {
  yield 'uwu'
  yield * [1, 2, 3, 4]
}
[...owo()] // -> ["uwu", 1, 2, 3, 4]
Any iterator or iterable (including arrays) can be yield *'d
Pufferfish_Test
Scratcher
500+ posts

Leopard: Edit Scratch projects as JavaScript code

Sheep_maker wrote:

Pufferfish_Test wrote:

Maximouse wrote:

PullJosh wrote:

So it's basically Python's yield from?
Yep. yeild* = yeild from, yeild = yeild - but yeild* can only be used to yeild generator functions, not to loop and yeild an array or something of the sort.
Au contraire,
function * owo () {
  yield 'uwu'
  yield * [1, 2, 3, 4]
}
[...owo()] // -> ["uwu", 1, 2, 3, 4]
Any iterator or iterable (including arrays) can be yield *'d
Oh ok fair enough
Maximouse, ye be correct

Powered by DjangoBB