Discuss Scratch

my_pup4life
Scratcher
16 posts

Workarounds to frequently suggested blocks

is there a possible workaround for this:

<this sprite clicked?::sensing>

GO CANUCKS GO!::#00205B
my_pup4life
Scratcher
16 posts

Workarounds to frequently suggested blocks

PixelYoshi wrote:

my_pup4life wrote:

Hopeijay wrote:

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

set speed to (...):: #7238a8
define set speed to (speed)
forever
move (speed) steps
end
I made it a sound block for a reason, its supposed to be the speed of the sound without the pitch changing
i don't think you can change the speed of a sound without the pitch changing. i think thats just how it works. i'm not sure though.
ok, thx.

GO CANUCKS GO!::#00205B
Computer_Fizz
Scratcher
100+ posts

Workarounds to frequently suggested blocks

my_pup4life wrote:

is there a possible workaround for this:

<this sprite clicked?::sensing>

there are several different workarounds, but the best one is:

when this sprite clicked
set [clicked? v] to [true]
wait until < not < mouse down? > >
set [clicked? v] to [false]

I will consider adding it into the main thread
mica43683
Scratcher
500+ posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

my_pup4life wrote:

is there a possible workaround for this:

<this sprite clicked?::sensing>

there are several different workarounds, but the best one is:

when this sprite clicked
set [clicked? v] to [true]
wait until < not < mouse down? > >
set [clicked? v] to [false]
Well, no. That would mean you can remove the mouse from the sprite with a drag and it would still consider it clicked. You kinda have a habit of complicating things with variables and whatnot. The best one is, actually,
<<touching [mouse pointer v] ?> and <mouse down?>>
because it remains as a boolean and doesn't require too much extra work and clutter of the variable list, which was the original suggestion.

I got a lot of compliments on my last signature, and I think that's kind of strange. I wrote it when I was 12 and it wasn't very good. I acted like PS4 controllers were the epitome of human technology, for God's sake! I tried too hard to be philosophical, or maybe I tried too hard to be funny, or maybe it was something else. But that signature was bad. It wasn't good. It might be strange for some of you to hear this, seeing as this site is full of kids, but 12-year-old me was practically a baby. I think that's something you realise when you grow up. That you're always better than you were last year. I was looking through old Skype messages between me and a friend of mine from when we were 12, and as I read them, I couldn't stop thinking, “Woah. I was the worst.” It's important to know that you're always the worst. I can almost guarantee that future you is thinking negatively of you right now, just as future me is thinking negatively of me. It's important not to let that get to you. Remember to stay in the present. Tomorrow hates you, but it can't hurt you because you'll never get to tomorrow. When I was 10 or 11, I remember seeing the world very cynically. I thought that human life was inherently selfish, and that we were only put on this planet to destroy it. I'm so glad 10 or 11 year old me is gone, because 17 year old me would NOT get along with that kid.
LilyMakesThings
Scratcher
100+ posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

Operators :: operators hat
< < . . . > xor < . . . > :: operators>
can be recreated with the following code:
< not < < . . . > = < . . . > > >
———————————————————–
 < true :: operators> 
can be recreated with the following code:
 < [1] = [1] > 
———————————————————–
 < false :: operators> 
can be recreated with the following code:
 < [1] > [2] > 
———————————————————–
 ( letters ( start ) through ( end :: variables) of ( string ) :: operators) 
can be recreated with the following code:
set [iterator v] to ( start )
set [result v] to []
repeat ( ( ( end :: variables) - ( start ) ) + ( 1 ) )
set [result v] to ( join ( result ) ( letter ( iterator ) of ( string ) ) )
end
———————————————————–
< ( . . . ) ≥ ( . . . ) :: operators >
can be recreated with the following code:
< not < ( . . . ) < ( . . . ) > >
———————————————————–
< ( . . . ) ≤ ( . . . ) :: operators >
can be recreated with the following code:
< not < ( . . . ) > ( . . . ) > >
The thing is with the "letters through of " is that 1: there's a delay. 2 there's only room for 1 calculation at a time. It can work, but for larger projects it isn't a viable workaround. most of these workarounds are great though, and i do use quite a few of them!
WindOctahedron
Scratcher
1000+ posts

