Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Leopard: Edit Scratch projects as JavaScript code
- ogadaki
-
100+ posts
Leopard: Edit Scratch projects as JavaScript code
is it just me or is the ‘edit as javascript’ option down for everyone?
It works for me (with the default project).
- AppelAnimator
-
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
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
-
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
How do you import a project from the js to scratch?
- Basic88
-
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
How do you import a project from the js to scratch?
- Basic88
-
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
How do you import a project from the js to scratch?
- Basic88
-
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
How do you import a project from the js to scratch?
- PullJosh
-
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
Good question! Unfortunately, JS to Scratch is not possible with Leopard. Only Scratch to JS. How do you import a project from the js to scratch?
(Also, please don't repost the same thing multiple times. Thanks. ;))
Last edited by PullJosh (Nov. 28, 2020 05:30:39)
- JAC77Games
-
100+ posts
Leopard: Edit Scratch projects as JavaScript code
Make leopard be able to When Backdrop Switches to …
because it breaks my games
because it breaks my games
- DC382
-
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)

And, yes, I did test other mods, it's just this one.
(I went to Turbowarp and Phosphorous, Snap)

- rlegris
-
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
I didn't find that in the documentation.
rlegris
- PullJosh
-
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
“*” at the beginning of a procedure name and after the keyword “Yield” ?It's a little detail surrounding generator functions. You can learn about it here: Why is there a https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield*
I didn't find that in the documentation.
rlegris
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
-
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
So it's basically Python's yield from?“*” at the beginning of a procedure name and after the keyword “Yield” ?It's a little detail surrounding generator functions. You can learn about it here: Why is there a https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield*
I didn't find that in the documentation.
rlegris
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.
- JAC77Games
-
100+ posts
Leopard: Edit Scratch projects as JavaScript code
Make leopard be able to When Backdrop Switches to …
because it breaks my games
because it breaks my games
- Pufferfish_Test
-
500+ posts
Leopard: Edit Scratch projects as JavaScript code
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.So it's basically Python's yield from?“*” at the beginning of a procedure name and after the keyword “Yield” ?It's a little detail surrounding generator functions. You can learn about it here: Why is there a https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield*
I didn't find that in the documentation.
rlegris
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.
- rlegris
-
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.
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
-
500+ posts
Leopard: Edit Scratch projects as JavaScript code
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 Thanks to all these good people who answered my question .. but only in part.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
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.
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
-
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
Au contraire,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.So it's basically Python's …yield from?
function * owo () { yield 'uwu' yield * [1, 2, 3, 4] } [...owo()] // -> ["uwu", 1, 2, 3, 4]
- Pufferfish_Test
-
500+ posts
Leopard: Edit Scratch projects as JavaScript code
Oh ok fair enoughAu contraire,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.So it's basically Python's …yield from?Any iterator or iterable (including arrays) can be yield *'dfunction * owo () { yield 'uwu' yield * [1, 2, 3, 4] } [...owo()] // -> ["uwu", 1, 2, 3, 4]

Maximouse, ye be correct
