Discuss Scratch
- Discussion Forums
- » Suggestions
- » Scratch Workaround Guide VII
- Little_Mittle12345
-
100+ posts
Scratch Workaround Guide VII
What? I added a workaround for “mouse dragging this sprite”! That's the name I use for what you guys have been calling “this sprite holding”
Since getting it to work with the “set drag mode: draggable” block from the Sensing category was kinda tricky, I tried a few different approaches before settling on one which was more complicated but (as far as I can tell) always works. If you wanna check out those other methods and all the details, I made a demo project showing them off: Drag detection methods
Thanks for the discussion about this block!
I suggested a workaround for a different version of sprite clicked and I didn’t even get idea of mouse dragging sprite.
- yavuz61035
-
500+ posts
Scratch Workaround Guide VII
here's a workaround for "broadcast for only " if you have that broadcast receivers on everything
...if you also want more than 1 specific broadcast at the same time use lists
set [broadcast sprite v] to [stage]
broadcast [message69 v]
// In the stage...
when i receive [message69 v]
if <(broadcast sprite) = [stage]> then
...
end
when green flag clicked
delete all of [broadcast sprites v] :: list
...
add [stage] to [broadcast sprites v]
broadcast [message69 v]
wait (0) seconds :: control // dont know if this is needed
delete (item # of [stage] in [broadcast sprites v] :: list) of [broadcast sprites v]
// In the stage...
when i receive [message69 v]
if <[broadcast sprites v] contains [stage]> then
...
end
Last edited by yavuz61035 (Nov. 17, 2022 07:51:33)
- _nix
-
1000+ posts
Scratch Workaround Guide VII
I'm not interested in adding different versions of existing Scratch blocks—they don't need workarounds, they already exist. I adapted the idea of detecting if the mouse is on top of and clicking (pressing down) the sprite, and made it into what I feel is a more unique boolean block: “is the mouse dragging this sprite”.What? I added a workaround for “mouse dragging this sprite”! That's the name I use for what you guys have been calling “this sprite holding”(snip)
Thanks for the discussion about this block!
I suggested a workaround for a different version of sprite clicked and I didn’t even get idea of mouse dragging sprite.
(This thread is specifically for workarounds to suggested blocks. That's why it's a sticky in the Suggestions directory. If a block were already part of Scratch, then nobody is really going to suggest it, so people aren't going to be looking for - or needing - a workaround. To be clear, I think there is a lot of fun and value in coming up with workarounds to existing blocks—it teaches more about how those blocks work and helps you think outside the box to come up with new solutions to blocks we take for granted—but those just aren't a fit for the purpose of this sticky.)
(edit: PS, if you find me replying to someone else's post but not your own, it doesn't mean I've forgotten about your post, it just takes me time to make complete replies and I don't have a lot of free time outside work! I try to reply to everything, especially new workaround suggestions… but those are also what take me the longest, lol, since they take the most thinking-through to make sure I'm considering the workaround fully!)
Last edited by _nix (Nov. 17, 2022 10:49:02)
- Little_Mittle12345
-
100+ posts
Scratch Workaround Guide VII
It’s of a Boolean of <this sprite clicked>I'm not interested in adding different versions of existing Scratch blocks—they don't need workarounds, they already exist. I adapted the idea of detecting if the mouse is on top of and clicking (pressing down) the sprite, and made it into what I feel is a more unique boolean block: “is the mouse dragging this sprite”.What? I added a workaround for “mouse dragging this sprite”! That's the name I use for what you guys have been calling “this sprite holding”(snip)
Thanks for the discussion about this block!
I suggested a workaround for a different version of sprite clicked and I didn’t even get idea of mouse dragging sprite.
(This thread is specifically for workarounds to suggested blocks. That's why it's a sticky in the Suggestions directory. If a block were already part of Scratch, then nobody is really going to suggest it, so people aren't going to be looking for - or needing - a workaround. To be clear, I think there is a lot of fun and value in coming up with workarounds to existing blocks—it teaches more about how those blocks work and helps you think outside the box to come up with new solutions to blocks we take for granted—but those just aren't a fit for the purpose of this sticky.)
(edit: PS, if you find me replying to someone else's post but not your own, it doesn't mean I've forgotten about your post, it just takes me time to make complete replies and I don't have a lot of free time outside work! I try to reply to everything, especially new workaround suggestions… but those are also what take me the longest, lol, since they take the most thinking-through to make sure I'm considering the workaround fully!)
Last edited by Little_Mittle12345 (Nov. 17, 2022 19:51:52)
- _nix
-
1000+ posts
Scratch Workaround Guide VII
Oh okay. I guess I didn't really think of uses for that, which is my bad! I'll add it.It’s of a Boolean of <this sprite clicked>I'm not interested in adding different versions of existing Scratch blocks—they don't need workarounds, they already exist. I adapted the idea of detecting if the mouse is on top of and clicking (pressing down) the sprite, and made it into what I feel is a more unique boolean block: “is the mouse dragging this sprite”.What? I added a workaround for “mouse dragging this sprite”! That's the name I use for what you guys have been calling “this sprite holding”(snip)
Thanks for the discussion about this block!
I suggested a workaround for a different version of sprite clicked and I didn’t even get idea of mouse dragging sprite.
- _nix
-
1000+ posts
Scratch Workaround Guide VII
This suggestion got kinda lost in the woods (I forgot about it). I added it now, thank you!<(a) is an integer?::operators>Workaround:<(a) = (round(a))>
I also added a workaround for “decimal (fractional) part of x” at the same time. Those are both near the related “round to nearest 100 / round to decimal digits” workarounds!
- medians
-
1000+ posts
Scratch Workaround Guide VII
This suggestion got kinda lost in the woods (I forgot about it). I added it now, thank you!<(a) is an integer?::operators>Workaround:<(a) = (round(a))>
I also added a workaround for “decimal (fractional) part of x” at the same time. Those are both near the related “round to nearest 100 / round to decimal digits” workarounds!
<(x) is a number? ::operators>Workaround:
<((x) * (1)) = (x)>
- _nix
-
1000+ posts
Scratch Workaround Guide VII
Wow, this is pretty awesome! I think the second part needs some extra testing, ‘cuz Scratch’s execution order—which scripts it evaluates first if you activate two scripts (like “when I receive”) at the exact same time—is a little wonky, and would probably have an impact here. It's more reliable to just use multiple variables for each broadcast message. here's a workaround for "broadcast for only " if you have that broadcast receivers on everything
I added the first approach (with credits) though, and included some extra details and methods which you might find interesting. Thanks for sharing!
- yavuz61035
-
500+ posts
Scratch Workaround Guide VII
i found a workaround for “delete (…) in (…)”
goin through the suggestions directory oh yeah
goin through the suggestions directory oh yeah
define delete (deleting) in (text)
set [i v] to [1]
set [output v] to [ ]
if <not <(length of (deleting)) = [0]>> then
repeat until <(i) > (length of (text))>
set [searching v] to [ ]
set [i2 v] to [0]
repeat until <(i2) > ((length of (deleting)) - (1))>
set [searching v] to (join (searching) (letter ((i) + (i2)) of (text))
change [i2 v] by (1)
end
if <not <(searching) = (deleting)>> then
set [out v] to (join (out) (searching))
end
change [i v] by (length of (deleting))
end
else
set [output v] to (text)
end
Last edited by yavuz61035 (Nov. 18, 2022 13:19:25)
- dihectogon
-
45 posts
Scratch Workaround Guide VII
Workarounds for:
<(x) is a string? ::operators>1.
define (x) is a string?2.
set [result v] to [false]
if <((x) * (1)) = (x)> then
stop [this script v]
end
set [result v] to [true]
define (x) is a string?
set [result v] to [false]
if <(x) = []> then
set [result v] to [true]
stop [this script v]
end
if <<(x) > [0]> and <not <([abs v] of (x)) = [0]>>> then
stop [this script v]
else
if <(x) < [0]> then
stop [this script v]
else
if <(x) = [0]> then
stop [this script v]
end
end
end
set [result v] to [true]
- Little_Mittle12345
-
100+ posts
Scratch Workaround Guide VII
Workaround for win the unit of 10
repeat (unit)
repeat (Unit)
Do something
end
end
- randomguy3513
-
1000+ posts
Scratch Workaround Guide VII
when this sprite clicked
if <Held down for (2) seconds :: sensing> then
...
end
when this sprite clicked
wait (2) secs
wait until <mouse down>
...
- 5_g
-
1000+ posts
Scratch Workaround Guide VII
Does anyone have a "rotate around (x) (y)" block?
- cookieclickerer33
-
1000+ posts
Scratch Workaround Guide VII
Idk if this helps but you can put the
(item (1 v) of [list v] :: list)Inside of operatior slots
if (item (1 v) of [list v] :: list) thenThis may be because it’s reusing some code from
end
<[List v] contains [thing] ?>And they forgot to remove the {is bool=true} part form the blocks code when adding it
Last edited by cookieclickerer33 (Dec. 20, 2022 19:38:38)
- owlover2010
-
100+ posts
Scratch Workaround Guide VII
Where's the workarounds for these?
think [Hmmm...] when <mouse down?> :: looks
say [Hello] for (2) secs
show variable [Variable v]
when sprite (answer) clicked :: events hat
...
when backdrop switches to [hello v]
pen up
say [Hi!]
move (10) steps
say (costume #) and (size) and (backdrop name) :: looks
when this sprite clicked and <key [+ v] pressed?> :: events hat
if <key [z v] pressed?> then
pen up
change [(volume)(distance to [ v]) v] effect by (25) :: looks
ask [What's your name?] and wait
change [colour v] effect by (25) // Australian spelling
set size to (1000000) % without exceeding max size :: looks
when this sprite clicked
end scripts for this sprite :: control
Last edited by owlover2010 (Dec. 24, 2022 00:11:04)
- -_RedGamer_-
-
52 posts
Scratch Workaround Guide VII
forever if <>Workaround:
forever
if <> then
end
end
- medians
-
1000+ posts
Scratch Workaround Guide VII
Some of those already exist. Where's the workarounds for these?... ::grey
think [Hmmm...] when <mouse down?> :: looks
if <mouse down?> then
think [Hmmm...]
end
when backdrop switches to [hello v]
...
say (costume #) and (size) and (backdrop name) :: looks
say (costume #) for (2) secs
say (size) for (2) secs
say (backdrop name) for (2) secs
when this sprite clicked and <key [+ v] pressed?> :: events hat
if <key [z v] pressed?> then
...
end
when this sprite clicked
end scripts for this sprite :: control //this is just stop other scripts in sprite..
when this sprite clicked
if <key (join [+] []) pressed?> then
...
end
set size to (1000000) % without exceeding max size :: looksThis wouldn't be allowed, and you can just swap costumes.
- medians
-
1000+ posts
Scratch Workaround Guide VII
Fixed the color so it looks like 1.x now.forever if <> {
} ::control
And here are workarounds for # of costumes I came up with:

- medians
-
1000+ posts
Scratch Workaround Guide VII
If you want to test the scratchblocks plugin, go here.when green flag clicked
say [scratch is weird] for (2) secs
Oh and, replace setting the # of backdrops var to 0 with the same thing but 1, and remove the + 1 thing.Fixed the color so it looks like 1.x now.
And here are workarounds for # of costumes I came up with:
(LARGE IMAGE ALERT)
Last edited by medians (Jan. 1, 2023 22:48:52)
- Discussion Forums
- » Suggestions
-
» Scratch Workaround Guide VII