Since BYOB 1.0 I have been thinking to the possibility of defining new blocks' arguments by means of a block similar to the "and" block in the Operator category. Something like:
(when defining)
draw a parallelepiped with given < < <width> and <depth>> and <height> >
(when using)
draw a parallelepiped whose < < <width> is 10 and <depth> is 15> and <height> is 20 >
Offline
Jens wrote:
nestable sprites
- you can now create composite sprites (made out of sububsprites)
How do you nest sprites?
Last edited by henley (2009-08-24 20:18:42)
Offline
s_federici wrote:
Since BYOB 1.0 I have been thinking to the possibility of defining new blocks' arguments by means of a block similar to the "and" block in the Operator category. Something like:
(when defining)
draw a parallelepiped with given < < <width> and <depth>> and <height> >
(when using)
draw a parallelepiped whose < < <width> is 10 and <depth> is 15> and <height> is 20 >
Hi Stefano,
thanks for testing the BYOB release candidate!
Hmm, maybe I don't quite understand your suggestion, because you can define any number of arguments for a custom block in BYOB like in your example. Why would you need something like an 'and' block'? What BYOB cannot do, however, is take a list of values as argument. Maybe that's what you're suggesting? With the new string function it it now possible to parse an argument string within the custom block definition.
Offline
henley wrote:
How do you nest sprites?
Hi henley, there is a short introduction to nested sprites in one of the pdf's included in the download, along with some screenshots and illustrations. Basically you can stick one sprite to another one by dropping its library icon onto the new owner sprite (detach it by dropping its library icon on the stage).
Offline
Jens wrote:
you can define any number of arguments for a custom block in BYOB like in your example. Why would you need something like an 'and' block'?
Hi Jens,
my goal is to make argument definition as simple as the other parts of Scratch, that is I would like that it could be possible to define new block templates and arguments without having to use the % syntax (perfectly functional, but far from the ideal of intuitive and immediate programming environment that Scratch represents.)
Jens wrote:
With the new string function it it now possible to parse an argument string within the custom block definition.
This could work, but I would like to be able to show argument names in the block definition/usage. That is why I'm suggesting to use a structure similar to the one adopted by Scratch operators: you can define as many elements you like just by nesting operators. So, if an argument definition block like
< <> and <> >
could be made available under the "make a block" button (and maybe also duplicated in the block editor, just to make its usage simpler and its meaning more intuitive), you could define a sequence of arguments in the block specification just nesting as many argument definition blocks you like, for example
draw a parallelepiped with given < < <width> and <depth>> and <height> >
That is, the block name will have its dedicated box to type it in (the "draw a parallelepiped" string in this example) and a further box will be available in which to compose as many nested "< <> and <> >" blocks as needed.
The "< <> and <> >" block will be then dragged from below the "make a block" button (or from the "Custom block spec" dialog if it is duplicated there) and that will make the user able to type inside argument names. When OK is clicked, the Block Editor will show exactly as it is now.
When OK is finally clicked in the Block Editor, the new block will show up as follows
draw a parallelepiped whose <>
Below it, a new block
< <width/depth/heigth> is <> >
should be made available at the same time (the <width/depth/heigth> notation is for a drop down menu with all the names of the defined arguments, similar to the <set <> to <> > block).
Finally the user will be able to use the new block by building something like
draw a parallelepiped whose < < <width is 10> and <depth is 15> > and <height is 20 > >
by dragging the "<draw a parallelepiped whose <> >" block and filling the empty box with nested
< <> and <> >
and
< <width/depth/heigth> is <> >
blocks.
I hope this description is not so obscure. I will be happy to discuss it and improve it if you like.
Last edited by s_federici (2009-08-25 09:25:48)
Offline
Hi Stefano,
thanks for clarifying this! Parameter definition by having to use a parseable %parm string in BYOB is indeed suboptimal, and now what you're suggesting makes perfect sense to me. I've been racking my mind for quite some time how to define parameters in a drag'n'drop kind of way, but didn't come up with anything I really liked. Your idea, on the other hand, might just be the solution!
Thanks again for your explanation.
Offline
can u show mewhere global variables are or what they are ?
Offline
Jens wrote:
Your idea, on the other hand, might just be the solution!
Glad of being of help. If you are inspired by this proposal and would like to implement something similar in your excellent BYOB, do not hesitate to contact me (even only for testing and debugging). I have a federici.stefano account at gmail.com. In the next week I will be (finally!) studying Squeak's and Scratch's source code in depth to try to implement some new ideas (BTW, is 1.4 source code already available?)
Last edited by s_federici (2009-08-25 09:25:29)
Offline
When creating a block whose name contains accented chars (e.g. "è"), the resulting block name is something like "V@" (the first char looks like a square root).
Last edited by s_federici (2009-08-25 12:17:13)
Offline
Hi Jens,
Wow! I cannot help getting a flash-forward of where you could go with this!
Not sure about directed messages anymore. The code behind this is very simple and easy (which is nice....), but it also leads you away from parallelism (which IMO is Scratch's coolest trait)
Yes, Scratch concurrency is indeed very lovely, so natural you don't even realize you are using it! (Alice offers a much more conventional approach, although with relatively easy to use "Do Together" and "Do In Order" blocks).
However, I think the direction you proposed earlier is perfectly consistent. If I recall correctly, reporters (pure functions for return values) can be called synchronously, and commands (side-effect) can be called asynchronously. This gives the added flexibility of sprite-to-sprite interaction, with a slight Erlang-ish feel. Using global broadcast events is a good choice in only a few cases, imo. I would love to see & use this!
- Sophie
Offline
Jens wrote:
henley wrote:
How do you nest sprites?
Hi henley, there is a short introduction to nested sprites in one of the pdf's included in the download, along with some screenshots and illustrations. Basically you can stick one sprite to another one by dropping its library icon onto the new owner sprite (detach it by dropping its library icon on the stage).
Thanks! I always forget to look at the pdf.
Offline
I am interested in the inclusion of the Mesh feature. however, I need other people to have copies of the project to test it... I think? I am finding it difficult to find a place to share simple application versions of a project I made. I tried to host one on a web site and the computer sort of crashed.
Offline
if you could have included in sample projects a SINGLE demo of a project using the mesh feature, then lots of people could have had it. all I want is to be able to test the feature out.
Offline
Sorry, i dont know where to put this message...
can someone please make me a sprite page of soldiers, tanks,other army vechiles, army objects and weapons...
no matter what size
no matter how dark or how light
no matter how big or small
lol
credit will be given
Thanks
oh...and if u don't want to do a whole sprite page i dont care if u do some separate
Thanks
Offline
cannon wrote:
i am working on addind support for lego nxt to byob
Great! Let us know when you have a working prototype!
Offline
Why don't some of these features like nesting sprites to the main Scratch.
Offline
fullmoon wrote:
Doesn't "BYOB" stand for "Bring Your Own Beer"? Other than that, I am blown away! I'm supposed to be writing a Scratch presentation for school, but instead I think I'll spend the rest of the day playing with this . Thank you!!!
thats what i thought too.
Offline
Jens, I need your expert opinion on a possible development of Scratch. Do you think that a mechanism similar to the one I have described to add arguments to blocks by drag-n-drop could also be adapted to add arguments to "broadcast" blocks? Or could this be less clean and more difficult for some reason?
Offline
fullmoon wrote:
One "bug" I found: adding a colon ":" in a block spec will place the part of the block spec after the colon in a new number reporter inside the block header in edit mode. Try to drag the unwanted reporter out of the block header; it can't be done. I am using version 1.0.2.
I experimented around a little, and I discovered that this glitch works if you put ANY matching or unmatching symbols imediatly before and after a variable (like a%bc or [%)s).
Last edited by rubiks_cube_guy238 (2009-09-10 17:10:46)
Offline
I have a suggestion for BYOB:
Sprites always have a sensing block, ([x-position] of [sprite1]), right? Why don't you make that continue to blocks, with blocks' internal variables? As in: ([running] of [block "am I running"])
Offline
rubiks_cube_guy238 wrote:
I just discovered the weirdest glitch EVER in B.Y.O.B.. When I create a variable and name it %x I get a weird block that has a drop down menu. The options on the drop-down menu are 'record' and 're-record'. When I select 'record' it says 'Enter Scene Name.' I can't find another block that refers to a scene.
I was wondering about that "movie" block too :S
Last edited by terminator68 (2009-09-10 19:02:15)
Offline