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

#1 2012-08-05 10:32:04

KKdevelopers
New Scratcher
Registered: 2012-07-23
Posts: 67

Coding BYOB blocks into squeak that can run in scratch mods

i need to code these into something that'll work in scratch
http://www.filedropper.com/setvelocity
http://www.filedropper.com/chngey
http://www.filedropper.com/chngex

Offline

 

#2 2012-08-05 13:47:22

KKdevelopers
New Scratcher
Registered: 2012-07-23
Posts: 67

Re: Coding BYOB blocks into squeak that can run in scratch mods

bump

Offline

 

#3 2012-08-05 14:17:42

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

It's impossible to make it work online, remember that.

For personal offline use, you can easily figure out the method selectors for each of the used blocks in BYOB and write them into a new method in Scratch.

For example, if the script is:

move (10) steps
turn cw (20) degrees
You can replicate the same functions in a method using:
self forward: 10.
self turnRight: 20.

Offline

 

#4 2012-08-05 15:03:25

KKdevelopers
New Scratcher
Registered: 2012-07-23
Posts: 67

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

It's impossible to make it work online, remember that.

For personal offline use, you can easily figure out the method selectors for each of the used blocks in BYOB and write them into a new method in Scratch.

For example, if the script is:

move (10) steps
turn cw (20) degrees
You can replicate the same functions in a method using:
self forward: 10.
self turnRight: 20.

k thx

Offline

 

#5 2012-08-05 15:14:08

KKdevelopers
New Scratcher
Registered: 2012-07-23
Posts: 67

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

It's impossible to make it work online, remember that.

For personal offline use, you can easily figure out the method selectors for each of the used blocks in BYOB and write them into a new method in Scratch.

For example, if the script is:

move (10) steps
turn cw (20) degrees
You can replicate the same functions in a method using:
self forward: 10.
self turnRight: 20.

would i do this like this?
example:
setvelocity: x:t1 y:t2

Offline

 

#6 2012-08-05 15:57:06

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Coding BYOB blocks into squeak that can run in scratch mods

KKdevelopers wrote:

LS97 wrote:

It's impossible to make it work online, remember that.

For personal offline use, you can easily figure out the method selectors for each of the used blocks in BYOB and write them into a new method in Scratch.

For example, if the script is:

move (10) steps
turn cw (20) degrees
You can replicate the same functions in a method using:
self forward: 10.
self turnRight: 20.

would i do this like this?
example:
setvelocity: x:t1 y:t2

No.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#7 2012-08-05 17:00:33

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

KKdevelopers wrote:

LS97 wrote:

It's impossible to make it work online, remember that.

For personal offline use, you can easily figure out the method selectors for each of the used blocks in BYOB and write them into a new method in Scratch.

For example, if the script is:

move (10) steps
turn cw (20) degrees
You can replicate the same functions in a method using:
self forward: 10.
self turnRight: 20.

would i do this like this?
example:
setvelocity: x:t1 y:t2

The title of the method could be something like

[setVelocityX: t1 y: t2]
but under that you would need to put the code for each of the blocks that make up the BYOB blocks!

Offline

 

#8 2012-08-05 17:18:29

scratcher7_14
New Scratcher
Registered: 2011-10-25
Posts: 5

Re: Coding BYOB blocks into squeak that can run in scratch mods

This looks like it would be useful, especially if it was generalized.

Offline

 

#9 2012-08-06 06:43:33

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

scratcher7_14 wrote:

This looks like it would be useful, especially if it was generalized.

It definitely would!
Hmmm... The plugin I made for scratchblocks code already offers a good base for me/someone to work on expanding it to this purpose!

Is it worth the effort, especially with the imminent release of 2.0? Maybe we should forget Squeak altogether by now.

Offline

 

#10 2012-08-06 06:46:09

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

scratcher7_14 wrote:

This looks like it would be useful, especially if it was generalized.

It definitely would!
Hmmm... The plugin I made for scratchblocks code already offers a good base for me/someone to work on expanding it to this purpose!

