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

#1 2009-07-14 04:54:12

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

List block: <list includes [ ]>

I would like to suggest a new block. How about <list includes [ ]>? In other words, a block to sense if an item in a list includes something. Don't get this block confused with the <list contains [ ]> because that block already exists in 1.4 and it checks if a whole item in the list contains something. The difference is that the 'contains' block would sense 'Hello World' in the item of 'Hello World', but the 'includes' block would also get the 'Hello' and 'World' in 'Hello World', along with 'Hello World'.

This may sound useless, but think of the possibilities! It would be so much easier for a chatbot, and things like that.

Last edited by Jonathanpb (2010-01-08 19:59:39)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#2 2009-07-14 09:42:47

BWOG
Scratcher
Registered: 2008-09-19
Posts: 1000+

Re: List block: <list includes [ ]>

Ok, but I think 8 year olds might get confused between the two

Offline

 

#3 2009-07-16 00:15:35

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: List block: <list includes [ ]>

Hmm... very handy for chatbots like you said. If you wanted to sense if you were being asked your favorite color, you could be asked the following:

What's your favorite color?
What is your favorite color?
Whats your favorite color?
What's your fave color?
What is your fave color?
Whats your fave color?
etc....

Instead of having a lot of <__ or __> blocks, you can just transfer the answer to a list that checks the replies, so:

.............................
if (list check contains [favorite color]) or (list check contains [fave color]) or (list check contains [fav color])*
    add (_____________) to [chat]...

... which should be very handy for chatbots.

*New line; not anything about the scripting.

Last edited by Chrischb (2009-07-16 00:15:56)


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#4 2009-07-19 04:12:30

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: List block: <list includes [ ]>

BWOG wrote:

Ok, but I think 8 year olds might get confused between the two.

How about this. They rename the blocks so the block that exists is <[item] of list is [ ]>, and the block that I want is <[item] of list includes [ ]>.

Chrischb wrote:

Hmm... very handy for chatbots like you said. If you wanted to sense if you were being asked your favorite color, you could be asked the following:

What's your favorite color?
What is your favorite color?
Whats your favorite color?
What's your fave color?
What is your fave color?
Whats your fave color?
etc....

That's the handy thing that I was talking about earlier. Nothing special.

Last edited by Jonathanpb (2009-07-19 04:13:03)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#5 2009-07-30 22:28:22

Tux
Scratcher
Registered: 2008-01-09
Posts: 100+

Re: List block: <list includes [ ]>

There are a lot of projects I had to abandon because this block doesn't exist. But I would change it to: () contains () at [] so you could make it a variable, list, etc. and the [] contains: Front, back, middle and anywhere.


Come here for great projects: http://scratch.mit.edu/users/Tux

Offline

 

#6 2009-07-31 02:06:10

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: List block: <list includes [ ]>

Tux wrote:

There are a lot of projects I had to abandon because this block doesn't exist. But I would change it to: () contains () at [] so you could make it a variable, list, etc. and the [] contains: Front, back, middle and anywhere.

Now that's an idea!


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#7 2009-07-31 02:43:10

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: List block: <list includes [ ]>

Tux wrote:

There are a lot of projects I had to abandon because this block doesn't exist. But I would change it to: () contains () at [] so you could make it a variable, list, etc. and the [] contains: Front, back, middle and anywhere.

That's awesome! There's just one problem though: lists are different from variables, so a list might have [list includes ___ in [item], while variables might have [variable includes ___].

Chrischb wrote:

Now that's an idea!

I agree with you. Nothing big.

Last edited by Jonathanpb (2009-07-31 02:43:34)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#8 2010-01-07 07:44:55

grit96
Scratcher
Registered: 2009-09-23
Posts: 4

Re: List block: <list includes [ ]>

I have a project that doesn't work properly because there isn't this block. I have to use repeat (legnth of ((item 1) of list) and it would be great if there was a block in the variable/list section  repeat (legnth of (item 1) of list)

Last edited by grit96 (2010-01-07 07:48:26)

Offline

 

#9 2010-01-07 11:12:48

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: List block: <list includes [ ]>

Hi grit96,

I think you might just try the green (length of [ ]) reporter block in the Operators section for what you're after. You can drop the (item (i) of (list)) block into the rectangular argument slot and that should work. If that doesn't help, please ask again!


Jens Mönig

Offline

 

#10 2010-01-07 12:30:12

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: List block: <list includes [ ]>

BWOG wrote:

Ok, but I think 8 year olds might get confused between the two

An 8 year old with a mental disorder might, but an ordinary one won't.

And I think this would be a good idea to add!

Last edited by juststickman (2010-01-07 12:31:04)


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#11 2010-01-07 17:33:56

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: List block: <list includes [ ]>

Jens, hi! You don't usually post in places like this.

I remember when I saw your Eliza; before that, I couldn't think of how you could get around the lack of the <list includes [ ]> block. Anyway, I figured out how to do it...  smile

I still want that block, though. It saves a lot of work (and plenty of variables), and, well,  it would make chatbots think a lot faster.


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

Board footer