Discuss Scratch

Budderjohn
Scratcher
1 post

Show True Code

Make it where you can have the choice of seeing the actual code for games instead of the code blocks.
iamunknown2
Scratcher
1000+ posts

Show True Code

What do you mean? The Scratchblocks ARE the actual code.

| My website | Using Geany | A Christian | Running Ubuntu MATE 14.04 with Flash 18.0 (release 0) | Search this with quotation marks on Google to view my posts: “ellipsepostpianolizard” (some posts may not show up) |

Moving on from Scratch? Learn Python/a scripting language (e.g Perl, JavaScript), then move on to a C derivative
Rumanti
Scratcher
1000+ posts

Show True Code

I think he meant like the one at Code.org, where you can see “your code as JavaScript”.

First, as per iamunknown2, the blocks ARE the ACTUAL code. So you don't need extra fancy features to do that.

Second, if what you asks is the JS code or similar- it's not effective. The “JavaScript code” displayed at, fore example, Code.org, is actually better phrased as algorithm or instructions. Just check out the code- turnLeft(); is NOT a pre-built function. So what does this mean? This means that you have to define and code yourself,from zero, what the turnLeft() function actually does. So.. Sorry, but I don't support. Keep thinking ideas, though, your next idea might be awesome! ;D

:wq
iamunknown2
Scratcher
1000+ posts

Show True Code

Rumanti wrote:

Second, if what you asks is the JS code or similar- it's not effective. The “JavaScript code” displayed at, fore example, Code.org, is actually better phrased as algorithm or instructions. Just check out the code- turnLeft(); is NOT a pre-built function. So what does this mean? This means that you have to define and code yourself,from zero, what the turnLeft() function actually does. So.. Sorry, but I don't support. Keep thinking ideas, though, your next idea might be awesome! ;D
For easy reading…
To convert Scratch blocks to JavaScript wouldn't work very well.

On a related note, you could always make your own library (think JQuery).

| My website | Using Geany | A Christian | Running Ubuntu MATE 14.04 with Flash 18.0 (release 0) | Search this with quotation marks on Google to view my posts: “ellipsepostpianolizard” (some posts may not show up) |

Moving on from Scratch? Learn Python/a scripting language (e.g Perl, JavaScript), then move on to a C derivative
CatsUnited
Scratcher
1000+ posts

Show True Code

iamunknown2 wrote:

To convert Scratch blocks to JavaScript wouldn't work very well.
Scratch scripts use JSON though.

bottom text
iamunknown2
Scratcher
1000+ posts

Show True Code

CatsUnited wrote:

iamunknown2 wrote:

To convert Scratch blocks to JavaScript wouldn't work very well.
Scratch scripts use JSON though.
JSON != JS
The JSON code is still in Scratch blocks format, and not in JS format.

| My website | Using Geany | A Christian | Running Ubuntu MATE 14.04 with Flash 18.0 (release 0) | Search this with quotation marks on Google to view my posts: “ellipsepostpianolizard” (some posts may not show up) |

Moving on from Scratch? Learn Python/a scripting language (e.g Perl, JavaScript), then move on to a C derivative
CatsUnited
Scratcher
1000+ posts

Show True Code

iamunknown2 wrote:

JSON != JS
The JSON code is still in Scratch blocks format, and not in JS format.
JSON.parse();
BTW, I don't support this suggestion.

bottom text
MushroomMan99
Scratcher
100+ posts

Show True Code

Rumanti wrote:

I think he meant like the one at Code.org, where you can see “your code as JavaScript”.

First, as per iamunknown2, the blocks ARE the ACTUAL code. So you don't need extra fancy features to do that.

Second, if what you asks is the JS code or similar- it's not effective. The “JavaScript code” displayed at, fore example, Code.org, is actually better phrased as algorithm or instructions. Just check out the code- turnLeft(); is NOT a pre-built function. So what does this mean? This means that you have to define and code yourself,from zero, what the turnLeft() function actually does. So.. Sorry, but I don't support. Keep thinking ideas, though, your next idea might be awesome! ;D
Scratch's drag and drop menu makes it easier than other programming languages.

when green flag clicked
if <(language) = [English ]> then

