Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » I need Help
- AwesomeDuckYT
- Scratcher
51 posts
I need Help
So this is a confusing question, but if a certain number get picked, how do i make something happen if you click the wrong number? Like if you have a sprite for each number.
Visulisation:
Visulisation:
(pick random (no.1) to (no.2))
when this sprite clicked???
minecraft realms plus
i just got hit by a bus
bootin' up my xbox
cuz i need socks
to get that minecraft realms plus
- HenriStar8
- Scratcher
100+ posts
I need Help
can you explain better plz, I didn't understand your question, srry
when I receive [Nothing to do v]
repeat until <get a thing to do>
Draw
Make games
...
end
- AwesomeDuckYT
- Scratcher
51 posts
I need Help
can you explain better plz, I didn't understand your question, srry
so if something picks a random number from one number to another, and if you have a sprite for each number, and you click the right sprite something happens, but a different thing happens if you click the wrong sprite.
(pick random (something) to (something))
if <wrong> then
something Happens
end
if <right> then
Something else happens
end
Last edited by AwesomeDuckYT (Aug. 27, 2021 16:59:34)
minecraft realms plus
i just got hit by a bus
bootin' up my xbox
cuz i need socks
to get that minecraft realms plus
- nyankatpro
- Scratcher
500+ posts
I need Help
Change the name of each sprite's costume so that it matches whatever number it is (rename the 1 sprite's costume to “1”, the 2 sprite's costume to “2”, etc.) After that, you can use these scripts:
set [correct number v] to (pick random (something) to (something))
when this sprite clicked //put one of these in each number sprite
if <(correct number) = (costume [name v]::looks)> then
...//correct answer
else
...//incorrect answer
end
Last edited by nyankatpro (Aug. 27, 2021 17:09:45)
- HenriStar8
- Scratcher
100+ posts
I need Help
ok…
when green flag clickedI think that's what you want, and need some adjusts with the list thing but it's mostly that
set [OwnValue v] to (item (pick random (1) to (length of [Values v] :: list)) of [Values v] :: list) //this variable is "this sprite only" and you will need a list to not have same numbers in different sprites
when this sprite clicked
if <(OwnValue) = <what should be>> then
correct or anything like that
else
incorrect
end
when I receive [Nothing to do v]
repeat until <get a thing to do>
Draw
Make games
...
end
- deck26
- Scratcher
1000+ posts
I need Help
No need to rename costumes since you can refer to the costume number. Using numbers as costume names is generally not a good idea.
- AwesomeDuckYT
- Scratcher
51 posts
I need Help
Change the name of each sprite's costume so that it matches whatever number it is (rename the 1 sprite's costume to “1”, the 2 sprite's costume to “2”, etc.) After that, you can use these scripts:set [correct number v] to (pick random (something) to (something))
when this sprite clicked //put one of these in each number sprite
if <(correct number) = (costume [name v]::looks)> then
...//correct answer
else
...//incorrect answer
end
tysm this helped out a ton!
minecraft realms plus
i just got hit by a bus
bootin' up my xbox
cuz i need socks
to get that minecraft realms plus
- Discussion Forums
- » Help with Scripts
- » I need Help