Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make a random question generator that can choose between multiple questions
        ![[RSS Feed] [RSS Feed]](//cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)  
- KreepyKreeper01
- 
                             Scratcher Scratcher
4 posts
How do I make a random question generator that can choose between multiple questions
I tried doing ‘pick random number 1-30’ for each question so it will randomly choose a question, but that seems to sometimes make it so either nothing shows up or multiple show up, any help?
Alright, that works amazingly, now I just need to figure out how to sense which question was picked so I can have the appropriate answer for that question, otherwise the answers could just be used over and over again.
                        
                            Alright, that works amazingly, now I just need to figure out how to sense which question was picked so I can have the appropriate answer for that question, otherwise the answers could just be used over and over again.
Last edited by KreepyKreeper01 (April 30, 2016 15:17:37)
- footsocktoe
- 
                             Scratcher Scratcher
1000+ posts
How do I make a random question generator that can choose between multiple questions
I tried doing ‘pick random number 1-30’ for each question so it will randomly choose a question, but that seems to sometimes make it so either nothing shows up or multiple show up, any help?
If the questions are in a list variable then there should be no problem. (30 questions = 30 items in list) Is that the way you are doing it?
(item (pick random (1) to (30)) of [ list of 30 questions v])
- Falconmist
- 
                             Scratcher Scratcher
100+ posts
How do I make a random question generator that can choose between multiple questions
You can, like was said before, use these blocks:
                        
                            when green flag clickedOr, you can replace the
ask (item (pick random (0) to (10)) of [ v]) and wait
when green flag clickedwith whatever black you need.
Last edited by Falconmist (April 30, 2016 07:29:52)
- Scratch-Minion
- 
                             Scratcher Scratcher
1000+ posts
How do I make a random question generator that can choose between multiple questions
If you don't want questions repeated, put the numbers 1 to 30 in a list, then shuffle the list randomly.
Then take the numbers out of the list as needed.
If you need a random shuffle algorithm for the 30 numbers, see “Randomly Shuffle a List” by jgatcomb at https://scratch.mit.edu/projects/11888022/
                        
                        
                    Then take the numbers out of the list as needed.
If you need a random shuffle algorithm for the 30 numbers, see “Randomly Shuffle a List” by jgatcomb at https://scratch.mit.edu/projects/11888022/
- KreepyKreeper01
- 
                             Scratcher Scratcher
4 posts
How do I make a random question generator that can choose between multiple questions
I've been doing it by making aI tried doing ‘pick random number 1-30’ for each question so it will randomly choose a question, but that seems to sometimes make it so either nothing shows up or multiple show up, any help?
If the questions are in a list variable then there should be no problem. (30 questions = 30 items in list) Is that the way you are doing it?(item (pick random (1) to (30)) of [ list of 30 questions v])
if <(pick random (1) to (30)) = [7]> thenfor each one, but each individual one was choosing its own number and that was the problem, I needed one that it chose one number and that number would correspond to a question that the game would ask
ask [stuff] and wait
end
- footsocktoe
- 
                             Scratcher Scratcher
1000+ posts
How do I make a random question generator that can choose between multiple questions
I've been doing it by making aI tried doing ‘pick random number 1-30’ for each question so it will randomly choose a question, but that seems to sometimes make it so either nothing shows up or multiple show up, any help?
If the questions are in a list variable then there should be no problem. (30 questions = 30 items in list) Is that the way you are doing it?(item (pick random (1) to (30)) of [ list of 30 questions v])if <(pick random (1) to (30)) = [7]> thenfor each one, but each individual one was choosing its own number and that was the problem, I needed one that it chose one number and that number would correspond to a question that the game would ask
ask [stuff] and wait
end
So it's resolved now? Or you still have a question?
- KreepyKreeper01
- 
                             Scratcher Scratcher
4 posts
How do I make a random question generator that can choose between multiple questions
yeah, its all good.I've been doing it by making aI tried doing ‘pick random number 1-30’ for each question so it will randomly choose a question, but that seems to sometimes make it so either nothing shows up or multiple show up, any help?
If the questions are in a list variable then there should be no problem. (30 questions = 30 items in list) Is that the way you are doing it?(item (pick random (1) to (30)) of [ list of 30 questions v])if <(pick random (1) to (30)) = [7]> thenfor each one, but each individual one was choosing its own number and that was the problem, I needed one that it chose one number and that number would correspond to a question that the game would ask
ask [stuff] and wait
end
So it's resolved now? Or you still have a question?
- asivi
- 
                             Scratcher Scratcher
1000+ posts
How do I make a random question generator that can choose between multiple questions
- Levo-Films
- 
                             Scratcher Scratcher
100+ posts
How do I make a random question generator that can choose between multiple questions
If you don't like FootSockToe's method, you could make this (But it is longer)
                        
                        
                    when green flag clicked
set [ number] to [(pick random (1) to (10)) ]
if <(number) = [1 ]> then
ask [Is Levo Awesome?] and wait
end
- asivi
- 
                             Scratcher Scratcher
1000+ posts
How do I make a random question generator that can choose between multiple questions
If you don't like FootSockToe's method, you could make this (But it is longer)Do you see it?when green flag clicked
set [ number] to [(pick random (1) to (10)) ]
if <(number) = [1 ]> then
ask [Is Levo Awesome?] and wait
end
This was my advice:
yeah, its all good.Fine, so you might to close this topic and prevent users spamming like this of mine.
Pls, close this topic when you can.
- Discussion Forums
- » Help with Scripts
- 
            » How do I make a random question generator that can choose between multiple questions ![[RSS Feed] [RSS Feed]](//cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)  
![[RSS Feed] [RSS Feed]](http://cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)






