This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Advanced Topics
  •  » Fully functional plugin to create scratchblocks code within Scratch!

#76 2012-08-23 21:10:55

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

LS97 wrote:

Hardmath123 wrote:

LS97, how's the Script-to-Squeak-converter working out?

*blushes from shame*
Ehm, I kinda forgot about that right now, because I'm working on the API2 project with sparks and fg123, but I will continue it as soon as I can!
Sorry  sad

No problem! If you look at the pile of unfinished stuff I have, you may faint.  smile


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#77 2012-08-23 21:17:44

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

Hardmath123 wrote:

LS97 wrote:

Hardmath123 wrote:

LS97, how's the Script-to-Squeak-converter working out?

*blushes from shame*
Ehm, I kinda forgot about that right now, because I'm working on the API2 project with sparks and fg123, but I will continue it as soon as I can!
Sorry  sad

No problem! If you look at the pile of unfinished stuff I have, you may faint.  smile

Hehe. I have more. :3


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#78 2012-08-24 05:00:51

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

MathWizz wrote:

Hardmath123 wrote:

LS97 wrote:


*blushes from shame*
Ehm, I kinda forgot about that right now, because I'm working on the API2 project with sparks and fg123, but I will continue it as soon as I can!
Sorry  sad

No problem! If you look at the pile of unfinished stuff I have, you may faint.  smile

Hehe. I have more. :3

How do you know?  tongue
I have a ton as well.

On topic, i was thinking of making a reverse thingy of this that goes into 2.0 code. Probably web based, just like 2.0 itself. It'll still need some work on the user's part though.

Offline

 

#79 2012-08-24 12:50:53

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

scimonster wrote:

On topic, i was thinking of making a reverse thingy of this that goes into 2.0 code. Probably web based, just like 2.0 itself. It'll still need some work on the user's part though.

I can testify that it [parsing scratchblocks text back to graphical blocks] is quite difficult  tongue  Not impossible, though. I've nearly finished my parser in Python  smile

Maybe see if there's something like a Javascript version of lex/yacc...?


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#80 2012-08-26 14:52:40

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: Fully functional plugin to create scratchblocks code within Scratch!

Very cool!  I'd been thinking of something like this from the time of the [scratchblocks] format update.

Would it be possible to generate scripts from [scratchblocks] code on the clipboard?  Maybe with a right click on the back of the scripting pane, and selecting "import scratchblocks from clipboard?" I'm not really sure what sort of coding this would require.   What does the exporter see that it is able to turn into [scratchblocks] code?  Shouldn't it be relatively simple to do that the other way around as well?

I have some large projects with massive scripts - especially those attempting to be 1s1s - and the lag between each action can be huge! If I could type in scratchblocks and import that after, that would help my boring "my stuff" page out a ton!

Last edited by LiquidMetal (2012-08-26 15:06:51)

Offline

 

#81 2012-08-26 15:22:21

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

LiquidMetal wrote:

Shouldn't it be relatively simple to do that the other way around as well?

Trust me, it's not  tongue  I've just done it in Python.

The scratchblocks syntax was designed to be easy to write & remember, as far as I can tell. Which is great! But it does a lot of things that are quite hard to reverse. Take booleans: the < meaning "less than" looks a lot like the start of another boolean block... And things like the "length of" (string/list) and "of" (math function/attribute of sprite) are hard to tell apart.  smile

But it certainly could be done; especially if there's a good lex/yacc implementation for Squeak...


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#82 2012-08-26 21:39:41

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: Fully functional plugin to create scratchblocks code within Scratch!

What are lex and yacc? I've never heard of those.

blob8108 wrote:

I've just done it in Python.

Wait...  Does that mean you have python code that I could use to turn scratchblocks code back into scripts?

Last edited by LiquidMetal (2012-08-26 21:45:28)

Offline

 

#83 2012-09-04 11:38:18

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

blob8108 wrote:

it does a lot of things that are quite hard to reverse. Take booleans: the < meaning "less than" looks a lot like the start of another boolean block... And things like the "length of" (string/list) and "of" (math function/attribute of sprite) are hard to tell apart.  smile

Well, the scratchblocks parser of the forums can tell all of them apart, so it's bound to be possible. But one thing is just parsing the appearance of the blocks and displaying them on a forum, and another is actually recognising them and giving them the right selectors and arguments  hmm