say [Everything is Awesome!] for (2) secs
end
if <(language) = [French ]> then

say [Tout est super-genial!] for (2) secs
end
if <(language) = [Italian ]> then

say [E meraviglioso!] for (2) secs
end
if <(language) = [Spanish ]> then

say [Todo es fabuloso!] for (2) secs
end
Zekrom01
Scratcher
1000+ posts

Show True Code

So you can see the actual JSON code for a project?
Semi-support, there isn't much need for it.

20 something years old
Probably doing college work
Letsgopitt
Scratcher
500+ posts

Show True Code

CatsUnited wrote:

iamunknown2 wrote:

To convert Scratch blocks to JavaScript wouldn't work very well.
Scratch scripts use JSON though.
I thought Scratch used Actionscript. Are they the same thing?
stickfire-test
Scratcher
100+ posts

Show True Code

Letsgopitt wrote:

CatsUnited wrote:

iamunknown2 wrote:

To convert Scratch blocks to JavaScript wouldn't work very well.
Scratch scripts use JSON though.
I thought Scratch used Actionscript. Are they the same thing?
JSON is the format it uses to store the blocks used in a project (and other stuff, like variables and sprite information). Actionscript is the language Scratch is actually written in (I think) and what it interprets the blocks to.


gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Show True Code

Rumanti wrote:

I think he meant like the one at Code.org, where you can see “your code as JavaScript”.

First, as per iamunknown2, the blocks ARE the ACTUAL code. So you don't need extra fancy features to do that.

Second, if what you asks is the JS code or similar- it's not effective. The “JavaScript code” displayed at, fore example, Code.org, is actually better phrased as algorithm or instructions. Just check out the code- turnLeft(); is NOT a pre-built function. So what does this mean? This means that you have to define and code yourself,from zero, what the turnLeft() function actually does. So.. Sorry, but I don't support. Keep thinking ideas, though, your next idea might be awesome! ;D
Easier to understand explanation: What Rumanti means is that the JS commands don't actually exist; they are made up and must be defined by a programmer.
Zro716
Scratcher
1000+ posts

Show True Code

Well this topic kinda exploded into assumptions.

First, the Scratchblocks you see are the actual code, HOWEVER, behind the scenes, they are stored as a JSON file which is read by the Scratch interpreter, which runs in ActionScript. You can view the source code on github here, and the HTML5/JavaScript version being worked on here. So it really depends on what you mean by the “true code” - the blocks, the project.json file, or the interpreter that runs them.

As for your suggestion, albeit brief, I in fact support it. But the “code” I want shown is the JSON object, since that is probably the closest you'll get to Scratchblocks in a textual/code-like format despite it not actually being real code; if editable, it will allow us advanced users to modify/hack a project faster than downloading, extracting, editing, replacing, and uploading.

Last edited by Zro716 (Aug. 12, 2015 20:48:31)


As a long time Scratcher, I have found new meaning to the name “Scratch”: for me, it means to “scratch that itch”, to come back again and again to realize new ideas in this toy language, even when I'm capable of creating my projects in real programming languages years later. It's a friend that helped me to pursue programming and get me to enjoy its fruit. I'm certain many others who have walked this path as well have grown fond of its importance in their life.
curtliom
Scratcher
21 posts

Show True Code

I agree with @Budderjohn. I've been wanting a scratch blocks to language code for a while now.


Puppers
Scratcher
23 posts

Show True Code

Budderjohn wrote:

