Discuss Scratch
- Discussion Forums
- » Suggestions
- » Advanced Make A Block, Hashed Lists and string split
- kidomat43
- Scratcher
22 posts
Advanced Make A Block, Hashed Lists and string split
At the moment “make a block” is only that, a block. It can not return a value.
It would be good if you can define a block as a number block or a boolean block and then use a return <hello world> block found in the make a block tab.
A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.
String split would be an excellent feature, as it allows you to split up a string into a list.
ie:
split <hello world> using < > into <my_list^>
which would add “hello” and “world” in to “my_list” - the space is the separator.
Currently the only way of doing this is parsing a string, which is very slow unless scratch is in turbo.
See www.scratch.mit.edu/projects/kidomat43/3223093 for an example (EditQueue sprite)
It would be good if you can define a block as a number block or a boolean block and then use a return <hello world> block found in the make a block tab.
A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.
String split would be an excellent feature, as it allows you to split up a string into a list.
ie:
split <hello world> using < > into <my_list^>
which would add “hello” and “world” in to “my_list” - the space is the separator.
Currently the only way of doing this is parsing a string, which is very slow unless scratch is in turbo.
See www.scratch.mit.edu/projects/kidomat43/3223093 for an example (EditQueue sprite)
Last edited by kidomat43 (April 4, 2013 13:26:50)
- bullelk12
- Scratcher
100+ posts
Advanced Make A Block, Hashed Lists and string split
At the moment “make a block” is only that, a block. It can not return a value.
It would be good if you can define a block as a number block or a boolean block and then use a return <hello world> block found in the make a block tab.
A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.
String split would be an excellent feature, as it allows you to split up a string into a list.
ie:
split <hello world> using < > into <my_list^>
which would add “hello” and “world” in to “my_list” - the space is the separator.
Currently the only way of doing this is parsing a string, which is very slow unless scratch is in turbo.
See www.scratch.mit.edu/projects/kidomat43/3223093 for an example (EditQueue sprite)
You can easily create a custom block that will parse words into single words or characters.
Scratch 2.0 = Cloud Variables!
- P110
- Scratcher
1000+ posts
Advanced Make A Block, Hashed Lists and string split
It is very easy and you can also make it output a value using variables, just make it set a variable in the blockAt the moment “make a block” is only that, a block. It can not return a value.
It would be good if you can define a block as a number block or a boolean block and then use a return <hello world> block found in the make a block tab.
A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.
String split would be an excellent feature, as it allows you to split up a string into a list.
ie:
split <hello world> using < > into <my_list^>
which would add “hello” and “world” in to “my_list” - the space is the separator.
Currently the only way of doing this is parsing a string, which is very slow unless scratch is in turbo.
See www.scratch.mit.edu/projects/kidomat43/3223093 for an example (EditQueue sprite)
You can easily create a custom block that will parse words into single words or characters.
- P110
- Scratcher
1000+ posts
Advanced Make A Block, Hashed Lists and string split
Here is a simple script I made, it splits a string into each word by the space in-between, I can make the splitter customize-able, then, it sees if any of the words are registered as bad if they are it sets the variable, “censor” to true and then changes the background, yes, I know I spelt it wrong.
Here is the project
Here is the project
Last edited by P110 (April 5, 2013 08:23:05)
- Dark_Star
- Scratcher
9 posts
Advanced Make A Block, Hashed Lists and string split
What you're proposing it basically like what Snap! (Also known as Build Your Own Blocks) does. It has custom booleans and reporters, something Scratch 2.0 really should have. I support. While there are perhaps workarounds, it would be much easier to do it directly.
- bullelk12
- Scratcher
100+ posts
Advanced Make A Block, Hashed Lists and string split
What you're proposing it basically like what Snap! (Also known as Build Your Own Blocks) does. It has custom booleans and reporters, something Scratch 2.0 really should have. I support. While there are perhaps workarounds, it would be much easier to do it directly.
Agreed
Scratch 2.0 = Cloud Variables!
- kidomat43
- Scratcher
22 posts
Advanced Make A Block, Hashed Lists and string split
At the moment “make a block” is only that, a block. It can not return a value.
It would be good if you can define a block as a number block or a boolean block and then use a return <hello world> block found in the make a block tab.
A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.
String split would be an excellent feature, as it allows you to split up a string into a list.
ie:
split <hello world> using < > into <my_list^>
which would add “hello” and “world” in to “my_list” - the space is the separator.
Currently the only way of doing this is parsing a string, which is very slow unless scratch is in turbo.
See www.scratch.mit.edu/projects/kidomat43/3223093 for an example (EditQueue sprite)
@bullelk12, @P110 please read my post fully.
Yes, I know it is possible with the current script. I said it in the post. BUT IT IS VERY SLOW.
Last edited by kidomat43 (April 5, 2013 16:52:41)
- P110
- Scratcher
1000+ posts
Advanced Make A Block, Hashed Lists and string split
Erm my only response can be I agree, it would be coolAt the moment “make a block” is only that, a block. It can not return a value.
It would be good if you can define a block as a number block or a boolean block and then use a return <hello world> block found in the make a block tab.
A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.
String split would be an excellent feature, as it allows you to split up a string into a list.
ie:
split <hello world> using < > into <my_list^>
which would add “hello” and “world” in to “my_list” - the space is the separator.
Currently the only way of doing this is parsing a string, which is very slow unless scratch is in turbo.
See www.scratch.mit.edu/projects/kidomat43/3223093 for an example (EditQueue sprite)
@bullelk12, @P110 please read my post fully.
Yes, I know it is possible with the current script. I said it in the post. BUT IT IS VERY SLOW.
Last edited by P110 (April 7, 2013 10:33:57)
- SuperJedi224
- Scratcher
100+ posts
Advanced Make A Block, Hashed Lists and string split
Yes It would be good if you can define a block as a number block or a boolean block and then use a return block found in the make a block tab.
A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.Like a js object? I'm not sure scratch needs something like this.
String split would be an excellent feature, as it allows you to split up a string into a list.This would also be nice.
- SFollis
- Scratcher
500+ posts
Advanced Make A Block, Hashed Lists and string split
unless it is an atomic custom block =PAt the moment “make a block” is only that, a block. It can not return a value.
It would be good if you can define a block as a number block or a boolean block and then use a return <hello world> block found in the make a block tab.
A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.
String split would be an excellent feature, as it allows you to split up a string into a list.
ie:
split <hello world> using < > into <my_list^>
which would add “hello” and “world” in to “my_list” - the space is the separator.
Currently the only way of doing this is parsing a string, which is very slow unless scratch is in turbo.
See www.scratch.mit.edu/projects/kidomat43/3223093 for an example (EditQueue sprite)
@bullelk12, @P110 please read my post fully.
Yes, I know it is possible with the current script. I said it in the post. BUT IT IS VERY SLOW.
- kidomat43
- Scratcher
22 posts
Advanced Make A Block, Hashed Lists and string split
Yes It would be good if you can define a block as a number block or a boolean block and then use a return block found in the make a block tab.A hashed list is a list that instead of using identification numbers to select an item, it uses a string - text. This makes it much easier to select an item.Like a js object? I'm not sure scratch needs something like this.String split would be an excellent feature, as it allows you to split up a string into a list.This would also be nice.
I means you can get to a list item more quickly. Ie: item in
Otherwise you have to search a names list to find the id, and then get the object.
Similar to a js object, but not an object: an array, a list.
- zorket
- Scratcher
500+ posts
Advanced Make A Block, Hashed Lists and string split
Checkmark the box in the block editing menu that says run without screen refresh. At the moment “make a block” is only that, a block. It can not return a value.
BUT IT IS VERY SLOW.
Last edited by zorket (April 28, 2013 20:48:46)
Yes
- Discussion Forums
- » Suggestions
- » Advanced Make A Block, Hashed Lists and string split