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!

#26 2012-07-25 10:33:44

3sal2
Scratcher
Registered: 2012-03-22
Posts: 100+

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

How do you create new functions?


http://scratch.mit.edu/static/projects/3sal2/3120946_sm.png In 2012, scientists at the LHC discovered the Higgs boson, which explains the source of the masses of the W+, W-, and Z bosons, as well as fermions.

Offline

 

#27 2012-07-25 11:40:15

lallaway12
Scratcher
Registered: 2012-01-04
Posts: 500+

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

broadcast
v


http://i49.tinypic.com/2re4ied.png

Offline

 

#28 2012-07-25 11:43:27

lallaway12
Scratcher
Registered: 2012-01-04
Posts: 500+

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

SciTecCf wrote:

It has a syntax error.

Change the encoding in notepad to ANSI

Unlike normal patches if you are using the Add patch tool

(If you installed it!  wink  )


http://i49.tinypic.com/2re4ied.png

Offline

 

#29 2012-07-25 12:50:01

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

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

LS97 wrote:

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...

...are you sure you belong here?  tongue  (Just kidding, of course...)


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

Offline

 

#30 2012-07-25 12:52:48

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

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

lallaway12 wrote:

broadcast
v

That's actually a bug in the blocks plugin, I think. It's not in the list of bugs, though, for some reason...


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

Offline

 

#31 2012-07-25 15:53:00

Randomno
Scratcher
Registered: 2012-06-04
Posts: 39

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

The .cs isn't a download so I am confused. I tried filing in the code with the workspace, but it didn't work. All I get in the file list is the files in my Scratch folder.


http://img209.imageshack.us/img209/5524/randomno.png
I do stuff with stuff. I also stuff stuff.

Offline

 

#32 2012-07-25 15:54:30

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

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

Randomno wrote:

The .cs isn't a download so I am confused. I tried filing in the code with the workspace, but it didn't work. All I get in the file list is the files in my Scratch folder.

Well yeah, you can use the top left pane to navigate to the folder where you downloaded the CS file!

Offline

 

#33 2012-07-25 16:19:20

Randomno
Scratcher
Registered: 2012-06-04
Posts: 39

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

LS97 wrote:

Randomno wrote:

The .cs isn't a download so I am confused. I tried filing in the code with the workspace, but it didn't work. All I get in the file list is the files in my Scratch folder.

Well yeah, you can use the top left pane to navigate to the folder where you downloaded the CS file!

neutral  Like I said, the .cs file isn't a download.


http://img209.imageshack.us/img209/5524/randomno.png
I do stuff with stuff. I also stuff stuff.

Offline

 

#34 2012-07-25 16:50:47

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

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

Randomno wrote:

LS97 wrote:

Randomno wrote:

The .cs isn't a download so I am confused. I tried filing in the code with the workspace, but it didn't work. All I get in the file list is the files in my Scratch folder.

Well yeah, you can use the top left pane to navigate to the folder where you downloaded the CS file!

neutral  Like I said, the .cs file isn't a download.

Try saving the page...?


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

Offline

 

#35 2012-07-25 17:11:13

Randomno
Scratcher
Registered: 2012-06-04
Posts: 39

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

when clicked
stop all sounds
say
sqrt
of
var
for
size
of
var
secs

Well, saving the page worked. It doesn't say you have to do that, though.


http://img209.imageshack.us/img209/5524/randomno.png
I do stuff with stuff. I also stuff stuff.

Offline

 

#36 2012-07-26 04:25:24

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

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

Randomno wrote:

when clicked
stop all sounds
say
sqrt
of
var
for
size
of
var
secs

Well, saving the page worked. It doesn't say you have to do that, though.

I think it depends on the browser. Chrome automatically downloads it for me.

Offline

 

#37 2012-07-28 00:53:22

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

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

Bumping an awesome and useful topic  big_smile

Offline

 

#38 2012-07-28 11:58:45

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

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

Excellent idea!

Offline

 

#39 2012-07-29 14:00:28

IHeartGaming
Scratcher
Registered: 2010-07-23
Posts: 1000+

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

Thank you!


IHeartGaming

Offline

 

#40 2012-07-30 09:59:07

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

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

Very nice. I used it for the first time today.  smile
The only problem i had with it was that it added some sort of weird line break, which got interpreted as two when i pasted it into an HTML TEXTAREA.

