Discuss Scratch

JonathanSchaffer
Scratcher
1000+ posts

Scratch to Javascript converter

MegaApuTurkUltra wrote:

Phosphorus is technically a Scratch to javascript converter
^^^^

club penguin is kil
MegaApuTurkUltra
Scratcher
1000+ posts

Scratch to Javascript converter

JonathanSchaffer wrote:

MegaApuTurkUltra wrote:

Phosphorus is technically a Scratch to javascript converter
^^^^
Wow, I'm amazed by how incredibly constructive and informative this post is!

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
gavinskycastle
Scratcher
85 posts

Scratch to Javascript converter

That would be great to have. You could play the game like if it was an actual video game, instead of a Scratch project. JavaScript is very hard to learn, especially for young kids and adults. Almost anyone could learn Scratch with a little bit of research, so kids could program proper games!

What is annoying is how hard it might be to create a converter. While you can convert .sb files with a converter, nobody has come up with a real solution to the problem. You could convert .sb2 files to .sb (there is a converter for that,) and then convert .sb to .jar, however new features of Scratch 2.0 will not work here.

I think it is a great idea overall!


when green flag clicked
forever
if <someone is looking at this signature> then
ask [Why are you here?] and wait
if <(answer) = [I'm bored]> then
open link [https://scratch.mit.edu/users/gavinskycastle]
end
end
end
P-Code
Scratcher
500+ posts

Scratch to Javascript converter

MegaApuTurkUltra wrote:

JonathanSchaffer wrote:

MegaApuTurkUltra wrote:

Phosphorus is technically a Scratch to javascript converter
^^^^
Wow, I'm amazed by how incredibly constructive and informative this post is!
So am I!

But, IIRC, you can't download the JavaScript program from Phosphorus.
…Or is there a way to download it I don't know about?

@OP Are you saying we should be able to download Scratch projects to JavaScript, or just view them in JavaScript? Because I'm a bit confused here.

P - C O D E
Powered by creativity

“Excuse me, sir, can you direct me to de naval base in Alameda? It's vere dey keep de nuclear wessels. Nu-cle-ar wessels.” - Pavel Chekov, Stаr Тrеk IV: Тhе Voyаge Ноmе

Need to search the forums? You can use Google, Bing, or any search engine.

Did you find my post helpful? If you did, why not boost my Internet count?
C0deAmet
Scratcher
25 posts

Scratch to Javascript converter

if you make it into a convert to HTML5 that would probably work better because JavaScript and CSS work with HTML5
Falcon1234567
Scratcher
20 posts

Scratch to Javascript converter

hang on, scratch should be made in javascript right? so scratchblocks should be able to be converted to java and vice verca.
MegaApuTurkUltra
Scratcher
1000+ posts

Scratch to Javascript converter

Falcon1234567 wrote:

hang on, scratch should be made in javascript right? so scratchblocks should be able to be converted to java and vice verca.

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Scratch to Javascript converter

Falcon1234567 wrote:

hang on, scratch should be made in javascript right? so scratchblocks should be able to be converted to java and vice verca.
  1. Scratch 3.0 is being written in JavaScript, but Scratch 2.0 is written in ActionScript.
  2. Java is totally different from JavaScript.
Programaster20
Scratcher
99 posts

Scratch to Javascript converter

jesseli2007 wrote:

I'm trying to convert this block:
if <> then

end
OOOOOOOOOOOHHHHHH i have seen a tutorial of (I think it was C#) coding and that was the first code I reconized from Scratch =-P

If life gives you lemons, put on goggles so you don't accidentally squeeze them into your eyes
~Me
Programaster20
Scratcher
99 posts

Scratch to Javascript converter

Chibi-Matoran wrote:

Falcon1234567 wrote:

hang on, scratch should be made in javascript right? so scratchblocks should be able to be converted to java and vice verca.
  1. Scratch 3.0 is being written in JavaScript, but Scratch 2.0 is written in ActionScript.
  2. Java is totally different from JavaScript.
Have you actually tried Scratch 3.0?

If life gives you lemons, put on goggles so you don't accidentally squeeze them into your eyes
~Me
Sheep_maker
Scratcher
1000+ posts

Scratch to Javascript converter

Programaster20 wrote:

Chibi-Matoran wrote:

Falcon1234567 wrote:

hang on, scratch should be made in javascript right? so scratchblocks should be able to be converted to java and vice verca.
  1. Scratch 3.0 is being written in JavaScript, but Scratch 2.0 is written in ActionScript.
  2. Java is totally different from JavaScript.
Have you actually tried Scratch 3.0?
Here is their most recent stable work-in-progress version of Scratch 3.0.

- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
Smurphy13AWESOME
Scratcher
500+ posts

Scratch to Javascript converter

It should be you right click a block or script and it roughly shows you what it would be on JavaScript… I think this would help a lot because I want to learn JavaScript!
WaffleChurro
Scratcher
100+ posts

Scratch to Javascript converter

Learn a real programming language. Sorry, but Scratch is just for making silly little projects, not anything large or complex.

Lets ban Minimods together.
Wrogrsin
Scratcher
13 posts

Scratch to Javascript converter


SCRATCH TO JS CONVERTER (NOT ALL DONE):cool:


VARIABLES DO NOT HAVE “ ” OR ‘ ’ BUT TEXT DOES:

VARIABLE
“ TEXT ”
' TEXT '


brodcast
is
hello();

when i recive
is
function hello() { stuff inside }

If (condition) then ( stuff inside )
is
if (condition) { stuff inside }

If (condition) then ( stuff inside ) else ( stuff inside )
is
if (condition) { stuff inside } else { stuff inside }

set to
is
var VariableName = Value;

repeat (Value) ( stuff inside )
is
for (i = 0; i<Value; i++) { stuff inside }

wait until (condition)
is
while (!condition) { }

repeat until (condition) ( stuff inside )
is
while (!condition) { stuff inside }

ask and wait
is
answer = prompt(Question);

add (Thing) to (ListName)
is
ListName.push(Thing);

replace item (Value) of (ListName) with (Thing)
is
ListName = Thing;

length of (ListName)
is
ListName.length

( ( ValueA ) + ( ValueB ) )
is
ValueA + ValueB

( ( ValueA ) - ( ValueB ) )
is
ValueA - ValueB

( ( ValueA ) * ( ValueB ) )
is
ValueA * ValueB

( ( ValueA ) / ( ValueB ) )
is
ValueA / ValueB

(ValueA < ValueB)
is
ValueA < ValueB

(ValueA > ValueB)
is
ValueA > ValueB

(ValueA = ValueB)
is
ValueA = ValueB

(ConditionA) and (ConditionB)
is
ConditionA && ConditionB

(ConditionA) or (ConditionB)
is
ConditionA || ConditionB

not(Condition)
is
!Condition

join(ThingA)(ThingB)
is
ThingA + “” + ThingB

letter (Value) of (Thing)
is
Thing

floor of (Value)
is
Math.floor(Value)

cs765990
Scratcher
8 posts

Scratch to Javascript converter

This link I am trying to convert to JavaScript, and I got this:
var number1 = Math.floor(Math.random() * 12) + 1;
var number2 = Math.floor(Math.random() * 12) + 1;
etc.
cs765990
Scratcher
8 posts

Scratch to Javascript converter

cs765990 wrote:

This link I am trying to convert to JavaScript, and I got this:
var number1 = Math.floor(Math.random() * 12) + 1;
var number2 = Math.floor(Math.random() * 12) + 1;
etc.
I'm sorry if it's spam.
keod1248
Scratcher
22 posts

Scratch to Javascript converter

I'd love this idea. I think it would help Scratch be what it's supposed to be – a way to let any experience level program. This would facilitate Scratchers learning to program in other languages or help them get farther along in an already learned language.
DaEpikDude
Scratcher
1000+ posts

Scratch to Javascript converter

The problem is that Scratch is so different from other languages, any sort of converter would be kind of annoying to make.
Either way, Scratch is for learning to program: if you wanted to get something in another language, you can learn it.
No support.
could be confusing to n-

And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
kekoa00
Scratcher
18 posts

Scratch to Javascript converter

jesseli2007 wrote:

I'm trying to convert this block:
if <> then

end

The way to convert the above is to use the following in Javascript:

if () {

}

———————————-

Below is a full example:

———————————-

function initial() {

var x = 10;

if (x == 10) {

alert(“Passed!”);

} else {

alert(“Failed!”);

}

}

———————————-

In the example above, I made a simple script that can be activated (You could use this to activate: <button onclick=“initial”>TEST</button>).
I've also spaced each line apart (to try to make it easier to understand, it could be placed on a single line).
Here is the break down: When the function “initial” is “called” (just like a phone, when you call someone, it sends a message to the number you called) upon, it checks the variable “x” (which in this case, I've set x to the number 10), to see IF “x” is equal to the number “10” (Also note, this function should always show a popup saying “Passed!” unless the variable x is changed) as you can see in the example above: ‘ if (x == 10) {’ simply means that the code is checking to see if x is equal to 10. Anything in BETWEEN the brackets (This thing —-> “{” and this thing —-> “}”), the code will execute (what the program will do).
In the example above, I just programmed it to show a popup if x is equal to 10.

Later on, you might want to do more things, I usually set a variable to an HTML object like an input field:

———————————-
<!DOCTYPE>

<html>

<body>

<input type=“text” id=“input” value=“” placeholder=“Some text here…”>

<p><button onclick=“Test()”>Test Button</button></p>

<p id=“display”></p>

<script>

function Test() {

var x = document.getElementById(“input”).value.toLowerCase();

if (x == “hi” || x.indexOf(“hi”)!=-1) {

txt = “Hello!”;

} else if (x.indexOf(“how”)!=-1 && x.indexOf(“you”)!=-1) {

txt = “I am doing well, thanks for asking! ”;

} else {

txt = “I'm sorry, I could not understand you. ”;

}

document.getElementById(“display”).innerHTML = txt;

}

</script>

</body>

</html>

———————————-



Above is just another example that I used to make a small chat bot.
New Items Used in this example:
1.) Tags (These things —-> “<!DOCTYPE>”, “<html>”, “<script>”, “<style>”, “<body>”, etc.)
2.) Input (This thing —-> “<input …>” except without the “… in the code.)
3.) DOM (This —-> ”document.getElementById…“ also without the ”…" in it.)

Tags: Used to state what type of code it is or to show what's in it.
Input: Used to get a user's response.
DOM: Used to get and/or set something. In other words, it is like a targeting system, you set a target, and it will get information from the target.

I sure do hope that this was helpful!

(Also note: This is not meant for people that already know how to code in HTML, Javascript, etc. so please, do not criticize that you already know it and stuff, unless you found something that I did wrong.)




arloclc
Scratcher
100+ posts

Scratch to Javascript converter

Powered by DjangoBB