This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-04-26 07:33:31

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

Writing into Scratch's data

Is it possible to code something that can edit the coding within the system browser? Maybe a "replace method []'s coding with [] block" or a "make new method with coding []" block. The goal is to make a "make a new block with blockspec [] and coding []" block.


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

Offline

 

#2 2011-04-26 07:35:31

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Writing into Scratch's data

Hardmath123 wrote:

Is it possible to code something that can edit the coding within the system browser? Maybe a "replace method []'s coding with [] block" or a "make new method with coding []" block. The goal is to make a "make a new block with blockspec [] and coding []" block.

thats what we're developing for Rocket!


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#3 2011-04-26 07:57:39

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

Re: Writing into Scratch's data

If we figured this out then Scratch blocks in the Library could be downloadable the same way as Panther!  yikes  big_smile
Don't forget (coding of [])

Offline

 

#4 2011-04-26 08:39:15

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

Re: Writing into Scratch's data

Ehm, is this succeeding?

I've tried to look for this code for ages, and failed!!!

Please, if there's any news, tell me.

Offline

 

#5 2011-04-26 09:13:15

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Writing into Scratch's data

I would do it this way.

Have a new set of block specs (new method) and a Ordered Collection (Smalltalk 1080's - squeak - list ). Then have a default set out for each type of block (reporter, standard, boolean and so on). When the user creates a block it add's the code to the list (Ordered Collection) and then edits the default layout and modifies the block spec.

Ordered Collection info.

Last edited by johnnydean1 (2011-04-26 10:40:11)


You can now reach me on Twitter @johnnydean1_

Offline

 

#6 2011-04-26 13:15:32

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

Re: Writing into Scratch's data

johnnydean1 wrote:

I would do it this way.

Have a new set of block specs (new method) and a Ordered Collection (Smalltalk 1080's - squeak - list ). Then have a default set out for each type of block (reporter, standard, boolean and so on). When the user creates a block it add's the code to the list (Ordered Collection) and then edits the default layout and modifies the block spec.

Ordered Collection info.

That's a great (but still complicated) solution for the posts issue, but I'd still be interested in the editing code...

Offline

 

#7 2011-04-26 14:03:27

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Writing into Scratch's data

I can get it working, if (its a big if) anyone can figure out 2 things.
set a variable to a single ' (1 quote mark)

and find a way of inserting variables into #() type lists.


You can now reach me on Twitter @johnnydean1_

Offline

 

#8 2011-04-27 02:50:46

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

Re: Writing into Scratch's data

Hmmm, setting a variable to a single quote seems impossible. What you can do is make a block 'set variable to []' and input a single quote.

Also, adding to #() lists should be possible by exploring the variable list. That basically adds to the list, too.

Last edited by Hardmath123 (2011-04-27 02:51:44)


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

Offline

 

#9 2011-04-28 12:54:50

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Writing into Scratch's data

Hardmath123 wrote:

Hmmm, setting a variable to a single quote seems impossible. What you can do is make a block 'set variable to []' and input a single quote.

Also, adding to #() lists should be possible by exploring the variable list. That basically adds to the list, too.

Well if it works, then its quite simple.


You can now reach me on Twitter @johnnydean1_

Offline

 

#10 2011-04-29 08:51:26

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Writing into Scratch's data

Untested but probably working code:

Code:

setMethodSource: t1 category: t2
| t3 |
t3 _ PluggableTextController new.
ScriptableScratchMorph compile: t1 classified: t2 notifying: t3.

This will only update methods in ScriptableScratchMorph. To use this with other classes, replace ScriptableScratchMorph with the class name.

Don't forget to include the method title in your code when using in a block, or you may crash something!

Maybe t3 could be replaced with nil? Have a go.

Last edited by TheSuccessor (2011-04-29 08:53:00)


/* No comment */

Offline

 

#11 2011-04-29 09:23:10

williambl
Scratcher
Registered: 2011-04-08
Posts: 100+

Re: Writing into Scratch's data

I will test!


http://internetometer.com/imagesmall/34650.png
http://www.danasoft.com/sig/Epicnesssign.jpg

Offline

 

#12 2011-04-29 09:51:20

williambl
Scratcher
Registered: 2011-04-08
Posts: 100+

Re: Writing into Scratch's data

Wait, where does that code go?


http://internetometer.com/imagesmall/34650.png
http://www.danasoft.com/sig/Epicnesssign.jpg

Offline

 

#13 2011-04-29 10:25:32

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Writing into Scratch's data

Let me do it.
Can't seem to get it working.

Last edited by johnnydean1 (2011-04-29 10:32:09)


You can now reach me on Twitter @johnnydean1_

Offline

 

#14 2011-04-29 10:32:23

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

Re: Writing into Scratch's data

What about reading source code?

Offline

 

#15 2011-04-29 11:46:05

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Writing into Scratch's data

LS97 wrote:

What about reading source code?

Just look in the source for the system browser (Tools-Browser -> Browser). That's also where I got the writing code from.

johnnydean1 wrote:

Let me do it.
Can't seem to get it working.

Did it cause an error? If so, please post it.

Last edited by TheSuccessor (2011-04-29 11:46:48)


/* No comment */

Offline

 

#16 2011-04-29 14:35:06

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Writing into Scratch's data

I have had 2 errors. They are both to do with a 'run' command.


You can now reach me on Twitter @johnnydean1_

Offline

 

#17 2011-04-30 04:14:54

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Writing into Scratch's data

johnnydean1 wrote:

I have had 2 errors. They are both to do with a 'run' command.

Can you post them please?


/* No comment */

Offline

 

Board footer