Offline

 

#41 2012-07-30 10:01:16

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

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

blob8108 wrote:

lallaway12 wrote:

broadcast
v

That's actually a bug in the blocks plugin, I think. It's not in the list of bugs, though, for some reason...

It is there.

Offline

 

#42 2012-07-30 10:10:02

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

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

scimonster wrote:

Very nice. I used it for the first time today.  smile
The only problem i had with it was that it added some sort of weird line break, which got interpreted as two when i pasted it into an HTML TEXTAREA.

I think it has to do with your Operating system. I used Windows default CRLF...

Offline

 

#43 2012-07-30 10:18:05

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

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

LS97 wrote:

scimonster wrote:

Very nice. I used it for the first time today.  smile
The only problem i had with it was that it added some sort of weird line break, which got interpreted as two when i pasted it into an HTML TEXTAREA.

I think it has to do with your Operating system. I used Windows default CRLF...

I'm also using Windows. Perhaps your default is different then mine? Was it you who uses the AZERTY keyboard?

Offline

 

#44 2012-07-30 10:28:37

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

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

I found a bug...  tongue

when I receive
HTLoad
delete
all
of
HTArgs
delete
all
of
HTCommand
delete
all
of
HTVars
delete
all
of
Label
delete
all
of
My Code
set
i
to
0
repeat
length of
Code
change
i
by
1
set
j
to
1
repeat until
change
j
by
1
if
if
letter
j
+
4
of
item
i
of
Code
=
c
and
letter
j
+
5
of
item
i
of
Code
=
r
and
letter
j
+
6
of
item
i
of
Code
=
i
and
letter
j
+
7
of
item
i
of
Code
=
p
if
letter
j
+
8
of
item
i
of
Code
=
t
and
letter
j
+
9
of
item
i
of
Code
=
:
and
not
letter
j
+
10
of
item
i
of
Code
=
m
and
letter
j
+
11
of
item
i
of
Code
=
a
if
not
letter
j
+
12
of
item
i
of
Code
=
t
and
letter
j
+
13
of
item
i
of
Code
=
h
add
item
i
of
Code
to
My Code
set
i
to
1
hide
repeat until
i
>
length of
My Code
set
j
to
0
repeat until
letter
j
of
item
i
of
My Code
=
:
change
j
by
1
add
 
to
HTCommand
change
j
by
1
repeat until
letter
j
of
item
i
of
My Code
=
;
or
letter
j
of
item
i
of
My Code
=
=
or
letter
j
of
item
i
of
My Code
=
]
>
replace item
last
of
HTCommand
with
join
item
last
of
HTCommand
letter
j
of
item
i
of
My Code
change
j
by
1
if
not
letter
j
of
item
i
of
My Code
=
]
>
if
letter
j
of
item
i
of
My Code
=
=
change
j
by
1
add
 
to
Label
repeat until
letter
j
of
item
i
of
My Code
=
;
or
letter
j
of
item
i
of
My Code
=
]
>
replace item
last
of
Label
with
join
item
last
of
Label
letter
j
of
item
i
of
My Code
change
j
by
1
else
add
 
to
Label
change
j
by
1
add
 
to
HTArgs
set
temp1
to
0
repeat until
j
>
length of
item
i
of
My Code
-
1
if
letter
j
of
item
i
of
My Code
=
;
if
temp1
=
0
add
HT{end}
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
add
 
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
else
if
letter
j
of
item
i
of
My Code
=
%
if
temp1
=
0
if
item
last
of
HTArgs
=
 
replace item
last
of
HTArgs
with
HT{var}
else
add
HT{var}
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
add
 
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
set
temp1
to
1
else
if
item
last
of
HTArgs
=
 
replace item
last
of
HTArgs
with
HT{endVar}
else
add
HT{endVar}
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
add
 
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
set
temp1
to
0
else
if
boolOps
contains
letter
j
of
item
i
of
My Code
or
logicOps
contains
letter
j
of
item
i
of
My Code
or
Paren
contains
letter
j
of
item
i
of
My Code
or
letter
j
of
item
i
of
My Code
=
!
or
letter
j
of
item
i
of
My Code
=
"
if
item
last
of
HTArgs
=
 