That's why I made Scramble.

Is it worth the effort, especially with the imminent release of 2.0? Maybe we should forget Squeak altogether by now.

That's why I gave up on it.


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

Offline

 

#11 2012-08-06 07:47:03

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

Hardmath123 wrote:

LS97 wrote:

scratcher7_14 wrote:

This looks like it would be useful, especially if it was generalized.

It definitely would!
Hmmm... The plugin I made for scratchblocks code already offers a good base for me/someone to work on expanding it to this purpose!

That's why I made Scramble.

Is it worth the effort, especially with the imminent release of 2.0? Maybe we should forget Squeak altogether by now.

That's why I gave up on it.

I see! That's a nice script that I'd seen before but forgotten it existed.
What's wrong with it / needs adding to it?

Offline

 

#12 2012-08-06 11:17:31

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

Hardmath123 wrote:

LS97 wrote:


It definitely would!
Hmmm... The plugin I made for scratchblocks code already offers a good base for me/someone to work on expanding it to this purpose!

That's why I made Scramble.

Is it worth the effort, especially with the imminent release of 2.0? Maybe we should forget Squeak altogether by now.

That's why I gave up on it.

I see! That's a nice script that I'd seen before but forgotten it existed.
What's wrong with it / needs adding to it?

Nothing's "wrong", but I had my heart set on drag and drop or something cool like that in the future; forms are a bit outdated these days. I suppose version 3.0 could actually be a Scratch patch which turns a script into its Squeak code. Would you mind helping me out? I'm horrid at Squeak.  smile


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

Offline

 

#13 2012-08-06 15:33:54

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

Hardmath123 wrote:

LS97 wrote:

Hardmath123 wrote:

LS97 wrote:

It definitely would!
Hmmm... The plugin I made for scratchblocks code already offers a good base for me/someone to work on expanding it to this purpose!

That's why I made Scramble.

That's why I gave up on it.

I see! That's a nice script that I'd seen before but forgotten it existed.
What's wrong with it / needs adding to it?

Nothing's "wrong", but I had my heart set on drag and drop or something cool like that in the future; forms are a bit outdated these days. I suppose version 3.0 could actually be a Scratch patch which turns a script into its Squeak code. Would you mind helping me out? I'm horrid at Squeak.  smile

You'v never refused to help me with my math, and I'd love to help with this!

I don't know if you've actually managed to run my scratchblocks plugin in the end, but that could definitely be used as a starting point. After that, it should be easy: we just take arguments in order and plug them into the selectors after each colon.

Do you feel like working on it together and name it Scramble, or should I just work on it by myself since it sounds like the job isn't really worth putting effort into a collab  tongue

Offline

 

#14 2012-08-06 20:57:54

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

Hardmath123 wrote:

LS97 wrote:


I see! That's a nice script that I'd seen before but forgotten it existed.
What's wrong with it / needs adding to it?

Nothing's "wrong", but I had my heart set on drag and drop or something cool like that in the future; forms are a bit outdated these days. I suppose version 3.0 could actually be a Scratch patch which turns a script into its Squeak code. Would you mind helping me out? I'm horrid at Squeak.  smile

You've never refused to help me with my math, and I'd love to help with this!

I don't know if you've actually managed to run my scratchblocks plugin in the end, but that could definitely be used as a starting point. After that, it should be easy: we just take arguments in order and plug them into the selectors after each colon.

Do you feel like working on it together and name it Scramble, or should I just work on it by myself since it sounds like the job isn't really worth putting effort into a collab  tongue

I looked at your source, and though I can more or less figure out how it works, most of it just went over my head. I'm sure you know your code better, so I'm going to leave this in your hands. Since you won't be able to use both your plugin and the new Scramble together because of the menu changes, you ought to just combine Scramble and your plugin into one nice patch. A couple things to note, though, are that if there are timed blocks you'll need special blockspecs and special code; and that your code should ignore the hat block on top. Good luck, and thanks!  smile


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

