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
No problem! If you look at the pile of unfinished stuff I have, you may faint.
Offline
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!
SorryNo problem! If you look at the pile of unfinished stuff I have, you may faint.
Hehe. I have more. :3
Offline
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!
SorryNo problem! If you look at the pile of unfinished stuff I have, you may faint.
Hehe. I have more. :3
How do you know?
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
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 Not impossible, though. I've nearly finished my parser in Python
Maybe see if there's something like a Javascript version of lex/yacc...?
Offline
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
LiquidMetal wrote:
Shouldn't it be relatively simple to do that the other way around as well?
Trust me, it's not 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.
But it certainly could be done; especially if there's a good lex/yacc implementation for Squeak...
Offline
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
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.
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
Offline
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.
Offline
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.
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
That's absolutely true 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...
Offline
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.
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
That's absolutely true 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...
That's very clever
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... see other advanced topics thread by me
Offline
LS97 wrote:
I did make a blocks2squeak in the meantime... see other advanced topics thread by me
blocks2squeak sounds cool. How do you deal with "wait until", "ask" blocks, and the like?
Offline
blob8108 wrote:
LS97 wrote:
I did make a blocks2squeak in the meantime... 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
LS97 wrote:
blob8108 wrote:
LS97 wrote:
I did make a blocks2squeak in the meantime... 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.
Offline
cool thing!
Offline
How do I use it after it's been installed?
Offline
ImagineIt wrote:
How do I use it after it's been installed?
I'm having the same problem.
Offline
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
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 endCool! How do you make a source code?
Offline
Wow, I rarely modify Scratch and actually get it to work!
turn ccw (15) degrees
Offline
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.
Offline
Yeah, the file browser is difficult to navigate.
Offline
Its not downlaoding
I press the link and all it says is a bunch of codes
Offline
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
Do you mind if I use it in my Scratch mod?
Offline