replace item
last
of
HTArgs
with
letter
j
of
item
i
of
My Code
else
add
letter
j
of
item
i
of
My Code
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
add
 
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
else
replace item
last
of
HTArgs
with
join
item
last
of
HTArgs
letter
j
of
item
i
of
My Code
change
j
by
1
if
item
last
of
HTArgs
>
 
or
item
last
of
HTCommand
=
 
if
item
last
of
HTArgs
=
 
replace item
last
of
HTArgs
with
HT{end}
else
add
HT{end}
to
HTArgs
add
 
to
HTCommand
add
 
to
Label
else
add
 
to
Label
add
 
to
HTArgs
change
i
by
1
delete
all
of
HTRunStack
delete
all
of
HTRunStack_2
delete
all
of
HTVars
delete
all
of
HTVarValues
delete
all
of
HTLiveObject:Name
delete
all
of
HTLiveObject:Type
delete
all
of
HTLiveObject:Args
delete
all
of
HTLiveObject:OldArgs
set
i
to
0
set
HTErrorLine
to
0
set
isBoolean
to
0
repeat until
i
>
length of
HTCommand
change
i
by
1
if
item
i
of
HTCommand
=
onLoad
repeat until
item
i
of
HTCommand
=
end_onLoad
change
i
by
1
else
broadcast
join
HTEval:
item
i
of
HTCommand
and wait


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

Offline

 

#45 2012-07-30 12:23:37

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

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

blob8108 wrote:

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.

