Discuss Scratch

HighlaneGamingStudio
Scratcher
100+ posts

Custom c blocks and hat blocks

stickfiregames wrote:

Support for custom c-blocks. Not sure about hats, because hats respond to events and all events already have a hat associated with them.
There's no “when
HighlaneGamingStudio
Scratcher
100+ posts

Custom c blocks and hat blocks

HighlaneGamingStudio wrote:

stickfiregames wrote:

Support for custom c-blocks. Not sure about hats, because hats respond to events and all events already have a hat associated with them.
There's no "when stop sign clicked" block.
The stop sign emoji worked fine in the preview but deleted everything after it once I posted it.
-Matteo8-
Scratcher
12 posts

Custom c blocks and hat blocks

what is the code for c blocks?
well, this could only work for blocks like this.
move () steps{
so you'd use a normal block, then add a { and add a space for it.
it's pretty easy! look:

when flag clicked

then when you add a { onto it, then it should work!
i don't think it will work for E blocks, but here's a scratch mod that can help you with making custom c blocks!: Clip CC

go to my blocks, make a block and then click “add a branch”

im pretty sure it wont work if you export it onto a scratch project, though it may make a undefined hat block. but you can try it!
TheCreatorOfUnTV
Scratcher
1000+ posts

Custom c blocks and hat blocks

So, you are suggesting that something like this:
(for (i ↑) from (start = 1) to (end = 10) (action λ) :: control stack) :: control hat
set (i) to (start)
repeat until <(i) > (end :: variables)>
run (action λ) @addInput :: control
change (i) by (1)
end
will be possible, right?
This is probably not going to happen without this block from Snap!:
run (action λ) @addInput :: control
which would significantly increase the complexity of Scratch, and at that point you may as well use Snap! instead of Scratch.
flynnremo2
Scratcher
19 posts

Custom c blocks and hat blocks

when someone replied
say [oh ok]


but clipCC editor looks like another version of scratch but with new blocks
-Matteo8-
Scratcher
12 posts

Custom c blocks and hat blocks

TheCreatorOfUnTV wrote:

So, you are suggesting that something like this:
(for (i ↑) from (start = 1) to (end = 10) (action λ) :: control stack) :: control hat
set (i) to (start)
repeat until <(i) > (end :: variables)>
run (action λ) @addInput :: control
change (i) by (1)
end
will be possible, right?
This is probably not going to happen without this block from Snap!:
run (action λ) @addInput :: control
which would significantly increase the complexity of Scratch, and at that point you may as well use Snap! instead of Scratch.
not exactly, you press return/enter on your keyboard and it shows up like a c block
-Matteo8-
Scratcher
12 posts

Custom c blocks and hat blocks

it does. but scratch doesn't have the branch feature.
-Matteo8-
Scratcher
12 posts

Custom c blocks and hat blocks

to make custom hat blocks, just make a random block that is a stack and doesnt exist, then add “ :: hat” on the end of it
flynnremo2
Scratcher
19 posts

Custom c blocks and hat blocks

-Matteo8- wrote:

to make custom hat blocks, just make a random block that is a stack and doesnt exist, then add “ :: hat” on the end of it
like
when [Fn v] key pressed :: hat
-Matteo8-
Scratcher
12 posts

Custom c blocks and hat blocks

flynnremo2 wrote:

-Matteo8- wrote:

to make custom hat blocks, just make a random block that is a stack and doesnt exist, then add “ :: hat” on the end of it
like
when [Fn v] key pressed :: hat
yes
mumu245
Scratcher
1000+ posts

Custom c blocks and hat blocks

Example of hat definition:
define hat ::hat
forever
wait until (my condition) // will run when it becomes true
run me ::custom // run the blocks below
wait until <not (my condition)> // wait for it to become false, then true again
end
MathStudios
Scratcher
40 posts

Custom c blocks and hat blocks

define {scripts inside block :: custom}
scripts inside c block :: custom

Last edited by MathStudios (Feb. 7, 2025 22:46:16)

MathStudios
Scratcher
40 posts

Custom c blocks and hat blocks

define {run script under hat block :: custom}
run script under hat block :: custom

Last edited by MathStudios (Feb. 7, 2025 22:45:53)

codeisBOOM
Scratcher
100+ posts

Custom c blocks and hat blocks

a better way to make a c block is that when making the block there is an option for making it a c block
also it will automatically add an end block and you can pull out a loop block before “define” is typed
[loop(type here) v] define c block
end
i cant show this because of limits
jmb1293634
Scratcher
1000+ posts

Custom c blocks and hat blocks

how about it was like this:
define{custom c-loop{
block input::custom
}::custom
and then you could use the block input anywhere under it
jmb1293634
Scratcher
1000+ posts

Custom c blocks and hat blocks

mr_bruh4131RECOVERED wrote:

Idea: broadcast boolean.
How this would work:
It would work as a “when I receive ” block, but in a boolean format.
please make your own topic and also that is rejected here
1.1 “broadcast recived” boolean block
This in theory would allow a project to detect when a broadcast is sent, but there is ambiguity on how this would work. Would it return true if the broadcast was run at any point after the green flag was clicked, or only on the instant the broadcast was run, or something else? The workaround is simple: use variables that change when a broadcast is received, then use the “equals” block.

However, the blocks “repeat until broadcast received” and “wait until broadcast received” are NOT rejected. You can discuss them on this topic
[message v] recieved::events boolean
c0der0928
Scratcher
100+ posts

Custom c blocks and hat blocks

you write
while <> {

} :: custom
not
while <> :: custom

end :: custom
flynnremo2
Scratcher
19 posts

Custom c blocks and hat blocks

Another idea for custom c blocks

<blocks are placed in [ blocks1 v] ? :: custom >

this block shows if any scripts inside a custom c block or not
also this has a dropdown of custom c block names. it is probably useful because for some reasons.
MathStudios
Scratcher
40 posts

Custom c blocks and hat blocks

mumu245 wrote:

Example of hat definition:
define hat ::hat
forever
wait until (my condition) // will run when it becomes true
run me ::custom // run the blocks below
wait until <not (my condition)> // wait for it to become false, then true again
end

yeah, but think about when key pressed. it doesn't wait until you stop pressing it

say [you forgot some facts buddy]
flynnremo2
Scratcher
19 posts

Custom c blocks and hat blocks

place with {
} [under v] each blocks while {
} :: custom
this block has a dropdown and it only has 2 options: on and under
the first branch uses blocks to put in each blocks in while branch
the while branch is running scripts

for example:
place with {
wait (1) secs
} [under v] each blocks while {
say [hello]
think [hmmm...]
} :: custom
this script is likely similar to

say [hello]
wait (1) secs
think [hmmm...]
wait (1) secs

Powered by DjangoBB