Offline

 

#15 2012-08-07 03:40:48

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

Hardmath123 wrote:

I looked at your source, and though I can more or less figure out how it works, most of it just went over my head. I'm sure you know your code better, so I'm going to leave this in your hands. Since you won't be able to use both your plugin and the new Scramble together because of the menu changes, you ought to just combine Scramble and your plugin into one nice patch. A couple things to note, though, are that if there are timed blocks you'll need special blockspecs and special code; and that your code should ignore the hat block on top. Good luck, and thanks!  smile

OK, I will try  smile

Combining the two was exactly what I was doing, maybe even in the future with a whole "export" menu and various sub-entries.

Timed blocks could be a problem, especially since I was planning on making this atomic. maybe the wait block could be replaced by the squeak Sleep function, or ignored altogether?

Another issue I came across yesterday (when I started development) was the say block; it has a different number of arguments than its method and it's a special block, which means the execution engine should be working to handle it. Maybe it's better if I replace it with code of my own there as well!

Then there's the ask block. It is impossible to keep it in a single method because it would freeze the VM and the user wouldn't be able to type anything in. Should I replace that with an input dialog?

Stop script would be translated to ^false.

Then I would manually change repeats, wait until, etc.

How would I do the forever block?

Offline

 

#16 2012-08-07 08:37:53

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

Hardmath123 wrote:

I looked at your source, and though I can more or less figure out how it works, most of it just went over my head. I'm sure you know your code better, so I'm going to leave this in your hands. Since you won't be able to use both your plugin and the new Scramble together because of the menu changes, you ought to just combine Scramble and your plugin into one nice patch. A couple things to note, though, are that if there are timed blocks you'll need special blockspecs and special code; and that your code should ignore the hat block on top. Good luck, and thanks!  smile

OK, I will try  smile

Combining the two was exactly what I was doing, maybe even in the future with a whole "export" menu and various sub-entries.

Timed blocks could be a problem, especially since I was planning on making this atomic. maybe the wait block could be replaced by the squeak Sleep function, or ignored altogether?

Another issue I came across yesterday (when I started development) was the say block; it has a different number of arguments than its method and it's a special block, which means the execution engine should be working to handle it. Maybe it's better if I replace it with code of my own there as well!

Then there's the ask block. It is impossible to keep it in a single method because it would freeze the VM and the user wouldn't be able to type anything in. Should I replace that with an input dialog?

Stop script would be translated to ^false.

Then I would manually change repeats, wait until, etc.

How would I do the forever block?

Wow, that's a lot of problems I didn't think of. Lemme see.
Timed blocks should probably be ignored, and atomic blocks sound good to me. The say block (you mean the timed say block, right?) should be translated into a non-timed say block, which I believe is a normal method. Correct me if I'm mistaken there. Replacing the ask block with a dialog is a wonderful idea. Finally, I think forever should raise an exception and simply not be allowed.

Another problem would be glide and sound blocks. How are you going to handle those?

Last edited by Hardmath123 (2012-08-07 10:30:31)


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

Offline

 

#17 2012-08-07 10:34:52

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

That's a lot of problems indeed!

So, forever and other timed blocks will raise a warning and be converted into their non-timed equivalents. Glide could probably become a goto, and sound blocks will trigger a sound but won't wait for it to finish.

I got the basics perfectly working now. All non-special blocks compile as they should and work with arguments and other encased blocks. It's a shame those other blocks will have to be treated manually  tongue

Offline

 

#18 2012-08-07 11:14:47

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

I got the basics perfectly working now.

Already? You're amazing.  smile

Also, have you implemented Squeak comments? (To be honest, I don't know how comments are represented in Scratch, but if they're part of the script they may mess up your code.)


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

Offline

 

#19 2012-08-07 13:01:41

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

Hardmath123 wrote:

LS97 wrote:

I got the basics perfectly working now.

Already? You're amazing.  smile

Also, have you implemented Squeak comments? (To be honest, I don't know how comments are represented in Scratch, but if they're part of the script they may mess up your code.)

