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

#1 2010-06-25 20:35:07

samurai768
Scratcher
Registered: 2009-07-21
Posts: 1000+

Lists, again.

roll

How do I make it so when a list contains all of the items from another list, it does something?

Offline

 

#2 2010-06-25 20:44:14

samurai768
Scratcher
Registered: 2009-07-21
Posts: 1000+

Re: Lists, again.

Wait, nevermind!

Keep this topic open, just for a little bit though.

Use this for anyone needing this script:
<[List1] contains (item (length of [List2]) of [List2]) >

It should work  smile

Last edited by samurai768 (2010-06-25 20:44:22)

Offline

 

#3 2010-06-25 21:51:57

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Lists, again.

Hm... I'm pretty sure that would only check to see if the last item of both lists are the same.

What I think you'd need is this:

http://i50.tinypic.com/2mzbju9.gif

Essentially, it cycles through all the items of list 2 and sees if they're in list 1. If it's not, a variable is set to 0. If the variable is 0, there was an item which was in list 2 but not list 1.

Of course, this only works 1 way - for instance, list 1 can have items not in list 2 and the script won't detect that.

Offline

 

Board footer