Discuss Scratch
- Discussion Forums
- » Suggestions
- » Custom c blocks and hat blocks
- codingenrich
-
Scratcher
35 posts
Custom c blocks and hat blocks
I definetly support this! It'd make scratch so much nicer to use.Support support support!!!
- JavierR100
-
Scratcher
500+ posts
Custom c blocks and hat blocks
for those can't make the “while <>” block, here is:
while <touching [sprite1 v]?> {
move (10) steps} :: control- LP_Play
-
Scratcher
1000+ posts
Custom c blocks and hat blocks
No support, hats would be impossible to implement and C blocks would be useless.
- codingenrich
-
Scratcher
35 posts
Custom c blocks and hat blocks
for those can't make the “while <>” block, here is:Supportwhile <touching [sprite1 v]?> {
move (10) steps}
Last edited by codingenrich (July 30, 2016 03:35:07)
- space_elephant
-
Scratcher
500+ posts
Custom c blocks and hat blocks
testdefine hat block when flag clicked :: custom hatwhen flag clicked
For custom C-blocks:for
I was thinking, instead of making custom C-blocks a completely different thing, we could add a “scripts” input, which makes a C-block in the custom block.define custom C-block {script}The first script is the definition block. As you can see, the script argument can be used as a regular block and does nothing when used outside of the definition. The second script has the custom loop; the C-block is the script input, and the wait block is the argument. Running that script would hide, wait a second, then show.
hide
script::custom-arg
show
custom C-block::cstart custom
wait (1) secs
end
With this, you can have multiple script inputs.
For custom hats:
Instead of hat blocks, we can have custom booleans and this block:when <>::events hat //or "when <> is true" "if <> then do" etc. but I think you get what I meanwhich acts the same way the workaround does in this project. That way in order to make a custom hat block, all you need is a custom boolean and the ‘when <>’ block:when <custom boolean::custom>::events hat
when<boolean>becomes true::events hatyou can use
when [timer v] > ((timer)-<boolean>)
Last edited by space_elephant (Oct. 6, 2018 05:47:23)
- Falcon1234567
-
Scratcher
20 posts
Custom c blocks and hat blocks
custom c defines should look like this:
And… hey presto!
define while <boolean> (block ::stack)
repeat until <not <boolean>>
block ::custom-arg
end
And… hey presto!
while <something ::custom-arg> {
. . .} ::customLast edited by Falcon1234567 (Aug. 25, 2016 10:28:28)
- Jonathan50
-
Scratcher
1000+ posts
Custom c blocks and hat blocks
custom c defines should look like this:Either that'll not run at all or it'll run forever, because the actual argumentdefine while <boolean> (block ::stack)
repeat until <not <boolean>>
block ::custom-arg
end
And… hey presto!while <something ::custom-arg> {
. . .} ::custom
<something :: custom-arg>is evaluated ONCE and then bound to
<boolean :: custom-arg>, and then the body of the custom block is run.
- The4thPixel
-
Scratcher
1000+ posts
Custom c blocks and hat blocks
Hello-snipped by The4thPixel-Support? I'm not 100% sure.
Also, you could use this:...Instead of the grey block “Code below hat”.