Offline

 

#84 2012-09-04 11:42:17

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

LiquidMetal wrote:

What are lex and yacc? I've never heard of those.

Lex is a tokenizer, and yacc is a parser -- they're libraries used to parse formal languages (like C and Python, I think).

blob8108 wrote:

I've just done it in Python.

Wait...  Does that mean you have python code that I could use to turn scratchblocks code back into scripts?

Indeed! Check it out here.


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#85 2012-09-04 12:09:50

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

LS97 wrote:

blob8108 wrote:

it does a lot of things that are quite hard to reverse. Take booleans: the < meaning "less than" looks a lot like the start of another boolean block... And things like the "length of" (string/list) and "of" (math function/attribute of sprite) are hard to tell apart.  smile

Well, the scratchblocks parser of the forums can tell all of them apart, so it's bound to be possible. But one thing is just parsing the appearance of the blocks and displaying them on a forum, and another is actually recognising them and giving them the right selectors and arguments  hmm

That's absolutely true  tongue  JSO was saying somewhere that he doesn't actually validate the scripts at all — you don't need to when you're only displaying them.

My basic strategy was to parse them into parts (word / inserts / embedded reporters); filter them to separate the words and the inserts; look up the block by its text using the words; and then verify the inserts against the block argument flags ("%b", "%n", etc) where there are multiple choices of block to choose from. The "of" block is tricky when the second argument is a reporter: so I also have a list of valid arguments to the "%f" (math function) block. Should give you some idea...  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#86 2012-09-04 12:22:12

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

blob8108 wrote:

LS97 wrote:

blob8108 wrote:

it does a lot of things that are quite hard to reverse. Take booleans: the < meaning "less than" looks a lot like the start of another boolean block... And things like the "length of" (string/list) and "of" (math function/attribute of sprite) are hard to tell apart.  smile

Well, the scratchblocks parser of the forums can tell all of them apart, so it's bound to be possible. But one thing is just parsing the appearance of the blocks and displaying them on a forum, and another is actually recognising them and giving them the right selectors and arguments  hmm

That's absolutely true  tongue  JSO was saying somewhere that he doesn't actually validate the scripts at all — you don't need to when you're only displaying them.

My basic strategy was to parse them into parts (word / inserts / embedded reporters); filter them to separate the words and the inserts; look up the block by its text using the words; and then verify the inserts against the block argument flags ("%b", "%n", etc) where there are multiple choices of block to choose from. The "of" block is tricky when the second argument is a reporter: so I also have a list of valid arguments to the "%f" (math function) block. Should give you some idea...  smile

That's very clever  smile
I don't think I will take on such a big project now, especially since we're transitioning to 2.0 so relatively soon. I did make a blocks2squeak in the meantime... big_smile  see other advanced topics thread by me

Offline

 

#87 2012-09-04 12:44:42

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

LS97 wrote:

I did make a blocks2squeak in the meantime... big_smile  see other advanced topics thread by me

blocks2squeak sounds cool. How do you deal with "wait until", "ask" blocks, and the like?


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#88 2012-09-04 13:23:44

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

blob8108 wrote:

LS97 wrote:

I did make a blocks2squeak in the meantime... big_smile  see other advanced topics thread by me

blocks2squeak sounds cool. How do you deal with "wait until", "ask" blocks, and the like?

They are parsed especially, and most of them work well, but some are ignored on purpose because it wouldn't really make sense to have them in a single threaded method.

Offline

 

#89 2012-09-04 15:13:25

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

LS97 wrote:

blob8108 wrote:

LS97 wrote:

I did make a blocks2squeak in the meantime... big_smile  see other advanced topics thread by me

blocks2squeak sounds cool. How do you deal with "wait until", "ask" blocks, and the like?

They are parsed especially, and most of them work well, but some are ignored on purpose because it wouldn't really make sense to have them in a single threaded method.

Ah, cool.  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#90 2012-09-24 13:39:04

Martiscratch
Scratcher
Registered: 2012-05-04
Posts: 100+

Re: Fully functional plugin to create scratchblocks code within Scratch!

cool thing!


