Discuss Scratch

NxNmultiply
Scratcher
100+ posts

Workarounds to frequently suggested blocks

for{a::grey}<b::grey>{c::grey}then{
...
}::control

a::grey
while<b::grey>then{
...
c::grey
}::control

Example:
[double v] [b] = (1)::variables
for{[double v] [a] = (0)::variables}\ <(a)\<(16)>\ {[a]++::variables}then{
[b] *= (3) ::variables
}::control

set [b v] to [1]
set [a v] to [0]
while<(a)\<[16]>then{
set [b v] to ((b)*(3))
change [a v] by (1)
}::control
-LekkerGames-
Scratcher
67 posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

Events :: events hat
when ( :: obsolete) clicked :: events hat
...
can be recreated with the following code:
when @greenFlag clicked
forever
set [timer v] to ( timer )
end

when [timer v] > ( timer :: variables )
. . .
It can also be recreated like this:
when green flag clicked
forever
reset timer
end
when [timer v] > (0)
...
Super_Scratch_Bros20
Scratcher
1000+ posts

Workarounds to frequently suggested blocks

-LekkerGames- wrote:

Computer_Fizz wrote:

Events :: events hat
when ( :: obsolete) clicked :: events hat
...
can be recreated with the following code:
when @greenFlag clicked
forever
set [timer v] to ( timer )
end

when [timer v] > ( timer :: variables )
. . .
It can also be recreated like this:
when green flag clicked
forever
reset timer
end
when [timer v] > (0)
...

No, actually. The timer resets once the green flag starts. So, it would have to be a larger value than zero once the green flag is pressed. In other words, once the green flag would be pressed, that script would run, not when the stop sign is clicked.
Hopeijay
Scratcher
90 posts

Workarounds to frequently suggested blocks

NxNmultiply wrote:

for{a::grey}<b::grey>{c::grey}then{
...
}::control

a::grey
while<b::grey>then{
...
c::grey
}::control

Example:
[double v] [b] = (1)::variables
for{[double v] [a] = (0)::variables}\ <(a)\<(16)>\ {[a]++::variables}then{
[b] *= (3) ::variables
}::control

set [b v] to [1]
set [a v] to [0]
while<(a)\<[16]>then{
set [b v] to ((b)*(3))
change [a v] by (1)
}::control

You can probably do the ‘while’ block with:
set [b v] to [1]
set [a v] to [0]
repeat until <not<(a)\<[16]>>then{
set [b v] to ((b)*(3))
change [a v] by (1)
}::control

Hope this helps!
8bitjake
Scratcher
100+ posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

List :: list hat
 ( item ( last v ) of [ list v] ) 
can be recreated with the following code:
 ( item ( length of [ list v] ) of [ list v] ) 

I want to suggest something new. Link will be posted here when the thread goes live.
Hopeijay
Scratcher
90 posts

Workarounds to frequently suggested blocks

Super_Scratch_Bros20 wrote:

-LekkerGames- wrote:

Computer_Fizz wrote:

Events :: events hat
when ( :: obsolete) clicked :: events hat
...
can be recreated with the following code:
when @greenFlag clicked
forever
set [timer v] to ( timer )
end

when [timer v] > ( timer :: variables )
. . .
It can also be recreated like this:
when green flag clicked
forever
reset timer
end
when [timer v] > (0)
...

No, actually. The timer resets once the green flag starts. So, it would have to be a larger value than zero once the green flag is pressed. In other words, once the green flag would be pressed, that script would run, not when the stop sign is clicked.

Actually no, I tested it out and it works just fine! -LekkerGames- is correct, that does also work.
Boomer001
Scratcher
1000+ posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

bounce :: motion
can be recreated with the following code:
point in direction ( ( direction ) - ( 180 ) )
There is a lot easier way to do that:
turn cw (180) degrees
Hopeijay
Scratcher
90 posts

Workarounds to frequently suggested blocks

Boomer001 wrote:

