Discuss Scratch
- Discussion Forums
- » Suggestions
- » Scratch Workaround Guide VII
- 1080GBA
-
500+ posts
Scratch Workaround Guide VII
? dont quote for no reason<(a) is an integer?::operators>Workaround:<(a) = (round(a))>
- 1080GBA
-
500+ posts
Scratch Workaround Guide VII
i know that I know a workaround for an XOR gate (only 1 of 2 conditions are true = the XOR is true).<(<some condition :: grey> + <some condition :: grey>) = [1]>
So feel free to add it in.
- 1080GBA
-
500+ posts
Scratch Workaround Guide VII
hey nix i like single blocked workarounds more can you do it
example:
change
example:
change
if <(1) = (test)> then{into
change [test v] by (1)::variables}::control
change [test v] by ((1)*<(1) = (test)>)::variables
- _nix
-
1000+ posts
Scratch Workaround Guide VII
Thanks for the input! I feel like that would fit a tutorial project better, because you can use the same idea (like "[some value] * [a condition]“) with lots of different stack blocks, and put it together with itself in creative ways, but they don't really target one specific ”thing" a Scratcher wants to do. They're good for cutting down the size of your code, but the workarounds I'm including are more focused on solving specific goals and problems Scratchers aren't sure how to do with the current blocks. hey nix i like single blocked workarounds more can you do it
example:
changeif <(1) = (test)> then{into
change [test v] by (1)::variables}::controlchange [test v] by ((1)*<(1) = (test)>)::variables
Edit: BTW, I added the general idea (using math on boolean blocks) recently in Method 3 of the XOR workaround. I feel one-block tricks like that are a good idea and I'd love to find more places where it specifically comes in handy! But for now, Scratchers might be able to come up with that (and other uses too) which branch out from the basic idea in that workaround.
Last edited by _nix (July 5, 2022 10:19:07)
- ScratchCat_50
-
100+ posts
Scratch Workaround Guide VII
Sudgestion:
Where it mentions hacked blocks note the your project has a chance to be marked as NFE if used
Where it mentions hacked blocks note the your project has a chance to be marked as NFE if used
- _nix
-
1000+ posts
Scratch Workaround Guide VII
I'll do that since it's good to let people be aware, yeah, thank you! That said, I've hardly seen it happen, and I'm pretty sure 99% of hacked block usage goes unnoticed/ignored by the ST—so it's not too big a risk as far as I'm aware. Nonetheless, it's now mentioned where hacked blocks are shared! Sudgestion:
Where it mentions hacked blocks note the your project has a chance to be marked as NFE if used
…It's also probably a good idea to include a disclaimer when I'm literally running a stickied thread for anybody previously unfamiliar to come across, instead of just acting as though they're 100% supported no questions ever asked

- QuantumScratcher
-
100+ posts
Scratch Workaround Guide VII
good :)
Last edited by QuantumScratcher (July 15, 2022 17:54:32)
- Cassandra-princess
-
4 posts
Scratch Workaround Guide VII
congrats on the sticky!
also, there is another method for (# of costumes)set [old costume v] to (costume [number v] :: looks)
set [costumes v] to [1]
switch costume to ((0) + (0))
repeat (2)
next costume
end
repeat until <(costume [number v] :: looks) = [1]>
next costume
change [count v] by (1)
end
switch costume to (old costume)
- Official_GameTeam
-
100+ posts
Scratch Workaround Guide VII
here is a working around to a “min” and a “max” block. It is believed to be helpful also.
https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/topic/594712/?page=1#post-6200139
https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/topic/594712/?page=1#post-6200139
- graham3078
-
100+ posts
Scratch Workaround Guide VII
Could you add a workaround for “when stop sign clicked”
- JRR078s
-
96 posts
Scratch Workaround Guide VII
Not sure of the upmost use of this, but since hex to decimal is included in this, I thought I'd share my workaround for a decimal to hex block.
There's probably some improvements that could be made to this.
There's probably some improvements that could be made to this.
define dec to hex (input)
set [index v] to (-1)
set [output v] to () // blank
set [digit v] to (1)
repeat until <(digit) = (0)>
change [index v] by (1)
exponent (16) ::custom
set [digit v] to ([floor v] of ((input) / (tempvalue)) ::data // tempvalue is defined in "exponent (16)"
end
repeat (index)
change [index v] by (-1)
exponent (16) :: custom
set [digit v] to (([floor v] of ((input) / (tempvalue))) mod (16))
set [output v] to (join (output) (item ((digit) + (1)) of [hextable v] :: list)) // "hextable" is a list with 0-9, and a-f, in that order
end
define exponent (base)
set [tempvalue v] to (1)
repeat (index)
set [tempvalue v] to ((tempvalue) * (base))
end
- k0d3rrr
-
1000+ posts
Scratch Workaround Guide VII
Such as? Could you add a workaround for “when stop sign clicked”
-
There are two methods (with reset timer and without reset timer).
Method 1 (thanks to the Scratch Wiki)
when green flag clicked
forever
reset timer
end
when [timer v] > (0.1)
...
Method 2
when green flag clicked
forever
set [timer v] to (timer)
end
when [timer v] > (timer:: variables)
...
- medians
-
1000+ posts
Scratch Workaround Guide VII
<[] is an [ v]? ::operators>Workaround:
define (thing) is an (type)?
set [actualType v] to []
if <(thing) < [0]> then
if <(thing) = ((thing) * (1))> then
if <(thing) = ([floor v] of (thing))> then
set [actualType v] to [negative integer]
else
set [actualType v] to [negative decimal]
end
else
set [actualType v] to [string]
end
else
if <(thing) = [0]> then
set [actualType v] to [zero]
else
if <(thing) = ([floor v] of (thing))> then
set [actualType v] to [positive integer]
else
set [actualType v] to [positive decimal]
end
end
end
if <(type) = [positive number]> then
if <<(actualType) = [positive decimal]> or <(actualType) = [positive integer]>> then
set [result v] to [true]
else
set [result v] to [false]
end
else
if <(type) = [negative number]> then
if <<(actualType) = [negative decimal]> or <(actualType) = [negative integer]>> then
set [result v] to [true]
else
set [result v] to [false]
end
else
if <(type) = [integer]> then
if <<(actualType) = [positive integer]> or <(actualType) = [negative integer]>> then
set [result v] to [true]
else
set [result v] to [false]
end
else
if <(type) = [decimal]> then
if <<(actualType) = [positive decimal]> or <(actualType) = [negative decimal]>> then
set [result v] to [true]
else
set [result v] to [false]
end
else
if <(type) = (actualType)> then
set [result v] to [true]
else
set [result v] to [false]
end
end
end
end
end
Last edited by medians (Aug. 7, 2022 22:07:01)
- medians
-
1000+ posts
Scratch Workaround Guide VII
Fixed because the previous one didn’t have some types and the string was broken: https://scratch-mit-edu.ezproxyberklee.flo.org/projects/720127300
Last edited by medians (Aug. 7, 2022 22:44:10)
- HaydenAgain
-
100+ posts
Scratch Workaround Guide VII
I got a workaround:
same goes for other keys
<key [enter v] pressed?>
<key (join [enter] []) pressed?>
same goes for other keys
Last edited by HaydenAgain (Aug. 17, 2022 09:11:56)
- HaydenAgain
-
100+ posts
Scratch Workaround Guide VII
can you add a workaround of the block below?
<pointing towards [Sprite1 v]? :: sensing>
- Sine_Modder
-
100+ posts
Scratch Workaround Guide VII
✽ Pause & Play Sound
Using the pitch effect block, it is somewhat possible to pause sound.
But Remember, Scratch has a pitch limit of -360 to 360, So the sound will play very slow.
Using the pitch effect block, it is somewhat possible to pause sound.
define Pause
set volume to (0) %
set [pitch v] effect to (-360) :: sound
define Play
set [pitch v] effect to (0) :: sound
set volume to (100) %
But Remember, Scratch has a pitch limit of -360 to 360, So the sound will play very slow.
- WindowsMeRules2000
-
500+ posts
Scratch Workaround Guide VII
Can I make the 8th workaround guide?
- _nix
-
1000+ posts
Scratch Workaround Guide VII
Sorry, I'm not currently looking for takeovers. I know this thread has been a bit inactive, but it's due to temporary personal life circumstances (mostly my IRL work being pretty crazy)—I do intend to expand this guide when I have the time! Can I make the 8th workaround guide?
- Discussion Forums
- » Suggestions
-
» Scratch Workaround Guide VII