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

#1 2010-08-26 16:42:59

Fnord
New Scratcher
Registered: 2010-08-20
Posts: 8

Is there a maximum list length?

I have  script that generates a random saying from a list when the sprite is clicked. I had 46 items in my list, and added another 23 items - but the script only ever generates answers from the original list of 46. Is there a maximum list length? the script I wrote is:

When Green Flag pressed
Add "blahdeblah" to list LIST
Add "blahdeblah" to list LIST
Add "blahdeblah" to list LIST
etc etc

to establish the list

and a simple

When Sprite1 clicked
say any of list LIST for 5 sec

any ideas how to make it pay attention to the new items?

Thanks!

Offline

 

#2 2010-08-26 16:46:37

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

Re: Is there a maximum list length?

Interesting.… There is no true list limit beyond that of a computer, so your script should work fine. The issue may be that you just haven't run enough trials, as that block is random.

Offline

 

#3 2010-08-26 17:03:56

Fnord
New Scratcher
Registered: 2010-08-20
Posts: 8

Re: Is there a maximum list length?

yeh, i wasn't anticipating any problems with it, and I'd tested it a good few times. the program is set to end when the sprite has been clicked 23 times. over 10 runs (230 clicks) I saw every item of the original 46 at least once, but not a single one of the newer 23 I added. I'd been adding items to the list freely during writing the project, but it just won't seem to display any of this last lot...it's the last glitch to work out....grrrrr.....

Offline

 

#4 2010-08-26 17:14:19

Fnord
New Scratcher
Registered: 2010-08-20
Posts: 8

Re: Is there a maximum list length?

Ok here's how i solved the glitch, or compensated for it at least.

Split the list into two lists that add all their items at green flag click then:


when sprite 1 clicked
change (movepattern) by 1

If (Movepattern) <12
say item any of LIST1

if (movepattern) <12
say any of LIST2

if (movepattern) = 23
say "game over"
broadcast Endgame

Offline

 

#5 2010-08-26 17:40:51

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Is there a maximum list length?

Hmm. Well if you're going to have the list created when the project is run, I'd recommend having a "Delete all of list" before you have all the add blocks. Also, you pressed the green flag after adding those items, right? (Just checking)


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#6 2010-08-26 18:30:16

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Is there a maximum list length?

No, there isn't a maximum list length.


Hai.

Offline

 

#7 2010-08-26 23:29:42

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Is there a maximum list length?

my PacMan has a list with 1083 items
btw, once you program a list and save your project, the next time you load the project it will still have all the data in the list


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#8 2010-08-27 15:35:49

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: Is there a maximum list length?

Are you sure you just have not added the first 46 items tons and tons of times and not cleared the list so by the time you added the next 23 it already had like 460 items?

Offline

 

#9 2010-08-27 15:42:28

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

Re: Is there a maximum list length?

colorfusion wrote:

Are you sure you just have not added the first 46 items tons and tons of times and not cleared the list so by the time you added the next 23 it already had like 460 items?

That's quite possibly what could have happened - I recommend you check the length of your list.

Offline

 

Board footer