The way the forum plugin does it is by replacing
) > ( with ) &gt; (, ) < ( with ) &lt; (, ] > [ with ] &gt; [, ] > ( with ] &lgt; (, and so on thit all the possible combinations of ] or ) followed by < or > followed by [ or (


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#46 2012-07-30 14:40:01

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

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

scimonster wrote:

LS97 wrote:

scimonster wrote:

Very nice. I used it for the first time today.  smile
The only problem i had with it was that it added some sort of weird line break, which got interpreted as two when i pasted it into an HTML TEXTAREA.

I think it has to do with your Operating system. I used Windows default CRLF...

I'm also using Windows. Perhaps your default is different then mine? Was it you who uses the AZERTY keyboard?

Yeah, that's me, but the keyboard has absolutely no effect on line breaks. Are you using Firefox? Maybe it uses different standards of breaking lines...

@Mathwizz: LOL, I doubt anybody will need to paste all that code on the forums... besides, is the bug in my plugin or in the parser?  wink

Offline

 

#47 2012-07-30 16:14:23

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

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

when clicked
go to x:
0
y:
-90
set
xv
to
0
set
yv
to
0
forever
set
bleh
to
0
if
key
left arrow
pressed?
change
xv
by
-0.7
if
key
right arrow
pressed?
change
xv
by
0.7
set
xv
to
xv
*
0.9
change x by
xv
if
touching color
?
change y by
1
change
bleh
by
1
if
touching color
?
change y by
1
change
bleh
by
1
if
touching color
?
change y by
1
change
bleh
by
1
if
touching color
?
change y by
1
change
bleh
by
1
if
touching color
?
change y by
1
change
bleh
by
1
if
touching color
?
change x by
xv
*
-1
set
xv
to
0
change y by
-5
if
key
up arrow
pressed?
change x by
5
set
c n
to
-5
if
touching color
?
set
xv
to
-10
set
yv
to
12
else
change x by
-10
set
c n
to
5
if
touching color
?
set
xv
to
10
set
yv
to
12
change x by
c n
else
change
xv
by
0
-
xv
/
bleh
else
set
yv
to
yv
*
0.9
change y by
yv
if
touching color
?
change y by
yv
*
-1
set
yv
to
0
change y by
-1
if
key
up arrow
pressed?
if
touching color
?
set
yv
to
12
change y by
1
if
yv
<
4
change y by
-1
if
not
touching color
?
change
yv
by
-1
change y by
1

Testing this. (BTW perfect platformer script above XD)


........................................................................................................................................................................................................................................

Offline

 

#48 2012-07-30 16:40:47

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

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

Wow, this is really impressive LS97! Quite a useful plugin to have - kudos to you for making it. I hope the Scratch Team adds something like this to Scratch 2.0! Here's a brief test with one of my projects I made to practice vocabulary:

when clicked
delete
all
of
Log
delete
all
of
wordsleft
add
To use this program, you will type in a vocabulary word, given the definition.
to
Log
add
Spelling does count!
to
Log
add
You will need to successfully need to identify each word TWO times minimum in order to remove it from the list of words to do.
to
Log
add
If you get a word wrong, if you previously had to complete it four times, than you would afterwards have to do it 5 times.
to
Log
add
This helps you study the words you need most help with.
to
Log
add
Press enter to continue.
to
Log
ask
 
and wait
add
Loading...
to
Log
repeat
2
set
i
to
1
repeat
length of
english
add
i
to
wordsleft
change
i
by
1
set
i
to
pick random
1
to
length of
wordsleft
repeat until
length of
wordsleft
=
0
add
join
join
What word means "
item
item
i
of
wordsleft
of
spanish
?"
to
Log
ask
 
and wait
if
item
item
i
of
wordsleft
of
english
=
answer
add
join
join
join
join
Good job! "
item
item
i
of
wordsleft
of
english
" means "
item
item
i
of
wordsleft
of
spanish
." Press enter to continue.
to
Log
ask
 
and wait
delete
i
of
wordsleft
else
add
join
join
join
join
Sorry, the word "
item
item
i
of
wordsleft
of
english
" means "
item
item
i
of
wordsleft
of
spanish
." Press enter to continue.
to
Log
ask
 
and wait
add
item
i
of
wordsleft
to
wordsleft
set
i
to
pick random
1
to
length of
wordsleft
add
You have completed the program.
to
Log

I can't see any problems (except for some graphical issues with the plugin itself). One thing I noticed is that all of the blocks are spaced out with a line in between each other - which although a bit of a hassle to remove, it still gets the job done.


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

Offline

 

#49 2012-07-30 17:00:49

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

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

Thanks for your opinions and tests, guys!

It seems to me that the last two scripts were converted perfectly by the plugin. The blank ask block in Lucario's script left me perplexed, but I figure it's also done in the original script (which makes sense, since it looks nicer).

This spacing issue has already been reported by scimonster. What browsers are you guys using? In any case remember blank lines don't actually affect the renderer, so blocks get parsed anyway.

Having such feature in Scratch 2.0 (as well as vice versa -- copying the text of a scratchblocks into Scratch, which I would happily create a plugin for too if it weren't for its current futility for reasons stated at asterisk*) would really be nice. You guys, being mods, don't happen to have any news/influence on this matter?

*Asterisk. I would have created a plugin to parse scratchblocks code and spawn a script, but I found the costs outweighed the benefits. This is because the user that wants the scratchblocks code must either view the wiki source or quote the forum user to get raw code, as selecting the text of the blocks and copying that instead does not work.

However, I thought of a mechanism that would allow such copying supported by all browsers. Shouldn't it be possible to hide brackets and other symbols used in scratchblocks code as invisible text in the rendered version? That way it wouldn't affect viewing, but would be copied when selected.

Anyway, that was a way too long footnote.

Offline

 

#50 2012-07-30 17:10:06

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

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

You're welcome  smile  Another test:

A binary to image converter me and my friend made

when clicked
delete
all
of
#'s
clear
set
brightness
effect to
0
go to x:
96
y:
104
stamp
repeat
9
change x by
4
stamp
repeat
9
change y by
-4
stamp
repeat
9
change x by
-4
stamp
repeat
9
change y by
4
stamp
ask
Input #
and wait
set
Input #
to
answer
set
teh number
to
2
if
answer
mod
2
=
1
add
1
to
#'s
else
add
0
to
#'s
repeat
63
if
round
answer
/
teh number
-
0.5
mod
2
=
1
add
1
to
#'s
else
add
0
to
#'s
set
teh number
to
teh number
*
2
go to x:
100
y:
100
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
repeat
7
change x by
4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
change y by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
repeat
7
change x by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
change y by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
repeat
7
change x by
4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
change y by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
repeat
7
change x by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
change y by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
repeat
7
change x by
4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
change y by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
repeat
7
change x by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
change y by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
repeat
7
change x by
4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
change y by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
repeat
7
change x by
-4
if
item
1
of
#'s
=
1
set
brightness
effect to
100
stamp
else
set
brightness
effect to
-100
delete
1
of
#'s
go to x:
96
y:
104
set
brightness
effect to
0


........................................................................................................................................................................................................................................

Offline

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

Board footer