Discuss Scratch
- Discussion Forums
- » Suggestions
- » Helpful Workarounds for Frequently Suggested Blocks!
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Hello! My name is @shradibop, and I'm the new host of this topic.
In the suggestions forum, you might have a suggestion for a block. But, if it gets rejected, have no fear! On this topic, you can easily ask for workarounds for block. Still don't get it? Confused as to why you can't just get the block added? @Za-Chary is here to explain that to you.
It's a useful topic that can also get you more experienced with coding! Don't be afraid to ask/answer questions, the Scratch community is here to help!
Find the old ones here:
Computer_Fizz Forum
BearSlothCoding Forum
Below are some things you can use without having to ask for a workaround \/ \/ \/ \/
In the suggestions forum, you might have a suggestion for a block. But, if it gets rejected, have no fear! On this topic, you can easily ask for workarounds for block. Still don't get it? Confused as to why you can't just get the block added? @Za-Chary is here to explain that to you.
Well, there's a couple reasons this is a useful list.
The “previous costume” block is not rejected, but it just hasn't been added to the editor. For those looking for something that works the same as a “previous costume” block, they can look at this topic for a workaround so they can effectively code their project.
The “when stop sign clicked” block is rejected, so we will not be adding it (and in this case, yes, there is something “wrong” with implementing the suggestion). Some Scratchers still might like to simulate its effects, however, so they can look at this topic for a workaround so they can accomplish what the block would do.
The purpose of this topic isn't to tell you to “stick” to workarounds — it's to provide you workarounds for blocks that you might be looking to use. It will likely save you time by using the workaround instead of waiting for us to implement a block.
It's a useful topic that can also get you more experienced with coding! Don't be afraid to ask/answer questions, the Scratch community is here to help!
Find the old ones here:
Computer_Fizz Forum
BearSlothCoding Forum
Below are some things you can use without having to ask for a workaround \/ \/ \/ \/
Last edited by shradibop (Feb. 19, 2021 00:51:44)
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Motion
_______________________________________________________________________________________________
Method 1:
Create a sprite and move it to where you want it. Say for example, you have a sprite X and move it to x:0 y:0, you could do this:
(for sprite X)
Or you could do this complicated code.
_______________________________________________________________________________________________
point towards x:() y:() :: motionThis can be done with two methods.
Method 1:
Create a sprite and move it to where you want it. Say for example, you have a sprite X and move it to x:0 y:0, you could do this:
(for sprite X)
when green flag clicked(for the other sprite)
go to x:(0) y:(0)
when green flag clickedMethod 2:
forever
point towards [X v]
end
Or you could do this complicated code.
set [deltax v] to ((WantedX) - (x position))_______________________________________________________________________________________________
set [deltay v] to ((WantedY) - (y position))
if <not <(deltay) = [0]>> then
if <(deltay) > (0)> then
point in direction ([atan v] of ((deltax)/(deltay))
else
point in direction ([atan v] of (((deltax)/(deltay)) + (180)))
end
else
if ((deltax) > (0)) then
point in direction (90)
else
point in direction (-90)
end
bounce :: motioncan be made with this script:
point in direction ((direction) - (180)
Last edited by shradibop (Oct. 2, 2020 15:57:02)
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Looks
_______________________________________________________________________________________________
_______________________________________________________________________________________________
_______________________________________________________________________________________________
previous costume :: looksThis can be done with a very simple script:
switch costume to ((costume #) - (1))You can also use this project which contains a previous costume hacked block.
_______________________________________________________________________________________________
shown? :: looks :: reporterCan be done with:
set [shown? v] to [yes]//Put this right after the "show" block
set [shown? v] to [no]//Put this right after the "hide" block
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Sound
_______________________________________________________________________________________________
Similarly,
You can find the first method in this project by xXRedTheCoderXx.
The second method you can find here by EIephant_Lover.
I did not provide the scripts here because the second one is very long and it wouldn't be fair to include one method but not the other just because one is long.
_______________________________________________________________________________________________
next sound ::soundcan be done with this:
when gf clicked
forever
play sound (sound#) until done
end
change [sound# v] by (1)
Similarly,
previous sound ::soundcan be done with this:
when gf clicked
forever
play sound (sound#) until done
end
change [sound# v] by (-1)_______________________________________________________________________________________________
pause sound :: soundor
resume sound :: soundcan be done with two methods.
You can find the first method in this project by xXRedTheCoderXx.
The second method you can find here by EIephant_Lover.
I did not provide the scripts here because the second one is very long and it wouldn't be fair to include one method but not the other just because one is long.
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Events
_______________________________________________________________________________________________
Alternatively, you could also do this method which has less delay but uses a variable:
The traditional method is the following code:
But some people don't like the amount of variables in large projects and don't want to add more, which in that case you can use this method where it uses a list instead of three variables:
_______________________________________________________________________________________________
Can be done with:
_______________________________________________________________________________________________
when ( :: more blocks) clicked :: hat :: eventsA when stop signed clicked block is rejected but you can achieve it with this script:
when green flag clicked
forever
reset timer
when [timer v] > (0)
do something
when [timer v] > (0)
forever
reset timer
end
Alternatively, you could also do this method which has less delay but uses a variable:
when green flag clicked_______________________________________________________________________________________________
forever
set [timer v] to (timer)
when [timer v] > (timer :: variables)
do something
when <something> is done :: hat :: eventscan be done with this script:
when green flag clicked_______________________________________________________________________________________________
broadcast [Continue v]
when [timer v] > (timer :: variables)
broadcast [Continue v]
when I receive [Continue v]
broadcast [Check v]
forever
set [timer v] to (timer)
when I receive [Check v]
forever
if <something happens> then
do something
end
broadcast [ v] received? :: boolean :: events
The traditional method is the following code:
when green flag clicked
set [received? v] to [False]
when I receive [Message v]
set [received? v] to [True]
when green flag clicked
repeat until <(received?) = [True]>
Do stuff
end
do other stuff
But some people don't like the amount of variables in large projects and don't want to add more, which in that case you can use this method where it uses a list instead of three variables:
when green flag clicked
replace item (1 v) of [list v] with [False]
replace item (2 v) of [list v] with [False]
replace item (3 v) of [list v] with [False]
when I receive [Event 1 v]
replace item (1 v) of [list v] with [True]
when I receive [Event 2 v]
replace item (2 v) of [list v] with [True]
when I receive [Event 3 v]
replace item (3 v) of [list v] with [True]
when green flag clicked
repeat until <(item (1 v) of [list v] :: list) = [True]>
Do Stuff
end
repeat until <(item (2 v) of [list v] :: list) = [True]>
Do Stuff
end
repeat until <(item (3 v) of [list v] :: list) = [True]>
Do Stuff
end
_______________________________________________________________________________________________
when costume switches to [ v] :: events :: hat
Can be done with:
wait until <(costume [number v] :: looks) = []>
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Control
_______________________________________________________________________________________________
Can be done with:
_______________________________________________________________________________________________
while < . . . > { . . . } @loopArrow :: controlcan be done by doing this:
repeat until < not < . . . > >_______________________________________________________________________________________________
...
if <...> then {
...
} else if <...> {
...
} :: control
Can be done with:
if <...> then
...
else
if <...> then
...
end
end
Last edited by shradibop (Oct. 5, 2020 14:15:35)
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Sensing
_______________________________________________________________________________________________
or you could also do this slightly more effective method:
can be created with this:
But it doesn’t work with the shift, control, tab, etc. keys.
Workaround for
_______________________________________________________________________________________________
am i a clone? :: boolean :: sensingcan be made with this script:
when green flag clicked
set [am i a clone? v] to [false]
when i start as a clone
set [am i a clone? v] to [true]
when green flag clicked
forever
if <(am i a clone?) = [true]> then
do something
or you could also do this slightly more effective method:
when green flag clicked
switch costume to [Sprite Costume v]
when I start as a clone
switch costume to [Clone Costume v]
when I receive [Do Stuff v]_______________________________________________________________________________________________
if <(costume) = [Sprite Costume]> then
do something
end
if <(costume) = [Clone Costume]> then
do something else
end
<key [enter v] pressed?>
can be created with this:
key (join [enter] []) pressed?This can be used for other single character special keys, such as ; ‘ , \ as well as enter.
But it doesn’t work with the shift, control, tab, etc. keys.
Workaround for
turbo mode?::boolean sensing
when gf clicked
forever
repeat(10)
move(0)steps
end
if<(timer)<[.1]>then
set[turbo mode? v]to<[1]=[1]>
else
set[turbo mode? v]to<[0]=[1]>
Last edited by shradibop (March 10, 2021 16:38:34)
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Operator
_______________________________________________________________________________________________
_______________________________________________________________________________________________
(this) xor (that) :: boolean :: operatorscan be made with this:
<not<(this) = (that)>>_______________________________________________________________________________________________
true :: boolean :: operatorscan be made with this:
<[1]=[1]>_______________________________________________________________________________________________
false :: boolean :: operatorscan be made with this:
<[1]>[2]>_______________________________________________________________________________________________
letters (start) through (end :: variables) of (string) :: reporter :: operatorscan be done with this:
set [iterator v] to (start)_______________________________________________________________________________________________
set [result v] to []
repeat until (((end :: variables)- (start))+(1)
set [result v] to (join (result) (letter (iterator) of (string)))
end
() ≥ () :: boolean :: operatorscan be done with:
<not <()<()>>_______________________________________________________________________________________________
() ≤ () :: boolean :: operatorscan be done with:
<not <()>()>>_______________________________________________________________________________________________
[sign v] of () :: reporter operators // reports "1" if the input is positive, "-1" if negative, and "0" when the number is 0.can be workarounded with:
(((n) / ([abs v] of (n)))+(0))
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Variable
_______________________________________________________________________________________________
_______________________________________________________________________________________________
List Blocks :: hat :: list_______________________________________________________________________________________________
item [last v] of [list v] :: list
item (length of [list v]) of [list v] :: list_______________________________________________________________________________________________
copy list [ v] to list [ v] :: list
when I receive [ v]_______________________________________________________________________________________________
delete (All v) of [list b v]
set [# v] to [0]
repeat (length of [list a v] :: list)
change [# v] by (1)
add (item (#) of [list a v] :: list) to [list b v]
end
(item [random v] of [list v] :: list)
(item (pick random (1) to (length of [list v])) of [list v] :: list)
- Vibrato
-
1000+ posts
Helpful Workarounds for Frequently Suggested Blocks!
This is the top sticky right now. Are you trying to make a new one?
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Nice
Could you link this project in the sticky? It contains lots of these blocks, just placed into a project for easy backpacking, so they don't have to copy all the blocks. I made that project specifically to be included in the sticky.
Well, you just linked it. But it's helpful, and you should stick around to help people out with their projects.
Last edited by shradibop (Oct. 2, 2020 16:17:24)
- Ihatr
-
1000+ posts
Helpful Workarounds for Frequently Suggested Blocks!
BearSlothCoding gave him permission to create it. This is the top sticky right now. Are you trying to make a new one?
- fdreerf
-
1000+ posts
Helpful Workarounds for Frequently Suggested Blocks!
BSC no longer wants to own it. This is the top sticky right now. Are you trying to make a new one?
- Ihatr
-
1000+ posts
Helpful Workarounds for Frequently Suggested Blocks!
I meant for it to be included around the top, specifically near the introduction. Thanks for the comment on it thoughNice
Could you link this project in the sticky? It contains lots of these blocks, just placed into a project for easy backpacking, so they don't have to copy all the blocks. I made that project specifically to be included in the sticky.
Well, you just linked it. But it's helpful, and you should stick around to help people out with their projects.

- Super_Scratch_Bros20
-
1000+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Congrats on the sticky!
- shradibop
-
100+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Congrats on the sticky!
Thanks!
- fdreerf
-
1000+ posts
Helpful Workarounds for Frequently Suggested Blocks!
A fairly unexpected sticky owner, but a welcome one.
- Vercte
-
500+ posts
Helpful Workarounds for Frequently Suggested Blocks!
Good job on adopting the sticky!
this probably will be the only time I'll see today as the OP timestamp on a sticky
this probably will be the only time I'll see today as the OP timestamp on a sticky
- Discussion Forums
- » Suggestions
-
» Helpful Workarounds for Frequently Suggested Blocks!