Workarounds to frequently suggested blocks

LukeManiaStudios wrote:

The thing is with the "letters through of " is that 1: there's a delay. 2 there's only room for 1 calculation at a time. It can work, but for larger projects it isn't a viable workaround. most of these workarounds are great though, and i do use quite a few of them!
The delay can be removed by making the code a custom block and turning on “run without screen refresh”.

The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
no8pupil
Scratcher
72 posts

Workarounds to frequently suggested blocks

if <> forever {

}::control

if <> then
forever

end
end

When x=(), y=() ::motion hat

if <<(x position) = []> and <(y position) = []>> then

end

Last edited by no8pupil (Nov. 17, 2019 10:15:00)


like::control hat
heart::motion
follow::list
likes (bbc (alba::stack events)::stack motion)::pen
loves the IPA::operators
friendly::cap
Computer_Fizz
Scratcher
100+ posts

Workarounds to frequently suggested blocks

mica43683 wrote:

Computer_Fizz wrote:

my_pup4life wrote:

is there a possible workaround for this:

<this sprite clicked?::sensing>

there are several different workarounds, but the best one is:

when this sprite clicked
set [clicked? v] to [true]
wait until < not < mouse down? > >
set [clicked? v] to [false]
Well, no. That would mean you can remove the mouse from the sprite with a drag and it would still consider it clicked. You kinda have a habit of complicating things with variables and whatnot. The best one is, actually,
<<touching [mouse pointer v] ?> and <mouse down?>>
because it remains as a boolean and doesn't require too much extra work and clutter of the variable list, which was the original suggestion.

No, because then you can put the mouse down first, then touch the sprite. Which is why I said “there are several different workarounds, but the best one is:”, and then the closest workaround. More functionality is not “complicating”.

Last edited by Computer_Fizz (Nov. 18, 2019 01:02:56)

no8pupil
Scratcher
72 posts

Workarounds to frequently suggested blocks

stamp at [ v]::pen

go to [ v]
stamp

forever wait::control

wait until <put nothing in here>::control

like::control hat
heart::motion
follow::list
likes (bbc (alba::stack events)::stack motion)::pen
loves the IPA::operators
friendly::cap
Beamy68
Scratcher
100+ posts

Workarounds to frequently suggested blocks

no8pupil wrote:

forever wait::control

wait until <put nothing in here>::control

A forever wait would be kind of useless, instead you could just:
wait [Infinity] secs
or
stop [this script v]

Last edited by Beamy68 (Nov. 18, 2019 11:57:35)


Post Goal:


Motion::motion
Looks::looks
Sound::sound
Pen::pen
Events::events
Control::control
Sensing::sensing
Operators::operators
Variables::variables
List::list
More Blocks::custom
bemy
no8pupil
Scratcher
72 posts

Workarounds to frequently suggested blocks

<variable has ()?::variables>

<(any var) = [x]> //'x' is the what the variable has

<<>≠<>::operators>

<not <<>=<>>

Last edited by no8pupil (Nov. 19, 2019 14:25:32)


like::control hat
heart::motion
follow::list
likes (bbc (alba::stack events)::stack motion)::pen
loves the IPA::operators
friendly::cap
Beamy68
Scratcher
100+ posts

Workarounds to frequently suggested blocks

no8pupil wrote:

<variable has ()?::variables>

<(any var) = [x]> //'x' is the what the variable has

<<>≠<>::operators>

<not <<>=<>>

These are kind of obvious.. but good job! :D

Post Goal:


Motion::motion
Looks::looks
Sound::sound
Pen::pen
Events::events
Control::control
Sensing::sensing
Operators::operators
Variables::variables
List::list
More Blocks::custom
bemy
PixelYoshi
Scratcher
100+ posts

Workarounds to frequently suggested blocks

no8pupil wrote:

<variable has ()?::variables>

<(any var) = [x]> //'x' is the what the variable has

<<>≠<>::operators>

<not <<>=<>>
actually, that doesn't work. that only tells you the variable has () if it contains ONLY the value your looking for. heres a way to do it thats works the way you want it to:

