Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Scratch Count
- DreamsXStarz
-
8 posts
Scratch Count
How do you make your scratch ask for an integer between 1-20 (inclusive) and make it check that it is an integer in range. Indicate if there is one or more errors and then have the sprite count from 1 till 20 starting from any number between
- DreamsXStarz
-
8 posts
Scratch Count
It wasn't right. Can you tell me in a different way?
- REPUS
-
18 posts
Scratch Count
when [ Space] key pressedSorry, the color of the blocks isn't right.
ask [Pick a number, 1-20] and wait
if <<(answer) > [0]> and <<(answer) < [21 ]>> then
say [It is 1-20]
end
Last edited by REPUS (Oct. 30, 2014 02:08:58)
- DreamsXStarz
-
8 posts
Scratch Count
But how do you make it count from 1 through 20 and when I choose the blocks that you put it says that 1.5 (ex) is an integer
- Specter22
-
100+ posts
Scratch Count
Check this out But how do you make it count from 1 through 20 and when I choose the blocks that you put it says that 1.5 (ex) is an integerhttp://scratch.mit.edu/projects/32049778/
- Photoguy77
-
100+ posts
Scratch Count
Hi! What you'll need is a a script that will not check for decimals, but only whole numbers. I hope this helps!
When gf clicked
ask [Hi! Tell me a number between one and twenty.] and wait
set [i v] to [0]
set [correct v] to [false]
repeat (20)
if <(answer) = (i)>//if the number the user entered ( the answer variable ) is equal to the counter ( i ), then we tell the system
//that the user is right.
set [corrrect v] to [true]
broadcast [check answer v]
stop [this script v]//this will stop the script from running after the correct answer is found. this will save time so the script is not
// repeating after the correct answer is found
end
change [i v] by (1)
end
when I receive [check answer v]
if <(correct) = [true]>
say [Nice Job! Press the green flag to try again.]
else
say [That's not quite right! Press the green flag to try again]
end
- DreamsXStarz
-
8 posts
Scratch Count
@specter22 I got that part done, thank you but then everything is mixed up. one question works while the other doesn't. Should I publish it to show you what I mean??
@photoguy77 it needs to be put in one whole line and a check answer correct response
@photoguy77 it needs to be put in one whole line and a check answer correct response
- Specter22
-
100+ posts
Scratch Count
@specter22 I got that part done, thank you but then everything is mixed up. one question works while the other doesn't. Should I publish it to show you what I mean???
@photoguy77 it needs to be put in one whole line and a check answer correct response
Yes Please Do
Last edited by Specter22 (Oct. 31, 2014 05:19:50)
- Discussion Forums
- » Help with Scripts
-
» Scratch Count