Discuss Scratch
- Discussion Forums
- » Suggestions
- » Workarounds to frequently suggested blocks
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
This forum topic aims to document a list of common workarounds for blocks which are requested a lot. A workaround is a way to create blocks (usually nonexistant ones) using other ordinary blocks. For example, the block:
Keep in mind, I'm not saying these blocks shouldn't be added to Scratch because they're workaroundable – I'm just offering a workaround for the short term so people don't think that they can't make their project work without a certain block.
previous costume :: lookscan be recreated with the following blocks instead:
switch costume to ( ( costume [number v] :: looks ) - ( 1 ) )
Keep in mind, I'm not saying these blocks shouldn't be added to Scratch because they're workaroundable – I'm just offering a workaround for the short term so people don't think that they can't make their project work without a certain block.
Last edited by Computer_Fizz (Jan. 28, 2020 23:12:31)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Motion :: motion hat
———————————————————–point towards x: ( WantedX ) y: ( WantedY ) :: motioncan be recreated by moving a sprite to that x and y then pointing toward that sprite. it can also be recreated with the following (more 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 recreated with the following code:point in direction ( ( direction ) - ( 180 ) )
Last edited by Computer_Fizz (Feb. 23, 2020 00:57:37)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Looks :: looks hat
previous costume :: lookscan be recreated with the following code:switch costume to ( ( costume [number v] :: looks ) - ( 1 ) )
Last edited by Computer_Fizz (Oct. 1, 2019 18:47:34)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Sound :: sound hatNo sound blocks yet
Last edited by Computer_Fizz (Oct. 1, 2019 18:48:02)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Events :: events hat
———————————————————–when ( :: obsolete) clicked :: events hatcan be recreated with the following code:
...when @greenFlag clicked
forever
set [timer v] to ( timer )
end
when [timer v] > ( timer :: variables )
. . .
when < . . . > is true :: events hatcan be recreated with the following code:when @greenFlag 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 < . . . > then
. . .
end
end
Last edited by Computer_Fizz (Oct. 26, 2019 18:57:22)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Control :: control hat
while < . . . > {can be recreated with the following code:
. . .
} @loopArrow :: controlrepeat until < not < . . . > >
. . .
end
Last edited by Computer_Fizz (Oct. 1, 2019 18:48:57)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Sensing :: sensing hat
———————————————————–< am i a clone ? :: sensing>can be recreated with the following code:when @greenFlag clicked
set [am i a clone? v] to [false]
// this variable must be "for this sprite only"
when I start as a clone
set [am i a clone? v] to [true]
if < ( am i a clone? ) = [true] > then
...
< key [enter v] pressed? >can be recreated with the following code:< key ( join [enter] [] ) pressed? >This can be used for “single-letter” keys, such as ; ' , \ and it also works with enter.
It does not seem to work with any non-single-letter keys besides enter, as shift, control, tab, etc will all fail.
Last edited by Computer_Fizz (March 24, 2020 20:20:52)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
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 < ( . . . ) > ( . . . ) > >
Last edited by Computer_Fizz (Oct. 18, 2019 18:13:29)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Variables :: variables hatNo variable blocks yet
Last edited by Computer_Fizz (Oct. 1, 2019 18:52:22)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
List :: list hat
( item ( last v ) of [ list v] )can be recreated with the following code:( item ( length of [ list v] ) of [ list v] )
Last edited by Computer_Fizz (Jan. 4, 2020 05:02:57)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Guide for contributing to this thread:
- There must be several instances of the workaround you are creating being suggested as an official block. Not necessarily rejected, but suggested.
- Workarounds are chosen with the priority of : most functionality, least blocks, least variables. There may be exceptions to this very rarely.
- Use a blank scratch project to test out both the workaround listed and your workaround to see if it works to the standards
- Use the ScratchBlocks feature to let me know what to work around is and I will review it.
- If you are replacing an already existing workaround, explain what yours does better than the already existing one
- Harassing me will not result in your workaround being added.
- Posts that do not contribute to the thread will be ignored.
Last edited by Computer_Fizz (Jan. 13, 2020 19:20:03)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
:O I got stickied. My first sticky :) Do you have any ideas for improvement? Congrats on sticky!
Last edited by Computer_Fizz (Oct. 1, 2019 05:18:01)
- 54329
-
500+ posts
Workarounds to frequently suggested blocks
Perhaps add a title to each post. Ex: On this reply, title it with the category of blocks it is (like how you have sounds, lists, etc). Otherwise looks good!:O I got stickied. My first sticky :) Do you have any ideas for improvement? Congrats on sticky!
- WindOctahedron
-
1000+ posts
Workarounds to frequently suggested blocks
You can also add this to Operators (I can't easily quote it, because the thread is closed).
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
Thank you both for the feedback! I have now added titles to the posts. I've also looked at the operators boolean but I'm not sure if it's a good idea to add it. Is it requested enough that it would be worthwhile in a mainstream sticky? (I may consider making a second non-sticky thread and linking to it from here for less suggested workarounds)
- openPoll
-
1000+ posts
Workarounds to frequently suggested blocks
Well done on this post! It's very nice, simple and intuitive. 

- Beamy68
-
100+ posts
Workarounds to frequently suggested blocks
Nice! I like the idea! 
Also congrats on getting stickied even though I didn't find this through the sticky !
Extra things you can do with this that the normal timer can't

Also congrats on getting stickied even though I didn't find this through the sticky !
Here's one forSensing :: sensingBetter Timer(s)! the (s) is there because you can make multiple in one project!
Using thewhen ( :: obsolete) clicked :: events hatcan be recreated with the following code:
Code :: customwhen @greenFlag clicked
forever
reset timer
end
when [timer v] > (0.1)
Code :: custom
// Now we can create multiple timer variables that run even when the project is stopped like the normal timer.
when green flag clicked
forever
change [timer1 v] by [0.001]
change [timer2 v] by [0.001]
change [timer3 v] by [0.001]
end
when [timer v] > (0.1)
forever
change [timer1 v] by [0.001]
change [timer2 v] by [0.001]
change [timer3 v] by [0.001]
end
define reset timer (timer #)
if < (timer #) = [1]> then // You'll need this to reset these timers
set [timer1 v] to [0]
end
if < (timer #) = [2]> then
set [timer2 v] to [0]
end
if < (timer #) = [3]> then
set [timer3 v] to [0]
end
Extra things you can do with this that the normal timer can't
This can allow for: Hiding and Showing these timers.hide variable [timer1 v]
show variable [timer2 v]
Choosing intervals for each timer!when @greenFlag or (::obselete) clicked :: events hat
forever
change [timer1 v] by [100]
change [timer2 v] by [0.1289118201]
change [timer3 v] by [1]
end
Doing multiple workarounds that all use timers in a single project!// Such asChoosing a starting and ending point for the timers!
repeat for () secs {
...
} :: control
// by
reset timer (1) :: custom
repeat until <(timer1) = [secs]>
...
endwhen green flag clickedDefining how long a second is for each timers!
wait until <(timer1) = [45]>
repeat until <(timer2) = [3]>
change [timer2 v] by (0.001)
endwhen @greenFlag or (::obselete) clicked :: events hat
forever
change [timer1 v] by (1)
wait (5) secs
end
Assigning a timer to a specific sprite!
AND TONS MORE!
This took me 5 hours and I came up with this as I went, if this ends up not working for you, please let me know!
Last edited by Beamy68 (Oct. 7, 2019 01:53:11)
- Computer_Fizz
-
100+ posts
Workarounds to frequently suggested blocks
your multiple timers thing while cool as a concept 1) count too fast 2) isn't really a workaround (this is mostly intended for blocks). i may consider adding a link to a working version though.
i already have a previous costume workaround, so what's yours besides requiring a variable?
however, i will add the key enter pressed thing from your tests project
i already have a previous costume workaround, so what's yours besides requiring a variable?
however, i will add the key enter pressed thing from your tests project
- Discussion Forums
- » Suggestions
-
» Workarounds to frequently suggested blocks