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

#1 2012-01-02 15:07:51

tguile
New Scratcher
Registered: 2012-01-02
Posts: 10

How to get things from a list that havnt been replaced

I am new to scratch and am making a game. I have a list of countries:
Portugal, Spain, France. On of the country names comes up at the start of the
game and you click the country. Then I turn the country grey and replace the country name in the list with done. After that I want to randomly show one of the remaining 2 countries but I dont want to show done. So if the list is returning done
I want to keep it going until it shows a country. like item any of country isnt
suppose to equal done. Anyone got an idea how to code this? Thanks.

Offline

 

#2 2012-01-02 15:57:11

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: How to get things from a list that havnt been replaced

Not sure exactly what you're saying...but I think all you need to accomplish that is the "not" block in the operators.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2012-01-02 16:32:56

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: How to get things from a list that havnt been replaced

What you can do instead of replacing their entry with "done" is to delete their entry altogether, then pick randomly from 1 to the length of the list.  Not sure if this conflicts with or breaks any of your other scripts though.

Last edited by Kileymeister_test (2012-01-02 16:33:23)


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#4 2012-01-02 16:53:24

tguile
New Scratcher
Registered: 2012-01-02
Posts: 10

Re: How to get things from a list that havnt been replaced

I tried that but say france has index 3. when I delete portugal france moves down to index 2. It all shifts. and spain moves from 2 to 1. I will have a total of 38 countries once I figure this out and if I put done in there at least I know where each country
left is. Using not is an option but you cant just say not. I want to randomly pick an
item in the list and check to see if it isnt equal to done and if that is true I want to
return that item. I will store it in a variable called random. I tried various ways of
looping through it and it either did nothing, returned true or false, or just continued
cycling through and returning all the items in the list.

Offline

 

#5 2012-01-02 16:59:09

tguile
New Scratcher
Registered: 2012-01-02
Posts: 10

Re: How to get things from a list that havnt been replaced

Oh, and if that item equals done then I have to get another random item from the list and chek again. I cant seem to figure out how.

Offline

 

#6 2012-01-02 18:13:13

tguile
New Scratcher
Registered: 2012-01-02
Posts: 10

Re: How to get things from a list that havnt been replaced

Thanks for your help guys I figured it out. I set my variable that holds the list item to
item pick random 1-3 of countries list
forever if random = done
set variable that holds the list item to item pick random 1-3 of countries list

Offline

 

Board footer