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
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
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
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)
Offline
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
Offline
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
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