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!

#1 2012-07-22 09:43:18

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

Fully functional plugin to create scratchblocks code within Scratch!

After working a couple hours with the source code, I finally managed to develop a completely automatic feature to convert your graphical blocks to forum block code, within your Scratch program!

To install, download the plugin here and install it by filing it in (see my next post on this thread for instructions). Please note that if you have made previous changes to the blocks' right click menu, you must pay extreme care as to avoid overriding your menu! All other code is new however and there are no risks in installing this.

To use, right click on any block in the scripting pane (so drag 'em out of the palette first) and select "export as scratchblocks". The code of that block plus all blocks below it (as with the duplicate function) will be automatically copied to your clipboard!

Please note this is experimental. Although I have tested all blocks on the forums, there may be some bug I did not spot. Therefore, if you experience any kind of problem on your system, please tell me below.

I must remind you not to spam the forums with blocks, so keep the testing to this thread if you really must, but have fun using the plugin!

Offline

 

#2 2012-07-22 09:44:18

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

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

HOW TO INSTALL THE FILE ABOVE
First of all, if the link above took you to text inside a webpage, save that webpage as a CS file or copy the text into your text editor and then save it as a CS file.

Now, open Scratch.
Now, turn fill screen off. If you are on a normal Scratch, this is done with Shift-Click-R.
Then open the file browser (click on the black space, open, file list).
Navigate to the file you just downloaded. Right click it and select fileIn.
Have fun!

Last edited by LS97 (2012-07-26 04:27:00)

Offline

 

#3 2012-07-22 10:02:27

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

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

Cool, I'm excited to try it out!


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

Offline

 

#4 2012-07-22 12:29:37

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

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

Updated the instructions, if that's what held you back  smile

Offline

 

#5 2012-07-22 13:45:31

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

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

Oh, cool!  This is like my TBG Blocks plugin!
EDIT: oh, that's what it does...   sad   I thought it generated a scratchBlocksPlugin with your new blocks included.   sad

Last edited by GeonoTRON2000 (2012-07-22 15:25:03)


http://i.imgur.com/BAEgGDL.png

Offline

 

#6 2012-07-22 14:30:41

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

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

Very nice! I tested this with the block list and block plugin tester I used for testing Kurt. Everything worked except for the "broadcast" and "broadcast  and wait" blocks, which omit the message.  smile


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

Offline

 

#7 2012-07-22 17:04:30

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

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

blob8108 wrote:

Very nice! I tested this with the block list and block plugin tester I used for testing Kurt. Everything worked except for the "broadcast" and "broadcast  and wait" blocks, which omit the message.  smile

Ah, of course they do, they use a type of argument that isn't one I handled! I shall fix this when I have time  smile

Offline

 

#8 2012-07-22 18:21:20

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

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

Code:

(t1 isKindOf: EventTitleMorph)
    ifTrue: 
        [t2 nextPut: $[.
        t2 nextPutAll: t1 eventName.
        t2 nextPutAll: ' v]'].

— seems to do it. But I don't claim to be any good at Squeak.  smile

Including "Scratchblocks code generated using plugin by LS97" with each exported thing is really annoying...  tongue


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

Offline

 

#9 2012-07-23 00:22:44

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

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

This is pretty cool!


when I receive [StartGame v]

set [XVelocity v] to [0]

set [YVelocity v] to [0]

broadcast 

broadcast  and wait

show

switch to costume [normal v]

go to front

forever  

set [Gravity v] to [0.2]

switch to costume [sense v]

if <color [#00FF52] is touching [#000001]?> 

set [YVelocity v] to [-0.2]

end

if <color [#FF0000] is touching [#000001]?> 

set [XVelocity v] to [-0.2]

end

if <color [#0042FF] is touching [#000001]?> 

set [XVelocity v] to [0.2]

end

if <color [#FF0000] is touching [#FF9500]?> 

if <key [space v] pressed?> 

set [XVelocity v] to [-3]

set [YVelocity v] to [2]

end

end

if <color [#0042FF] is touching [#FF9500]?> 

if <key [space v] pressed?> 

set [XVelocity v] to [3]

set [YVelocity v] to [2]

end

end

if <color [#006363] is touching [#000001]?> 

set [YVelocity v] to [1]

change y by (YVelocity)

end

if <color [#630000] is touching [#000001]?> 

set [YVelocity v] to [-1]

end

if <color [#636300] is touching [#000001]?> 

set [XVelocity v] to [1]

end

if <color [#CE7300] is touching [#000001]?> 

set [XVelocity v] to [-1]

end

if <not <color [#8400FF] is touching [#000001]?>> 

change [YVelocity v] by (join [-] (Gravity))

change y by (YVelocity)

end

if <color [#8400FF] is touching [#000001]?> 

if <(YVelocity) < [-5]> 

set [XVelocity v] to [0]

set [YVelocity v] to [0]

broadcast  and wait

broadcast  and wait

end

set [YVelocity v] to [0]

if <key [space v] pressed?> 

if <touching color [#FF9500]?>

set [YVelocity v] to [4]

else

set [YVelocity v] to [2]

end

end

end

if <not <<key [a v] pressed?> or <key [d v] pressed?>>> 

switch to costume [normal v]

end

if <key [d v] pressed?> 

switch to costume [lookright v]

if <touching color [#00CC44]?>

change [XVelocity v] by (0.3)

else

if <(XVelocity) < [5]> 

change [XVelocity v] by (0.1)

end

end

end

if <key [a v] pressed?> 

switch to costume [lookleft v]

if <touching color [#00CC44]?>

change [XVelocity v] by (-0.3)

else

if <(XVelocity) > [-5]> 

change [XVelocity v] by (-0.1)

end

end

end

set [XVelocity v] to ((XVelocity) * (0.95))

change y by (YVelocity)

change x by (XVelocity)

if <key [w v] pressed?> 

if <touching [door v]?> 

broadcast  and wait

change [Level v] by (1)

set [XVelocity v] to [0]

set [YVelocity v] to [0]

broadcast 

broadcast  and wait

end

end

if <touching color [#FFFF00]?> 

set [XVelocity v] to [0]

set [YVelocity v] to [0]

broadcast  and wait

broadcast  and wait

end

if <touching [pain v]?> 

set [XVelocity v] to [0]

set [YVelocity v] to [0]

broadcast  and wait

broadcast  and wait

end

end


Hai.

Offline

 

#10 2012-07-23 01:04:13

samtwheels
Scratcher
Registered: 2011-03-20
Posts: 1000+

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

You should make one that imports scratchblocks code into scratch!

Offline

 

#11 2012-07-23 01:09:10

daniel_j
Scratcher
Registered: 2012-05-22
Posts: 100+

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

this is amazing, thankyou!


http://i50.tinypic.com/2dhgnsx.jpg

Offline

 

#12 2012-07-23 02:50:08

daniel_j
Scratcher
Registered: 2012-05-22
Posts: 100+

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

Eh, this is going to sound sooo noobish, but where is the clipboard? xD I'm use to text based languages and I just don't get scratch xD


http://i50.tinypic.com/2dhgnsx.jpg

Offline

 

#13 2012-07-23 05:25:52

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

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

daniel_j wrote:

Eh, this is going to sound sooo noobish, but where is the clipboard? xD I'm use to text based languages and I just don't get scratch xD

The clipboard is where stuff goes when you use copy/paste. Right click, choose "export scratchblocks", and then just right click in the forum "post" box and choose "paste".  smile


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

Offline

 

#14 2012-07-23 05:32:49

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

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

samtwheels wrote:

You should make one that imports scratchblocks code into scratch!

Again, I'm working on exactly that in Python.  tongue  It's quite complicated; a bit like writing a parser/compiler. The hardest part is dealing with booleans, because the less than/greater than symbol looks like the beginning/end of a boolean block:

Code:

if <(2)>(3)>

I've managed to deal with this by learning how proper parsers work, though.

Last edited by blob8108 (2012-07-23 05:34:23)


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

Offline

 

#15 2012-07-23 05:37:25

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

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

That looks very interesting and useful.


http://trinary.tk/images/signature_.php

Offline

 

#16 2012-07-23 05:53:08

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

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

blob8108 wrote:

Code:

(t1 isKindOf: EventTitleMorph)
    ifTrue: 
        [t2 nextPut: $[.
        t2 nextPutAll: t1 eventName.
        t2 nextPutAll: ' v]'].

— seems to do it. But I don't claim to be any good at Squeak.  smile

Including "Scratchblocks code generated using plugin by LS97" with each exported thing is really annoying...  tongue

It probably can do it, I shall update soon! Promise!

And yeah, sorry, I'll remove the text in the next update.

Offline

 

#17 2012-07-23 06:01:58

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

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

Updated!
Fixed broadcasts and removed credit text.

Offline

 

#18 2012-07-23 06:06:02

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

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

Cool! I'll add it now.


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#19 2012-07-23 06:44:27

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

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

Wow this is awesome! I tried to download it before but my chrome didn't want to show it's Save As dialogue box...  tongue  And it was acting strange and flash kept crashing and so did some tabs. It works fine now though.


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

#20 2012-07-23 07:01:44

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

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

It has a syntax error.


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#21 2012-07-23 07:11:00

PullJosh
Scratcher
Registered: 2011-08-01
Posts: 500+

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

Awesome! It works!


http://www.blocks.scratchr.org/API.php?action=text&amp;string=I'm_on_vacation!&amp;xpos=155&amp;ypos=90&amp;font_size=30&amp;bgimage=http://imageshack.us/a/img339/7215/sspeechsigapiforwords.png

Offline

 

#22 2012-07-23 07:55:31

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

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

LS97 wrote:

Updated!
Fixed broadcasts and removed credit text.

Cool! Adding the "copied to clipboard" message was a good idea, too. The first time I used your plugin I thought nothing had happened  tongue

It could get slightly annoying, though — perhaps add an option to disable it?


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

Offline

 

#23 2012-07-23 09:16:04

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

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

blob8108 wrote:

LS97 wrote:

Updated!
Fixed broadcasts and removed credit text.

Cool! Adding the "copied to clipboard" message was a good idea, too. The first time I used your plugin I thought nothing had happened  tongue

It could get slightly annoying, though — perhaps add an option to disable it?

Oh come on, I'm on holiday...  big_smile

Offline

 

#24 2012-07-23 09:17:11

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

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

LS97 wrote:

Oh come on, I'm on holiday...  big_smile

...you mean you don't do this for fun?  tongue


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

Offline

 

#25 2012-07-23 10:36:10

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

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

blob8108 wrote:

LS97 wrote:

Oh come on, I'm on holiday...  big_smile

...you mean you don't do this for fun?  tongue

Of course I do, otherwise I wouldn't have done it in the first place  wink
But it goes without saying that I prefer a swim in the pool or a day at the beach...

Offline

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

Board footer