does anyone know the script to make someone randomly choose what to say? ( he has about 3 or 4 things to say, and when he touches something, i want him to choose randomly, every time)
Offline
Maybe like this: When touching the object, set say to a random number. Then have each number a different phrase, like this:
[blocks]<when green flag clicked>[/blocks]
[blocks]<forever if><( <{ say }> <=> 1 )>[/blocks]
[blocks]<say[ ]for( )secs>[/blocks]
[blocks]<end>[/blocks]
Offline
but how would i put the pick random, in the touching object loop?
Offline
If touching _______
Set Say to (Pick Random of ___ and ___)
Offline
[blocks]<when green flag clicked>[/blocks]
[blocks]<set{ Say }to( 0[/blocks]
[blocks]<forever if><touching[ [/blocks]
[blocks]<broadcast[ Start[/blocks]
[blocks]<stop script>[/blocks]
[blocks]<when I receive[ Start[/blocks]
[blocks]<set{ say }to( <pick random( 1 )to( 4[/blocks]
Offline
ok thanks
Offline
wait, when i did it, it chooses it randomly, but it cycles through the choices, then stops when it picks one, how do i avoid that?
Offline
Freestylin_Monkey wrote:
wait, when i did it, it chooses it randomly, but it cycles through the choices, then stops when it picks one, how do i avoid that?
Did you copy it exactly? Maybe the forever loop is messing it up. I thought that adding the stop script would help though... hmm.... Well, lemme try making a quick demonstration of it. Ok? Then I can really test my scripts.
Offline
http://scratch.mit.edu/projects/CFCRubiks/181266
I used that with my other account. Whenever the cat touches the color black, he says something random. You can use the scripts if you want
Offline
It might be the say choices, i put them in a forever loop and he talks even when not touching the object, but if i dont put one, he doesnt talk at all, the random loop works fine
Offline
Freestylin_Monkey wrote:
It might be the say choices, i put them in a forever loop and he talks even when not touching the object, but if i dont put one, he doesnt talk at all, the random loop works fine
Just download the game and see what I did to prevent that from happening.
Offline
http://scratch.mit.edu/projects/CFCRubiks/181266 <--- this one.
Offline
i got it, i got it, thanks, you can erase it if you want
Last edited by Freestylin_Monkey (2008-06-05 14:54:46)
Offline
Freestylin_Monkey wrote:
i got it, i got it, thanks, you can erase it if you want
Cool. Post the project when your done. I think I'll leave it up for people who have that same question.
Offline
puple dot has the script...
http://scratch.mit.edu/projects/Freestylin_Monkey/181347
Offline