Make it where you can have the choice of seeing the actual code for games instead of the code blocks.
Go to the project editor (Look inside)
Hold shift and click “File” at the top right above the project name
Click “Save Project Summary”
Go to the .txt file for the project (it's wherever you saved it)
Open it
It will show variables, costumes, sound and then scripts.

What did the board say to the tire? “I'm bored!” “I'm tired” said the tire.
16 translations later…
What does the board say to the fence? I am pierced! I am tired said the fence.

elemnts2002
Scratcher
1 post

Show True Code

Puppers wrote:

Budderjohn wrote:

Make it where you can have the choice of seeing the actual code for games instead of the code blocks.
Go to the project editor (Look inside)
Hold shift and click “File” at the top right above the project name
Click “Save Project Summary”
Go to the .txt file for the project (it's wherever you saved it)
Open it
It will show variables, costumes, sound and then scripts.

thank you
Blaze349
Scratcher
1000+ posts

Show True Code

Zro716 wrote:

Well this topic kinda exploded into assumptions.

First, the Scratchblocks you see are the actual code, HOWEVER, behind the scenes, they are stored as a JSON file which is read by the Scratch interpreter, which runs in ActionScript. You can view the source code on github here, and the HTML5/JavaScript version being worked on here. So it really depends on what you mean by the “true code” - the blocks, the project.json file, or the interpreter that runs them.

As for your suggestion, albeit brief, I in fact support it. But the “code” I want shown is the JSON object, since that is probably the closest you'll get to Scratchblocks in a textual/code-like format despite it not actually being real code; if editable, it will allow us advanced users to modify/hack a project faster than downloading, extracting, editing, replacing, and uploading.
Apparently, ToU doesn't allowed hacked projects .
SpyGuy9
Scratcher
100+ posts

Show True Code

elemnts2002 wrote:

Puppers wrote:

Budderjohn wrote:

Make it where you can have the choice of seeing the actual code for games instead of the code blocks.
Go to the project editor (Look inside)
Hold shift and click “File” at the top right above the project name
Click “Save Project Summary”
Go to the .txt file for the project (it's wherever you saved it)
Open it
It will show variables, costumes, sound and then scripts.

thank you
I tried To do that, nothing downloaded. And if you inspect element, It won't let you see any code!

Try viewing the code in the comments.

When something is Important Enough, you do it even if the odds are not in your favor.

Elon Musk
I go by SGIX, SpyGuy, IX, or SpyGuy9.
--Awesome
Scratcher
59 posts

Show True Code

No support, sorry. Scratch is a site that teachers teach in school, and kids would easily get confused by that.

Last edited by --Awesome (Jan. 4, 2018 20:40:46)


Hi! I am –Awesome, but my name is Zach.
Feel free to check out my profile.
Have a wonderful day!
goldfish678
Scratcher
1000+ posts

Show True Code

Budderjohn wrote:

Make it where you can have the choice of seeing the actual code for games instead of the code blocks.
before I try to address this suggestion itself, here are some tips for the future:

- consider going further than single-sentence suggestions. while they are concise and get the point across, they leave no room for elaboration and explanation on why you think your suggestion would be vital and/or beneficial for Scratch.

- try to make it sound like it is truly a suggestion; make sure that one would feel like your statement is not imperative and forceful.

- avoid bias towards one type of project. there are many artists, music producers, animators, etc. etc. on scratch as well as game programmers.


now to the actual suggestion. this is definitely an interesting thought because as @Rumanti touched on (see post #3 on the first page), many websites similar to scratch have options like this. the problem here is that those websites were designed to be able to do that. scratch, on the other hand, is not. scratch doesn't provide direct equivalents for its code blocks–as @Rumanti also said in the same post, the functions you see on those other websites can't actually be run through an interpreter. they look like they're supposed to be the language, but they're still pseudo-code–just in text form. i suppose the scratch team could also do this, but first of all, what language would they base the text off of? i can't imagine they would have a great time mimicking actionscript so that it would be coherent for kids. doing the same thing with javascript, on the other hand, can basically just be whatever the heck you want to say with a couple parentheses and a semicolon slapped on the end, but it wouldn't exactly make sense to mimic javascript for a flash-based language. scratch 3, on the other hand, would be a different story, but there would still be problems. the reason that code.org can pull this off is that their functions are ridiculously simple. scratch would have some complications with that sort of thing–for example, the go to x: () y: () block. in javascript pseudo-code that might look something like this:

goTo(30, 50);

but then you'd have to explain that the numbers are seperated not because of a coordinate thing but because you're distinguishing one parameter from the other that are being input into the function and you'd also have to clarify that the parameters are (x,y). that's a lot of additional information for something that's as basic in concept as an “actual code” option.

if you still want something past the pseudo-code that scratch provides, i'd suggest converting the sb2 file of choice into a zip file and reading the json from there.

sincerely,
goldfish


Powered by DjangoBB