Discuss Scratch

codeman1044
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

Is this topic an open poll for workarounds for requested features?

I couldn't help it, although it was kind of a stretch…


I'm not even sorry

This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
openPoll
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

codeman1044 wrote:

Is this topic an open poll for workarounds for requested features?

I couldn't help it, although it was kind of a stretch…


I'm not even sorry
Wow. Just wow.

But not really. More like a list instead of a poll

Moi? Whaddya wahnt from moi?

——

Inactive Scratcher • making memes wen??? • define defineI have Robux >:)1,000+ hours on Splatoon 2 • 250+ hours on Pokémon White • 100+ hours on MinecraftAn 8 bit remix I love • i have lots game • too lazy to make rainbows • still a proud Windows 7 user
DaEpikDude
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

Workaround for an <if <…> then <…>> boolean block:

Za-Chary wrote:

It's subtle, but there is a relatively simple workaround.

<<not <> > or <> >

When you write this:

<if <boolean A> then <boolean B> ::control>

It is always true unless “boolean A” is true and “boolean B” is false. Similarly:

<<not <boolean A> > or <boolean B> >

If “boolean A” is false, then the entire boolean would be true due to the “or” statement. If “boolean A” is true, then we need “boolean B” to be true in order for the boolean to be true (otherwise, it's false). In other words, this boolean is always true unless “boolean A” is true and “boolean B” is false.

Applying this logic to the example you gave might make more sense.

And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
-Reshiram-
Scratcher
100+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

oof nevermind my post b r o k e

Last edited by -Reshiram- (Aug. 5, 2019 19:26:48)


I am now @SquirreIstar with an i, as in “I used to be -Reshiram-”
Mr_PenguinAlex
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

DaEpikDude wrote:

Workaround for an <if <…> then <…>> boolean block:

Za-Chary wrote:

-snip-
r.i.p my suggestion

WindOctahedron
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

[] starts with []? :: operators boolean
The workaround:
define check if (string) starts with (letters)
set [i v] to (1)
set [output v] to []
repeat (length of (letters :: custom arg))
if <not <(letter (i) of (string :: custom arg)) = (letter (i) of (letters :: custom arg))>> then
set [output v] to [false]
end
if <not <(output) = [false ]>> then
change [i v] by (1)
if <[i v] > (length of (letters :: custom arg))> then
set [output v] to [true]
end
end
Taken from here. @hedgehog_blue posted another workaround:
define does (word) start with (letters)?
set [number v] to (1)
set [result v] to [unknown]
repeat (length of (letters :: custom arg))
if <not<(letter (number) of (letters :: custom arg))=(letter (number) of (word :: custom arg))>> then
set [result v] to [false]
stop [this script v]
end
change [number v] by (1)
end
set [result v] to [true]

Last edited by WindOctahedron (Aug. 27, 2019 15:50:55)


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.
lunaraemaemae
Scratcher
50 posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

prievios costume is in the set costume block.

(^_^)   
this is my kumquat killer.STRIKE THAT DEMON DOWN PAPYRUS!!!!
DaEpikDude
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

<<A> xor <B>::operators>
can also be workarounded as
<not <<A> = <B>>>
A xor B returns true if one, but not both, of A and B are 1: i.e. A and B are different.
This would also return true only if A and B are both different.

(slightly shorter than “(A or B) and not (A and B)”)

And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
Computer_Fizz
Scratcher
100+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

Better way to make a “when stop sign clicked”
when @greenFlag clicked
forever
set [timer v] to (timer)
end

when [timer v] > (timer :: variables)
. . .
Better way to make a “when <boolean>”
when [timer v] > (timer :: variables)
if <. . .> then
broadcast [WhenBoolean v]
end
set [timer v] to (timer)

I don't understand the “move up 10 steps” one though… that the regular “move 10 steps” moves in the direction the sprite is pointing?

Last edited by Computer_Fizz (Sept. 25, 2019 19:56:09)

46009361
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

My workaround for a suggested block
(which keys pressed? :: sensing)
:
https://scratch.mit.edu/projects/328947478/

Inspired by coder2045—which, in turn, got inspired by Mr_PenguinAlex.
What's wrong with these blocks? There are zero mistakes because no round has started yet. Beware that some of the mistakes don't relate to the Scratch blocks below.
// No round has started yet.
Be the first to comment all of the mistakes on my profile correctly and you'll get a love! You can't comment any mistakes right now because there are none!
46009361
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

DaEpikDude wrote:

<<A> xor <B>::operators>
can also be workarounded as
<not <<A> = <B>>>
A xor B returns true if one, but not both, of A and B are 1: i.e. A and B are different.
This would also return true only if A and B are both different.

(slightly shorter than “(A or B) and not (A and B)”)
I think this is better:
<not <<not <<A> or <B>>> or <<A> and <B>>>>

Inspired by coder2045—which, in turn, got inspired by Mr_PenguinAlex.
What's wrong with these blocks? There are zero mistakes because no round has started yet. Beware that some of the mistakes don't relate to the Scratch blocks below.
// No round has started yet.
Be the first to comment all of the mistakes on my profile correctly and you'll get a love! You can't comment any mistakes right now because there are none!
WindOctahedron
Scratcher
1000+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

kChiaEC19 wrote:

DaEpikDude wrote:

<<A> xor <B>::operators>
can also be workarounded as
<not <<A> = <B>>>
A xor B returns true if one, but not both, of A and B are 1: i.e. A and B are different.
This would also return true only if A and B are both different.

(slightly shorter than “(A or B) and not (A and B)”)
I think this is better:
<not <<not <<A> or <B>>> or <<A> and <B>>>>
I disagree, it's longer (and therefore slower to calculate).

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.
Computer_Fizz
Scratcher
100+ posts

(Wanting block workarounds posted!) The Ultimate List of Workarounds and More ②.⓪

Note: This thread is now replaced by this one in the stickies. I have also requested this thread to be closed to keep all the discussion in one place.

Powered by DjangoBB