Discuss Scratch

TheUltermateFollower
Scratcher
21 posts

A between block (or blank to blank block)

RainaERusch wrote:

Sorry if I sound incompetent but isn't this the same as:
(pick random (1) to (10))

no, it tells the project if your mouse of something is between two numbers

Jonathan50 wrote:

TheUltermateFollower wrote:

it was a thing?
What?
Sorry, I didn't know what you were asking. Can you please tell me again?
Jonathan50
Scratcher
1000+ posts

A between block (or blank to blank block)

TheUltermateFollower wrote:

Jonathan50 wrote:

TheUltermateFollower wrote:

it was a thing?
What?
Sorry, I didn't know what you were asking. Can you please tell me again?
I asked what would the block report. Currently in Scratch, reporter blocks report a single value.

Last edited by Jonathan50 (July 28, 2016 06:47:23)

TheUltermateFollower
Scratcher
21 posts

A between block (or blank to blank block)

Jonathan50 wrote:

TheUltermateFollower wrote:

Jonathan50 wrote:

TheUltermateFollower wrote:

it was a thing?
What?
Sorry, I didn't know what you were asking. Can you please tell me again?
I asked what would the block report. Currently in Scratch, reporter blocks report a single value.

oh, well someone suggested that it be
<() is between () and ():: operators>
TheUltermateFollower
Scratcher
21 posts

A between block (or blank to blank block)

TheUltermateFollower wrote:

Jonathan50 wrote:

TheUltermateFollower wrote:

Jonathan50 wrote:

TheUltermateFollower wrote:

it was a thing?
What?
Sorry, I didn't know what you were asking. Can you please tell me again?
I asked what would the block report. Currently in Scratch, reporter blocks report a single value.

oh, well someone suggested that it be
<() is between () and ():: operators>

Should I change it to that?
Sheep_maker
Scratcher
1000+ posts

A between block (or blank to blank block)

TheUltermateFollower wrote:

Sheep_maker wrote:

say((1)to(10)::operators)
What would the sprite say?

what do you mean?
A reporter block has to report something. Otherwise it wouldn't be a reporter block.
GeeTransit
Scratcher
100+ posts

A between block (or blank to blank block)

You guys could just do something better like this:
when green flag clicked
if <<<[something] > [mouse x]> and <[mouse x] > [something]>>> and <>> then
...
end

i'm too lazy to do the rest

EDIT: lel it looks weird…

Last edited by GeeTransit (July 28, 2016 20:50:39)

GeeTransit
Scratcher
100+ posts

A between block (or blank to blank block)

Pootis101 wrote:

For the say thingy, it could just be pick random(1-10).
But for determining if a sprite/cursor is in an area, HECK YEAH SUPPORT OH YEAH OOMPH OH YEAH OH YEAH OH THAT FEELS GOOD OOH OOMPH
eww…
LP_Play
Scratcher
1000+ posts

A between block (or blank to blank block)

No support, easier workaround;

if <<(. . .) < [1]> and <(. . .) > [0]>> then
. . .
end

Yanderan
Scratcher
100+ posts

A between block (or blank to blank block)

TheUltermateFollower wrote:

Yanderan wrote:

TheUltermateFollower wrote:

Ok, so I want a scratch block that looks like this. except blue or green. idk

(() to ())

It would be useful as you can make scripts like this

if <<(mouse x) = ((56) to (-56))> and <(mouse y) = ((85) to (45))>> then
do something

There is a way to do this by making a list and adding all the x or y places, but that is very time consuming.




Please submit your thoughts
Is this new block like the
(pick random () to ())
?


No, It senses if your sprite or mouse pointer is between one x (or y) point and another x (or y) point
Wow, support then
DownsGameClub
Scratcher
1000+ posts

A between block (or blank to blank block)

You are getting me confused here. Could you explain your suggestion, as I am getting 2 different ideas that simply don't make sense. Tell which block you are suggesting, its functions, its reports (if applicable), etc.
Sheep_maker
Scratcher
1000+ posts

A between block (or blank to blank block)

Pootis101 wrote:

For the say thingy, it could just be pick random(1-10).
But for determining if a sprite/cursor is in an area, HECK YEAH SUPPORT OH YEAH OOMPH OH YEAH OH YEAH OH THAT FEELS GOOD OOH OOMPH
What about
set [var v] to ((0)to(240)::operators)
say (var)
if <(mouse x)=(var)> then
say [Mouse on the right]
end
What would this do then?
liam48D
Scratcher
1000+ posts

A between block (or blank to blank block)

Scratch is not English.

Don't treat it like English. Treat it like a programming language, because that's what it is.

Now that that's out of the way, you probably know reporters have values:

((3) + (4)) // 7
<mouse down?> // true if the mouse is pressed, false otherwise
(volume) // volume from "set volume" or "change volume"

When you use a reporter in another block:

(((5) + (3)) / (2)) // 4

Why does that return (“get you”) 4?

Well, it follows these steps:

1. This is an X / Y block.
2. X is a reporter. Let's get its value:
1. This is an X + Y block.
2. X is a number input. Its value is 5.
3. Y is a number input. Its value is 3.
4. X + Y = 5 + 3 = 8.
5. Return 8.
3. Y is a number input. Its value is 2.
4. X / Y = 8 / 2 = 4.
5. Return 8.

That's a fair bit to go over but it really isn't that complicated. Blocks just get the values of their inputs first, be the inputs reporters or literal (number/string) inputs, and then use those values to do something.

Now that we understand how Scratch works, let's figure out this suggestion:

<[25] = ((14) to (34) :: operators)>

...// scratchblocks makes it hard to see, but there's two blocks here!
...// X = Y and X to Y.