I haven't implemented neither variables nor comments yet, and doubt I'll do the latter.
Should I use Scratch variables or should I translate variables to Squeak temporary vars?

Offline

 

#20 2012-08-07 21:40:31

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

Hardmath123 wrote:

LS97 wrote:

I got the basics perfectly working now.

Already? You're amazing.  smile

Also, have you implemented Squeak comments? (To be honest, I don't know how comments are represented in Scratch, but if they're part of the script they may mess up your code.)

I haven't implemented neither variables nor comments yet, and doubt I'll do the latter.
Should I use Scratch variables or should I translate variables to Squeak temporary vars?

...

I don't know. Can you tell the difference between Scratch Global and Scratch Local variables? If so, you can temp-ify local variables only.


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

Offline

 

#21 2012-08-08 07:31:01

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

Hardmath123 wrote:

LS97 wrote:

Hardmath123 wrote:


Already? You're amazing.  smile

Also, have you implemented Squeak comments? (To be honest, I don't know how comments are represented in Scratch, but if they're part of the script they may mess up your code.)

I haven't implemented neither variables nor comments yet, and doubt I'll do the latter.
Should I use Scratch variables or should I translate variables to Squeak temporary vars?

...

I don't know. Can you tell the difference between Scratch Global and Scratch Local variables? If so, you can temp-ify local variables only.

Yeah, I can tell the difference. But then what's really the point of doing half and half...

Offline

 

#22 2012-08-08 10:53:23

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

Hardmath123 wrote:

LS97 wrote:


I haven't implemented neither variables nor comments yet, and doubt I'll do the latter.
Should I use Scratch variables or should I translate variables to Squeak temporary vars?

...

I don't know. Can you tell the difference between Scratch Global and Scratch Local variables? If so, you can temp-ify local variables only.

Yeah, I can tell the difference. But then what's really the point of doing half and half...

True. Maybe you could ask users to prefix all temporary variables with "_" or "#".


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

Offline

 

#23 2012-08-09 12:04:17

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

Hardmath123 wrote:

LS97 wrote:

Hardmath123 wrote:


...

I don't know. Can you tell the difference between Scratch Global and Scratch Local variables? If so, you can temp-ify local variables only.

Yeah, I can tell the difference. But then what's really the point of doing half and half...

True. Maybe you could ask users to prefix all temporary variables with "_" or "#".

Even more complicated  tongue
Really, the only choices I have is dump 'em all into the code or use Scratch's.

Besides, I already got bored of it  tongue  Working on a small screen while you're supposed to be on holidays isn't really very nice, so I will resume work when I get back.

Offline

 

#24 2012-08-09 20:30:23

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

LS97 wrote:

Hardmath123 wrote:

LS97 wrote:


Yeah, I can tell the difference. But then what's really the point of doing half and half...

True. Maybe you could ask users to prefix all temporary variables with "_" or "#".

Even more complicated  tongue
Really, the only choices I have is dump 'em all into the code or use Scratch's.

Besides, I already got bored of it  tongue  Working on a small screen while you're supposed to be on holidays isn't really very nice, so I will resume work when I get back.

Sure, enjoy your vacation!  smile  I never take my computer on a trip.


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

Offline

 

#25 2012-08-10 04:45:46

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

Re: Coding BYOB blocks into squeak that can run in scratch mods

Hardmath123 wrote:

LS97 wrote:

Hardmath123 wrote:


True. Maybe you could ask users to prefix all temporary variables with "_" or "#".

Even more complicated  tongue
Really, the only choices I have is dump 'em all into the code or use Scratch's.

Besides, I already got bored of it  tongue  Working on a small screen while you're supposed to be on holidays isn't really very nice, so I will resume work when I get back.

Sure, enjoy your vacation!  smile  I never take my computer on a trip.

I used to not (if that makes sense), but now that the school gave us netbooks... it's just too practical!

Maybe not a good habit.

Offline

 

Board footer