Discuss Scratch
- mica43683
-
Scratcher
500+ posts
Either/Or block
< 5 would also be < 7Oh, yes. I meant-snip-Wouldn't<(variable) > [7]>also be greater than 5?set [variable v] to (pick random (1) to (8))Thanks for pointing that out.
if <(variable) < [5]> then // prob. 1/2
...
else
if <(variable) < [7]> then // prob. 1/4
...
else
if <(variable) = [7]> then // both prob. 1/8
...
else // prob. 1/8
...
end
end
end
scratchblocks]
set [variable v] to (pick random (1) to (8))
if <(variable) < [5]> then // 1/2. Being < 5 would mean it would be 1,2,3 or 4. If it wasn't one of those, it must be higher.
...
else
if <<(variable) > [4]> and <(variable) < [7]>> then // 1/4. This would make it either 5 or 6. In your script, it was made in a way that 5 could
... // never be chosen, because it would always be either > 5 or < 5, but never = 5.
else
if <(variable) = [7]> then // both 1/8
...
else
...
end
end
end
- Troyer_Kem
-
Scratcher
1000+ posts
Either/Or block
No Support. You can use the list for a random reaction.
when green flag clicked
add [Hehe!] to [list v]
add [That tickles!] to [list v]
add [I feel so happy!] to [list v]
when green flag clicked
forever
if <touching [mouse pointer v] ?> then
say (item (pick random (1) to (3)) of [list v] :: list) for (2) secs
wait until <not <touching [mouse pointer v] ?>>
end
end
- mica43683
-
Scratcher
500+ posts
Either/Or block
No Support. You can use the list for a random reaction.This would only choose different things to say, not different outcomes.when green flag clicked
add [Hehe!] to [list v]
add [That tickles!] to [list v]
add [I feel so happy!] to [list v]
when green flag clicked
forever
if <touching [mouse pointer v] ?> then
say (item (pick random (1) to (3)) of [list v] :: list) for (2) secs
wait until <not <touching [mouse pointer v] ?>>
end
end
Last edited by mica43683 (June 28, 2019 09:56:02)
- BlueStarPort
-
Scratcher
100+ posts
Either/Or block
Semi-Support. The workaround is pretty easy, but this might benefit people with less knowledge of coding.
- Troyer_Kem
-
Scratcher
1000+ posts
Either/Or block
Oh okay then.No Support. You can use the list for a random reaction.This would only choose different things to say, not different outcomes.when green flag clicked
add [Hehe!] to [list v]
add [That tickles!] to [list v]
add [I feel so happy!] to [list v]
when green flag clicked
forever
if <touching [mouse pointer v] ?> then
say (item (pick random (1) to (3)) of [list v] :: list) for (2) secs
wait until <not <touching [mouse pointer v] ?>>
end
end
- mica43683
-
Scratcher
500+ posts
Either/Or block
Yup. I tried to post it only once or twice yesterday, but it posted a million times.BumpBumpBumpBumpBump404 error?
- WindOctahedron
-
Scratcher
1000+ posts
Either/Or block
Yes, it would, but the “if x, then y, else z” is equivalent to "if x, then y; if not x, then z". Here, z = if a, then b. So it checks if a number is less than 5, and if not, checks if it is at least less than 7.-snip-< 5 would also be < 7
Last edited by WindOctahedron (June 29, 2019 13:50:22)
- Dilek10
-
Scratcher
100+ posts
Either/Or block
You mean a new logic gate? Um, sure. I'm gonna support.
- WindOctahedron
-
Scratcher
1000+ posts
Either/Or block
You mean a new logic gate? Um, sure. I'm gonna support.No, it's not a logic gate. It's a block that allows random outcomes.
- Madcatofdoom
-
Scratcher
500+ posts
Either/Or block
HiHi! Welcome to Scratch, as well as the Scratch Forums! You just posted “Hi”, which isn't exactly a good thing, because it's quite irrelevant to this thread, but if you like the word hi, you can say that in the “New Scratchers” forum here! People are very nice there and will reply with more “hi”s than you can ever think of!
- Tiger_Person
-
Scratcher
100+ posts
Either/Or block
Semi support: I really have no opinion on this, but I do think this is a good block for less experienced people, and for people who just want to make things simpler, but the workaround is just fine for me.
- the2000
-
Scratcher
1000+ posts
Either/Or block
Semi support: I really have no opinion on this, but I do think this is a good block for less experienced people, and for people who just want to make things simpler, but the workaround is just fine for me.I don't think we should have many blocks just to “make things simpler”. They're going to need to learn the workarounds eventually, so we might as well teach it early on.
- cruncherBones
-
Scratcher
500+ posts
Either/Or block
It has a es workaround but I support as it is a cool block I like it