Please don't quote the original post, it oversizes your reply and makes it difficult to read.
- GoldenPickaxe2
-
Scratcher
100+ posts
Custom c blocks and hat blocks
Oh okay,Hello again!Support? I'm not 100% sure.
As you saw my last post about pen blocks maybe, I was getting good support, I hope those blocks will come to life, Anyways, Lets get to the subject
I have been looking threw obsolete blocks, Some dont have workarounds and they are c blocks or something,
Heres an example of a custom c block define and everythingScratch C block definers+c block examplesThat was pretty easy right??define c block while <stuff :: custom-arg> :: custom hat
Scratch Code [repeat until <not <stuff :: custom-arg>>] //Experimental block for custom code. there's an easier way to make c blocks in the next explanation
//So it asks you to insert scratchblocks code that you'd do in a post inside the experimental block saying: scratch code
when gf clicked
while <mouse down?> :: cstart custom
say [HoodelHoe!]
end :: cend custom
Here's the easier way to set behavior the same way i did up there..define c block while <stuff :: custom-arg> :: custom hatWell that was easy, Now to show you hat blocks, This is also easy
repeat until <not <stuff :: custom-arg>> :: cstart control
end :: cend control
when gf clicked
while <mouse down?> :: cstart custom
say [Easier way!]
end :: cend custom
The red flag is a sprite ingamedefine hat block When red flag clicked :: custom hat //This code is inside the red flagI hope you will support this! Ask me anything but before you ask look if i answered the question already!
if <<mouse down?> and <touching [mouse pointer v]?>>
Code below hat :: grey //This is not in the actual code, it will just run anything below if this statement is true..
end
When red flag clicked :: custom hat
say [I'm clicked!] for (2) secs
Also, you could use this:...Instead of the grey block “Code below hat”.
And yes you can be sure to support this thing, We'll need this for alot
- The4thPixel
-
Scratcher
1000+ posts
Custom c blocks and hat blocks
-snip-Hi! Please don't quote other users without adding your own thoughts and opinions to the discussion.
- cs405849
-
Scratcher
11 posts
Custom c blocks and hat blocks
Hello again!I tried that, and it didn't work!
As you saw my last post about pen blocks maybe, I was getting good support, I hope those blocks will come to life, Anyways, Lets get to the subject
I have been looking through a lot of the posts in this thread, Seeing all of the support, I decided to update this post (my english was so bad for it I can't even.)
So here it is!Custom C blocks
(because custom hat blocks would probably be useless)
So C blocks are really useful, but a lot of people hate having to just re-create their conditional (c-block) functions as it makes code messier.
I've decided to create a post for this feature.
I hope ST reads this.
So I've been working out a way that it works.define cblock etcPretty simple? But how exactly do you create them?
code here
Alright, so you create your new custom block, it has a define. and you put code inside the define, But how does it map out how the c-block will work?
Here's an example.define repeat*2 (int32)So if you've seen what I'm going for (It uses c-blocks and other blocks that'd work with conditionals as the conditional) then you might want to go ahead and support!
repeat (int32)
// in here it'd assume ok this is a c block so we'll use this as part of the c block
end
repeat (int32)
// same for here
end
Now, about my other thing (custom hats) This feature isn't as great, but it is basically just a custom event being pulled, So for example if I have a 3 click event on an object, I can create a custom hat for that.
It'd use event combining and I don't know how exactly it would look in scratchblocks, that's beyond the BB plugin's feature.
Thanks for supporting in advance!
- braxbroscratcher
-
Scratcher
1000+ posts
Custom c blocks and hat blocks
No support; Custom C-blocks are almost useless (All loops are possible with the current C blocks), and custom hats would be too confusing for New Scratchers and likely also would not be useful.
- braxbroscratcher
-
Scratcher
1000+ posts
Custom c blocks and hat blocks
It's not a feature; that was a mockup xDHello again!I tried that, and it didn't work!
As you saw my last post about pen blocks maybe, I was getting good support, I hope those blocks will come to life, Anyways, Lets get to the subject
I have been looking through a lot of the posts in this thread, Seeing all of the support, I decided to update this post (my english was so bad for it I can't even.)
So here it is!Custom C blocks
(because custom hat blocks would probably be useless)
So C blocks are really useful, but a lot of people hate having to just re-create their conditional (c-block) functions as it makes code messier.
I've decided to create a post for this feature.
I hope ST reads this.
So I've been working out a way that it works.define cblock etcPretty simple? But how exactly do you create them?
code here
Alright, so you create your new custom block, it has a define. and you put code inside the define, But how does it map out how the c-block will work?
Here's an example.define repeat*2 (int32)So if you've seen what I'm going for (It uses c-blocks and other blocks that'd work with conditionals as the conditional) then you might want to go ahead and support!
repeat (int32)
// in here it'd assume ok this is a c block so we'll use this as part of the c block
end
repeat (int32)
// same for here
end
Now, about my other thing (custom hats) This feature isn't as great, but it is basically just a custom event being pulled, So for example if I have a 3 click event on an object, I can create a custom hat for that.
It'd use event combining and I don't know how exactly it would look in scratchblocks, that's beyond the BB plugin's feature.
Thanks for supporting in advance!
- space_elephant
-
Scratcher
500+ posts
Custom c blocks and hat blocks
Hat blocks could be C blocks run every frame where the C-mouth starts the script.
define when<boolean ?>(script λ::custom stack)::hatIt is easy to convert that to the format scratch uses in other hat blocks, which is a predicate block that starts the script when it is true.
if<boolean::custom-arg>then
script::custom
define while<boolean λ>(script λ::stack)::stack
repeat until<not<boolean::custom-arg>>
script::custom-arg
when<(slider)\>[50]>::custom
while<(slider)\>[50]::operators>{
turn cw(15)degrees
}::custom
define C hat to predicate hat::booleanEDIT: also the other way:
C hat{
return<true::operators>::custom-arg cap
}::custom
return<false::operators>::custom-arg cap
define predicate hat to C hat(script::stack)
if<predicate hat::custom>::control
script::custom-arg
end
Last edited by space_elephant (Oct. 6, 2018 05:52:23)
- AdrianaMan8
-
Scratcher
48 posts
Custom c blocks and hat blocks
define custom hat :: custom hat
define custom cap :: custom cap
Last edited by AdrianaMan8 (Feb. 15, 2017 17:59:28)
- AdrianaMan8
-
Scratcher
48 posts
Custom c blocks and hat blocks
define custom c {script inside}define <custom boolean only> :: custom boolean
define (custom number or text only) :: custom reporter
Last edited by AdrianaMan8 (Feb. 15, 2017 19:30:50)
- NitroCipher
-
Scratcher
500+ posts
Custom c blocks and hat blocks
define custom c {script inside}define <custom boolean only>define (custom number or text only)
Please do not necropost. This topic hasn't been active since January.
Last edited by NitroCipher (Feb. 15, 2017 18:27:27)
- jromagnoli
-
Scratcher
1000+ posts
Custom c blocks and hat blocks
You can't necropost on a suggestions topic, unless it doesn't add anything to the discussion. That being said, that post technically is a necropost.define custom c {script inside}define <custom boolean only>define (custom number or text only)
Please do not necropost. This topic hasn't been active since January.
Anyway, this is a great suggestion, I heard custom booleans and reporters were coming is scratch 3.0, maybe they'll add custom c blocks too!
- ArceusJudgement
-
Scratcher
5 posts
Custom c blocks and hat blocks
I would love to create this block:
Custom hats: weak support. Best thing it could do is probably a
repeat (1) seconds {
move (10) steps} :: custom
define repeat (n) seconds (script :: stack)
...Custom c blocks: supportCustom hats: weak support. Best thing it could do is probably a
when stop sign clicked :: hat :: customblock.
Last edited by ArceusJudgement (July 8, 2017 04:00:10)
- Botcho_Otkho
-
Scratcher
1000+ posts
Custom c blocks and hat blocks
Support. But i think that the c-block isn't a type of block,but an input for the block (like string,number and boolean) and i think there should be the “cap” block.
The event is this:
The event is this:
custom block::custom hatand the cap is this:
custom block::custom capand the c-block input should be like this:
if <> then {} else if <> {} else {}::custombut these are my ideas.custom block::custom hat
if <> then {} else if <> {} else {}::custom
custom block::custom cap
Last edited by Botcho_Otkho (July 18, 2017 11:01:04)
- Discussion Forums
- » Suggestions
-
» Custom c blocks and hat blocks
