Discuss Scratch

codingenrich
Scratcher
35 posts

Custom c blocks and hat blocks

Photoguy77 wrote:

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

JavierR100 wrote:

for those can't make the “while <>” block, here is:
while <touching [sprite1 v]?> {
move (10) steps}
Support

Last edited by codingenrich (July 30, 2016 03:35:07)

space_elephant
Scratcher
500+ posts

Custom c blocks and hat blocks

bumpjammy wrote:

test
define hat block when flag clicked :: custom hat 
when flag clicked

Sheep_maker wrote:

For custom C-blocks:
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}
hide
script::custom-arg
show

custom C-block::cstart custom
wait (1) secs
end
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.
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 mean
which 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
for
when<boolean>becomes true::events hat
you 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:
define while <boolean> (block ::stack)
repeat until <not <boolean>>
block ::custom-arg
end

And… hey presto!
while <something ::custom-arg> {
. . .} ::custom

Last edited by Falcon1234567 (Aug. 25, 2016 10:28:28)

Jonathan50
Scratcher
1000+ posts

Custom c blocks and hat blocks

Falcon1234567 wrote:

custom c defines should look like this:
define while <boolean> (block ::stack)
repeat until <not <boolean>>
block ::custom-arg
end

And… hey presto!
while <something ::custom-arg> {
. . .} ::custom
Either that'll not run at all or it'll run forever, because the actual argument
<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

HOWING wrote:

dhdguysg wrote:

-snipped by The4thPixel-
Support? I'm not 100% sure.
Also, you could use this:
...
Instead of the grey block “Code below hat”.
Hello

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

dhdguysg wrote:

HOWING wrote:

dhdguysg wrote:

Hello again!
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 everything
Scratch C block definers+c block examples
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
That was pretty easy right??
Here's the easier way to set behavior the same way i did up there..
define c block while <stuff :: custom-arg> :: custom hat
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
Well that was easy, Now to show you hat blocks, This is also easy
The red flag is a sprite ingame
define hat block When red flag clicked :: custom hat //This code is inside the red flag
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
I hope you will support this! Ask me anything but before you ask look if i answered the question already!
Support? I'm not 100% sure.
Also, you could use this:
...
Instead of the grey block “Code below hat”.
Oh okay,
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

GoldenPickaxe2 wrote:

-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

dhdguysg wrote:

Hello again!
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 etc
code here
Pretty simple? But how exactly do you create them?
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)
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
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!
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!
I tried that, and it didn't work!
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

cs405849 wrote:

dhdguysg wrote:

Hello again!
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 etc
code here
Pretty simple? But how exactly do you create them?
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)
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
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!
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!
I tried that, and it didn't work!
It's not a feature; that was a mockup xD
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)::hat
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
It 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.
define C hat to predicate hat::boolean
C hat{
return<true::operators>::custom-arg cap
}::custom
return<false::operators>::custom-arg cap
EDIT: also the other way:
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

AdrianaMan8 wrote:

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

NitroCipher wrote:

AdrianaMan8 wrote:

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.
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.
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:
repeat (1) seconds {
move (10) steps} :: custom

define repeat (n) seconds (script :: stack)
...
Custom c blocks: support
Custom hats: weak support. Best thing it could do is probably a
when stop sign clicked :: hat :: custom
block.

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:
custom block::custom hat
and the cap is this:
custom block::custom cap
and the c-block input should be like this:
if <> then {} else if <> {} else {}::custom
but 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)

Powered by DjangoBB