Computer_Fizz wrote:

bounce :: motion
can be recreated with the following code:
point in direction ( ( direction ) - ( 180 ) )
There is a lot easier way to do that:
turn cw (180) degrees

Or, for a more realistic bounce:
point in direction ([0] - (direction))
turn cw [180] degrees
FireEmeraldAnimator
Scratcher
31 posts

Workarounds to frequently suggested blocks

Is there a way to work around a repeat for ( ) seconds loop?

Last edited by FireEmeraldAnimator (May 14, 2020 00:42:43)

BestUsernameSoFar
Scratcher
100+ posts

Workarounds to frequently suggested blocks

FireEmeraldAnimator wrote:

Is there a way to work around a repeat for ( ) seconds loop?
Yes, do this.
Create a variable
(seconds)
Make this variable set to zero and then always change every one second.
set [seconds v] to (0)
forever
wait (1) secs
change [seconds v] by (1)
end
After that, do this:
repeat until <(seconds)= (5)>
set [seconds v] to (0)
. . .
end
FireEmeraldAnimator
Scratcher
31 posts

Workarounds to frequently suggested blocks

BestUsernameSoFar wrote:

FireEmeraldAnimator wrote:

Is there a way to work around a repeat for ( ) seconds loop?
Yes, do this.
Create a variable
(seconds)
Make this variable set to zero and then always change every one second.
set [seconds v] to (0)
forever
wait (1) secs
change [seconds v] by (1)
end
After that, do this:
repeat until <(seconds)= (5)>
set [seconds v] to (0)
. . .
end
Okay, thanks!
Monniasza_spzoo
Scratcher
100+ posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

List :: list hat
 ( item ( last v ) of [ list v] ) 
can be recreated with the following code:
 ( item ( length of [ list v] ) of [ list v] ) 

It's not only way.
(item (join [la] [st]) of [list v] :: list)
The_King_In_Yellow
Scratcher
15 posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

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 < ( . . . ) > ( . . . ) > >
for those 1984 fans out there,
<true:: operators>
can be recreated as
<([2]+[2])=[5]>
Beamy68
Scratcher
100+ posts

Workarounds to frequently suggested blocks

Multiple people wrote:
-snip-

The_King_In_Yellow wrote:

for those 1984 fans out there,
<true:: operators>
can be recreated as
<([2]+[2])=[5]>
Please only use constructive criticism and real workarounds.
Example:
<true::operators>
can be recreated as
<((2) + (two)) = [5]>
set [two v] to [3]
JustTbear
Scratcher
100+ posts

Workarounds to frequently suggested blocks

ComputerFizz wrote:

bounce :: motion
can be recreated with the following code:
point in direction ( ( direction ) - ( 180 ) )
… or easily with
turn ccw (180) degrees

Last edited by JustTbear (May 23, 2020 08:17:38)

DaveTheBaby
Scratcher
17 posts

Workarounds to frequently suggested blocks

orrinpants wrote:

i wish there was a AM/PM block


if <(current [AM/PM v]) = [PM]> then
say [its late] for (2) secs
end
I might do that in my mod
Ace12Best
Scratcher
100+ posts

Workarounds to frequently suggested blocks

If you made a variable “Speed” (let's say speed is 12)
You would do
if <key [right] pressed?> then
change x by (speed)
end
But how do you do change x by -Speed
Do this
change x by ((0) - (speed)
I did that on my test account
Thanks for all the help I see on this topic it is amazing
howlepey000
Scratcher
32 posts

Workarounds to frequently suggested blocks

here is a idea!
when "stop sign picture" clicked
howlepey000
Scratcher
32 posts

Workarounds to frequently suggested blocks

can you add this block?
(event)
when stop sign clicked
BestUsernameSoFar
Scratcher
100+ posts

Workarounds to frequently suggested blocks

howlepey000 wrote:

can you add this block?
(event)
when stop sign clicked
Please create your own post. Don't nectropost.

Powered by DjangoBB