http://signaturecraft.us/signatures/eJw1yDEOgCAMBdC9p_gnICphdnA18QwoNZIAJRTD9Z184-uP74gKjxIvxi3tzaii3ZA-PjPijdgxvBpjcCYeeOtKW2Ou3OhIAbuUIOUvpdnNtDhH1tL0AQVCHgk~.png

Offline

 

#91 2012-10-28 20:48:35

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

How do I use it after it's been installed?

Offline

 

#92 2012-10-28 21:09:01

ahirbhairav
Scratcher
Registered: 2012-10-06
Posts: 100+

Re: Fully functional plugin to create scratchblocks code within Scratch!

ImagineIt wrote:

How do I use it after it's been installed?

I'm having the same problem.

Offline

 

#93 2012-10-29 05:14:01

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

First of all, once you downloaded the file (which by the way should really be this file instead), did you file it in using the Squeak File Browser?

Here's how:
Turn fill screen off (shift click the loop in the R of the Scratch logo, top left of screen)
Click on the white space that appeared an select open
Click on file list
Browse for the downloaded file in the window that appears
Select and then right click on the name of the file in the right-handside pane
Click on fileIn

Now, shift click the loop in the R again and select "save image for end user"
Click yes

Open Scratch again, and to use it right click any script in the scripting pane!

Offline

 

#94 2012-11-03 17:47:38

Nekrobat
Scratcher
Registered: 2012-07-17
Posts: 18

Re: Fully functional plugin to create scratchblocks code within Scratch!


when gf clicked

say [Hello!] for (2) secs

broadcast [how to use scratch v] and wait

say [Scratch On!] for (2) secs

forever  

play sound [Ending Music v] until done

end

Cool! How do you make a source code?


http://i46.tinypic.com/14w5d2v.jpg

Offline

 

#95 2012-11-03 17:55:13

thebriculator
Scratcher
Registered: 2011-07-11
Posts: 500+

Re: Fully functional plugin to create scratchblocks code within Scratch!

Wow, I rarely modify Scratch and actually get it to work!


turn ccw (15) degrees


.     http://tiny.cc/2cwgpw    http://tiny.cc/viwgpw    http://tiny.cc/iwwgpw

Offline

 

#96 2012-11-03 17:58:26

thebriculator
Scratcher
Registered: 2011-07-11
Posts: 500+

Re: Fully functional plugin to create scratchblocks code within Scratch!

for people who have problems using it, copy it into notepad and save it as

"blocks.cs"

Somewhere in an easy-to remember place.
I couldn't select "cs" so I had to type it in manually.

Also, "Browse for the downloaded file" is a bit hard to explain; in the top bar navigate, not the lower one.


.     http://tiny.cc/2cwgpw    http://tiny.cc/viwgpw    http://tiny.cc/iwwgpw

Offline

 

#97 2012-11-04 04:00:33

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Fully functional plugin to create scratchblocks code within Scratch!

Yeah, the file browser is difficult to navigate.

Offline

 

#98 2013-01-01 18:29:48

GamemakerInc
Scratcher
Registered: 2012-06-13
Posts: 16

Re: Fully functional plugin to create scratchblocks code within Scratch!

Its not downlaoding
I press the link and all it says is a bunch of codes  hmm


Only epic games from GamemakerInc

Offline

 

#99 2013-01-14 19:46:29

minecraft761
Scratcher
Registered: 2012-10-22
Posts: 10

Re: Fully functional plugin to create scratchblocks code within Scratch!

when gf clicked
forever if <right mouse down?>
  move (10) steps
end

when gf clicked
forever if <left mouse down?>
  move (-10) steps
end

Offline

 

#100 2013-01-15 07:30:37

machinespray
Scratcher
Registered: 2012-05-09
Posts: 93

Re: Fully functional plugin to create scratchblocks code within Scratch!

Do you mind if I use it in my Scratch mod?


I am made a mod for Scratch. If you have any ideas for the mod please post it on this forum page.http://scratch.mit.edu/forums/viewtopic.php?id=108265http://internetometer.com/image/38591.png
I am http://blocks.scratchr.org/API.php?action=onlineStatus&amp;type=text&amp;user=machinespray

Offline

 
  • Index
  •  » Advanced Topics
  •  » Fully functional plugin to create scratchblocks code within Scratch!

Board footer