We've already decided that it returns the same thing as clicking on a list does - its values joined by spaces:

TheUltermateFollower wrote:

Scratcher1002 wrote:

Sheep_maker wrote:

say((1)to(10)::operators)
What would the sprite say?
1 2 3 4 5 6 7 8 9 10
It's like a list.

Support if I haven't.
thx

So let's pretend we're Scratch again and evaluate that demo (25 = (14 to 34)):

1. This is an X = Y block.
2. X is a number input. Its value is 25.
3. Y is a reporter. Let's get its value:
1. This is an X to Y block.
2. X is a number input. Its value is 14.
3. Y is a number input. Its value is 34.
4. X to Y = 14 to 34 = 14 15 16 reduced for brevity 32 33 34.
5. Return 14 15 16 … 32 33 34.
4. “X = Y” = “25 = (14 15 16 … 32 33 34)” = false.
5. Return false.

Hold on.. that wasn't expected! We expected “true”, because 25 is between 14 to 34.

But maybe it was expected.. after all, we're comparing a number with a list. Of course it's going to return false.

So – there are two things we could do.

The first is make a different block:

<(25) is between (14) and (34) ? :: operators>

In this case, it returns true. It does as it says - return true if a number is between two other numbers.

1. This is an A between X-Y block.
2. A is a number input. Its value is 25.
3. X is a number input. Its value is 14.
4. Y is a number input. Its value is 34.
5. A between X-Y = 25 between 14-34 = true.
6. Return true.

The second thing we could do is make first class lists, and then use the “contains” block:

<((14) to (34) :: operators) contains [25] ?>

1. This is an X contains Y block.
2. X is a reporter. Let's get its value:
These steps are the same as before, but now the result is *actually a list*, not a string representing the list.
1. This is an X to Y block.
2. X is a number input. Its value is 14.
3. Y is a number input. Its value is 34.
4. X to Y = 14 to 34 = 14 15 16 reduced for brevity 32 33 34
5. Return 14 15 16 … 32 33 34.
3. Y is a text/number input. Its value is 25.
4. X contains Y = 14 15 16 … 32 33 34 contains 25 = true.
5. Return true.

That works, too.

In my opinion, the first is better and would fit well with Scratch's other operator blocks. But I'm not here to state my opinion. I'm here to say that this suggestion literally doesn't work as it is right now. Hopefully you read all of the above as it covers some alternatives to (how) this suggestion (works).

Hope this helps. (Also, hopefully I structured it decently.. it's kinda long but hopefully wasn't too hard to read..)

PS - I didn't use BBCode lists because I don't think it's possible to put [list]s in [list]s. Oops.
nanalan
Scratcher
100+ posts

A between block (or blank to blank block)

this suggestion should be closed now, right?

Last edited by nanalan (July 29, 2016 16:23:16)

liam48D
Scratcher
1000+ posts

A between block (or blank to blank block)

nanalan wrote:

Kappa

this suggestion should be closed now, right?
FYI people can't read [color=white] text
seanbobe
Scratcher
500+ posts

A between block (or blank to blank block)

alexphan wrote:

<<(number) > [min]> and <(number) < [max]>>
No support as per seanbobe.
Min-1 and Max+1.

No support because of the workaround in my other post.
liam48D
Scratcher
1000+ posts

A between block (or blank to blank block)

<[A] is between [X] and [Y] ? :: operators>

Another little addition - is this inclusive or exclusive?

If it's inclusive, it'll use all numbers from 0 to 100, including 0 and 100:

<<not <[A] < [X]>> and <not <[A] > [Y]>>> // A >= X and A <= Y

If it's exclusive, it'll use all numbers from 0 to 100, not including 0 and 100:

<<[A] > [X]> and <[A] < [Y]>>
TheUltermateFollower
Scratcher
21 posts

A between block (or blank to blank block)

nanalan wrote:

this suggestion should be closed now, right?

No.
TheUltermateFollower
Scratcher
21 posts

A between block (or blank to blank block)

liam48D wrote:

<[A] is between [X] and [Y] ? :: operators>

Another little addition - is this inclusive or exclusive?

If it's inclusive, it'll use all numbers from 0 to 100, including 0 and 100:

<<not <[A] < [X]>> and <not <[A] > [Y]>>> // A >= X and A <= Y

If it's exclusive, it'll use all numbers from 0 to 100, not including 0 and 100:

<<[A] > [X]> and <[A] < [Y]>>
?

Thanks for helping this forum out.

Last edited by TheUltermateFollower (July 31, 2016 06:33:43)

24691357
Scratcher
100+ posts

A between block (or blank to blank block)

liam48D wrote:

The second thing we could do is make first class lists, and then use the “contains” block:

<((14) to (34) :: operators) contains [25] ?>

1. This is an X contains Y block.
2. X is a reporter. Let's get its value:
These steps are the same as before, but now the result is *actually a list*, not a string representing the list.
1. This is an X to Y block.
2. X is a number input. Its value is 14.
3. Y is a number input. Its value is 34.
4. X to Y = 14 to 34 = 14 15 16 reduced for brevity 32 33 34
5. Return 14 15 16 … 32 33 34.
3. Y is a text/number input. Its value is 25.
4. X contains Y = 14 15 16 … 32 33 34 contains 25 = true.
5. Return true.

That works, too.
You'll have to code it as first class, like this:
<(first class ((14) to (34) :: operators) :: list) contains [thing] ?>
Otherwise it would find a list on index 141516171819202122232425262728293031323334.
hannahthemelon
Scratcher
1 post

A between block (or blank to blank block)

is there a way to do something like (if <____ not equal to _______ >then)
if so, please tell me how to do it!

THank you!

Powered by DjangoBB