define does (variable) have (text)
set [counter v] to [1]
set [counter_2 v] to [1]
set [finished word v] to []
repeat (length of (variable))
if <(letter (counter) of (variable)) = (letter (counter) of (text))> then
set [finished word v] to (join (finished word) (letter (counter_2) of (text))
change [counter_2 v] by [1]
if <(finished word) = (text)> then
set [yes/no v] to [yes]
else
set [yes/no v] to [no]
end
else
if <(yes/no) = [no]> then
set [current word v] to []
set [counter_2 v] to [1]
end
end
change [counter v] by [1]
end

whether its in the variable or not is shown by the yes/no variable. the only thing is its not a boolean block but that just doesn't work.
DipLeChip
Scratcher
1000+ posts

Workarounds to frequently suggested blocks

PixelYoshi wrote:

no8pupil wrote:

<variable has ()?::variables>

<(any var) = [x]> //'x' is the what the variable has

<<>≠<>::operators>

<not <<>=<>>
actually, that doesn't work. that only tells you the variable has () if it contains ONLY the value your looking for. heres a way to do it thats works the way you want it to:

define does (variable) have (text)
set [counter v] to [1]
set [counter_2 v] to [1]
set [finished word v] to []
repeat (length of (variable))
if <(letter (counter) of (variable)) = (letter (counter) of (text))> then
set [finished word v] to (join (finished word) (letter (counter_2) of (text))
change [counter_2 v] by [1]
if <(finished word) = (text)> then
set [yes/no v] to [yes]
else
set [yes/no v] to [no]
end
else
if <(yes/no) = [no]> then
set [current word v] to []
set [counter_2 v] to [1]
end
end
change [counter v] by [1]
end

whether its in the variable or not is shown by the yes/no variable. the only thing is its not a boolean block but that just doesn't work.


or

(var) contains [x] ? :: #5EC15D

stop fuming and start loving :p
mica43683
Scratcher
500+ posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

mica43683 wrote:

Computer_Fizz wrote:

my_pup4life wrote:

is there a possible workaround for this:

<this sprite clicked?::sensing>

there are several different workarounds, but the best one is:

when this sprite clicked
set [clicked? v] to [true]
wait until < not < mouse down? > >
set [clicked? v] to [false]
Well, no. That would mean you can remove the mouse from the sprite with a drag and it would still consider it clicked. You kinda have a habit of complicating things with variables and whatnot. The best one is, actually,
<<touching [mouse pointer v] ?> and <mouse down?>>
because it remains as a boolean and doesn't require too much extra work and clutter of the variable list, which was the original suggestion.

No, because then you can put the mouse down first, then touch the sprite. Which is why I said “there are several different workarounds, but the best one is:”, and then the closest workaround. More functionality is not “complicating”.
More funcionality? Using variables for no reason at all, using more blocks than needed, creating a seperate script. All this (and this is something you do in a lot of your workarounds) and you call it “More Functionality.” You're indeed just complicating things for no reason. I don't see anything more functional than
<<touching [mouse pointer v] ?> and <mouse down?>>

I got a lot of compliments on my last signature, and I think that's kind of strange. I wrote it when I was 12 and it wasn't very good. I acted like PS4 controllers were the epitome of human technology, for God's sake! I tried too hard to be philosophical, or maybe I tried too hard to be funny, or maybe it was something else. But that signature was bad. It wasn't good. It might be strange for some of you to hear this, seeing as this site is full of kids, but 12-year-old me was practically a baby. I think that's something you realise when you grow up. That you're always better than you were last year. I was looking through old Skype messages between me and a friend of mine from when we were 12, and as I read them, I couldn't stop thinking, “Woah. I was the worst.” It's important to know that you're always the worst. I can almost guarantee that future you is thinking negatively of you right now, just as future me is thinking negatively of me. It's important not to let that get to you. Remember to stay in the present. Tomorrow hates you, but it can't hurt you because you'll never get to tomorrow. When I was 10 or 11, I remember seeing the world very cynically. I thought that human life was inherently selfish, and that we were only put on this planet to destroy it. I'm so glad 10 or 11 year old me is gone, because 17 year old me would NOT get along with that kid.
Beamy68
Scratcher
100+ posts

Workarounds to frequently suggested blocks

DipLeChip wrote:

PixelYoshi wrote:

no8pupil wrote:

-snip-
or
(var) contains [x] ? :: operators
Yeah, how was this operator missed?

Last edited by Beamy68 (Nov. 22, 2019 20:38:04)


Post Goal:


Motion::motion
Looks::looks
Sound::sound
Pen::pen
Events::events
Control::control
Sensing::sensing
Operators::operators
Variables::variables
List::list
More Blocks::custom
bemy
HarryPotter313
Scratcher
19 posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

while < . . . > {
. . .
} @loopArrow :: control

can be recreated with the following code:

repeat until < not < . . . > >
. . .
end

There actually is a
 while < . . . > {} @loopArrow :: control 
block. Many projects have it, which you can add to your backpack.

Please don't count this as advertising — I'm only trying to give an example and you can
use these hacked blocks without credit. They all work in 3.0.
https://scratch.mit.edu/projects/315757409/
Includes:
    while <> {
} @loopArrow :: control

for each [var v] in [10] {
} :: control

all at once {
} :: control

(counter :: control)
clear counter :: control
increment counter :: control

<loud? :: sensing>

Last edited by HarryPotter313 (Nov. 22, 2019 23:38:41)



define (x :: custom-arg) ^ (y :: custom-arg) :: reporter
pen [erase v] :: pen
return ([10 ^ v] of ((y :: custom-arg) * ([log v] of (x :: custom-arg)))) :: custom cap
45afc4td
Scratcher
100+ posts

Workarounds to frequently suggested blocks

Shuffle the[list v] :: list
becomes
repeat until<(length of[temp v])\>[2]>
add[0]to[temp v]
end
replace item[1]of[temp v]with(pick random[1]to[2147483646])
replace item[2]of[temp v]with(length of[list v])
repeat((length of[list v])-[1])
replace item[1]of[temp v]with(([48271]*(item[1]of[temp v]))mod[2147483647])
replace item[3]of[temp v]with(item(((item[1]of[temp v])mod(item[2]of[temp v]))+[1])of[list v])
replace item(((item[1]of[temp v])mod(item[2]of[temp v]))+[1])of[list v]with(item(item[2]of[temp v])of[list v])
replace item(item[2]of[temp v])of[list v]with(item[3]of[temp v])
replace item[2]of[temp v]with((item[2]of[temp v])-[1])
end
PixelYoshi
Scratcher
100+ posts

Workarounds to frequently suggested blocks

DipLeChip wrote:

PixelYoshi wrote:

no8pupil wrote:

<variable has ()?::variables>

<(any var) = [x]> //'x' is the what the variable has

<<>≠<>::operators>

<not <<>=<>>
actually, that doesn't work. that only tells you the variable has () if it contains ONLY the value your looking for. heres a way to do it thats works the way you want it to:

define does (variable) have (text)
set [counter v] to [1]
set [counter_2 v] to [1]
set [finished word v] to []
repeat (length of (variable))
if <(letter (counter) of (variable)) = (letter (counter) of (text))> then
set [finished word v] to (join (finished word) (letter (counter_2) of (text))
change [counter_2 v] by [1]
if <(finished word) = (text)> then
set [yes/no v] to [yes]
else
set [yes/no v] to [no]
end
else
if <(yes/no) = [no]> then
set [current word v] to []
set [counter_2 v] to [1]
end
end
change [counter v] by [1]
end

whether its in the variable or not is shown by the yes/no variable. the only thing is its not a boolean block but that just doesn't work.


or

(var) contains [x] ? :: #5EC15D
oh yeah im stupid lol
45afc4td
Scratcher
100+ posts

Workarounds to frequently suggested blocks

In [list v], perform a swap on index [] and [] ::list
becomes
swap[][]
define swap[a][b]
dual-write(a)(b)(item[b]of[list v])(item[a]of[list v])
define dual-write[a][b][c][d]
replace item(a)of[list v]with(c)
replace item(b)of[list v]with(d)

Powered by DjangoBB