Discuss Scratch

SilverOspreyStudios
Scratcher
34 posts

Scratch-JavaScript community dictionary!!!

Recently, I have started learning JavaScript, and I realized how similar it is to scratch. Therefore, I decided to make this dictionary of JavaScript commands and their scratch equivalents. Feel free to use this or to add new commands to the dictionary!
SilverOspreyStudios
Scratcher
34 posts

Scratch-JavaScript community dictionary!!!

DICTIONARY (X or CODE is not a part of the commands)
———————————————————-

if (X) {
CODE
}

=
if <> then

end

———————————————————–

prompt(“X”)

=

ask [X] and wait

—————————————————————

if (X) {
CODE
}
else {
CODE
}

=

if <> then

else
end

———————————————————-
var variablename = ‘text’;

=

set [variablename v] to [text]

———————————————————-
confirm(“X”)

=/is close to

say [X]

Last edited by SilverOspreyStudios (Aug. 20, 2014 22:36:53)

Iditaroid
Scratcher
500+ posts

Scratch-JavaScript community dictionary!!!

Linking functions from other languages to the blocks in Scratch sounds like a great way to help people expand their programming knowledge! I dont know any JavaScript tho so I cant really help expand this dictionary
turkey3
Scratcher
1000+ posts

Scratch-JavaScript community dictionary!!!

Try putting your code in [code] tags.
astro-mechanic
Scratcher
500+ posts

Scratch-JavaScript community dictionary!!!

For the graphics functions you'll probably need to set up a small Scratch emulating environment (an abstraction layer for pixi.js?)
supercreeper2005
Scratcher
100+ posts

Scratch-JavaScript community dictionary!!!

I know a little. Here:
console.log(X)
say [X] 
scratchisthebest
Scratcher
1000+ posts

Scratch-JavaScript community dictionary!!!

supercreeper2005 wrote:

I know a little. Here:
console.log(X)
say [X] 
What about
add [xyz] to [console v]
SilverOspreyStudios
Scratcher
34 posts

Scratch-JavaScript community dictionary!!!

wait, so the console is a list that you can actually draw data from?
turkey3
Scratcher
1000+ posts

Scratch-JavaScript community dictionary!!!

SilverOspreyStudios wrote:

wait, so the console is a list that you can actually draw data from?
He console is just a depository of text used mainly for websites that throw error messages so developers can troubleshoot problems.
SilverOspreyStudios
Scratcher
34 posts

Scratch-JavaScript community dictionary!!!

turkey3 wrote:

SilverOspreyStudios wrote:

wait, so the console is a list that you can actually draw data from?
He console is just a depository of text used mainly for websites that throw error messages so developers can troubleshoot problems.
So console.log is more like
say []

than

add [] to [console v]

Last edited by SilverOspreyStudios (Aug. 19, 2014 21:45:33)

Iditaroid
Scratcher
500+ posts

Scratch-JavaScript community dictionary!!!

SilverOspreyStudios wrote:

turkey3 wrote:

SilverOspreyStudios wrote:

wait, so the console is a list that you can actually draw data from?
He console is just a depository of text used mainly for websites that throw error messages so developers can troubleshoot problems.
So console.log is more like
say []

than

add [] to [console v]
Is it really all that much like either? I don't know anything about JavaScript but I've worked with Unity and in Unity the console isn't normally visible to the user…
SilverOspreyStudios
Scratcher
34 posts

Scratch-JavaScript community dictionary!!!

Iditaroid wrote:

SilverOspreyStudios wrote:

turkey3 wrote:

SilverOspreyStudios wrote:

wait, so the console is a list that you can actually draw data from?
He console is just a depository of text used mainly for websites that throw error messages so developers can troubleshoot problems.
So console.log is more like
say []

than

add [] to [console v]
Is it really all that much like either? I don't know anything about JavaScript but I've worked with Unity and in Unity the console isn't normally visible to the user…
it isnt at all like either - I should probably remove it from the dictionary, because it HAS NO SCRATCH EQUIVALENT. it is a feature that cannot be found in scratch
turkey3
Scratcher
1000+ posts

Scratch-JavaScript community dictionary!!!

Iditaroid wrote:

SilverOspreyStudios wrote:

turkey3 wrote:

SilverOspreyStudios wrote:

wait, so the console is a list that you can actually draw data from?
He console is just a depository of text used mainly for websites that throw error messages so developers can troubleshoot problems.
So console.log is more like
say []

than

add [] to [console v]
Is it really all that much like either? I don't know anything about JavaScript but I've worked with Unity and in Unity the console isn't normally visible to the user…
Definitely more close to add to list. It's not like a giant speech bubble appears when logging to the console. Hit F12 and open your console to see.
jji7skyline
Scratcher
1000+ posts

Scratch-JavaScript community dictionary!!!

var variablename = 'text';

equals

set [variablename v] to [text]

Last edited by jji7skyline (Aug. 20, 2014 00:10:18)

Iditaroid
Scratcher
500+ posts

Scratch-JavaScript community dictionary!!!

Isn't there some way to make a little window pop up that says something, or some kind of “print” function? Those would definitely be closer to the “say” block than console.log
SilverOspreyStudios
Scratcher
34 posts

Scratch-JavaScript community dictionary!!!

Iditaroid wrote:

Isn't there some way to make a little window pop up that says something, or some kind of “print” function? Those would definitely be closer to the “say” block than console.log
there is the confirm(“X”) one I believe… I dont know anything about the print one, although I heard of it before.
AonymousGuy
Scratcher
1000+ posts

Scratch-JavaScript community dictionary!!!

Scratch really isn't at all similar to Java except for the control structures…

Basically, I would say the following things are the same in both languages:
if ()
{
}
if <> then
end

if ()
{
}
else
{
}
if <> then
else
end

function
define

This one is kind of a stretch:
while (!())
{
}
repeat until <>
end

And then some are kind of similar:
alert();
say []

prompt();
ask [] and wait
Harakou
Scratcher
1000+ posts

Scratch-JavaScript community dictionary!!!

Iditaroid wrote:

Isn't there some way to make a little window pop up that says something, or some kind of “print” function? Those would definitely be closer to the “say” block than console.log
I believe the function you're thinking of is window.alert(s).

I would generally agree with AonymousGuy that Scratch and JS are rather different, though I can see the value in creating a reference for people trying to wet their feet.

Powered by DjangoBB