Discuss Scratch

dhdguysg
Scratcher
100+ posts

Custom c blocks and hat blocks

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!

Last edited by dhdguysg (May 6, 2016 16:59:10)

HOWING
Scratcher
500+ 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 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”.

Check out my most popular game! Check out my cool apple catcher! Check out my awesome Bullet Bill Dodge!
dhdguysg
Scratcher
100+ posts

Custom c blocks and hat blocks

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

Custom c blocks and hat blocks

I definetly support this! It'd make scratch so much nicer to use.

-Photoguy77

“Without enjoying, one will never truly learn” ~Flome

“Finding happiness starts in you” ~ProdigyZeta7

HOWING
Scratcher
500+ posts

Custom c blocks and hat blocks

What block will we use to run the c-block when the condition is true?

Check out my most popular game! Check out my cool apple catcher! Check out my awesome Bullet Bill Dodge!
dhdguysg
Scratcher
100+ posts

Custom c blocks and hat blocks

HOWING wrote:

What block will we use to run the c-block when the condition is true?
You'll use the block you created, But i dont quite understand, Please tell me if this is correct
Okay so you have your definer
define c block Ex (stuff)
repeat until <not <stuff :: custom-arg>>
... :: grey
end

//And your stuff
when green flag clicked
Ex (mouse down?) :: cstart custom
... :: grey //So you'd use the block you created to run if the condition is true, If it wouldnt be true it'd skip the block
end :: cend custom
Cyoce
Scratcher
500+ posts

Custom c blocks and hat blocks

Support. Here's how the custom c-blocks could be created:
Just like the “add ___ input” under options, you could have an “add stack” option.
For example, for making a “while” block:
while ([condition] :: custom-arg) {[stack1] :: custom-arg} :: custom-arg
//would become
while () :: custom-arg cstart
end
//the definition:
repeat until <not<condition :: custom-arg>>
stack1 :: custom-arg
end
Similarly, you could have “add else”. This would add an else loop.
Couldn’t represent that properly because the “define” formatting is finicky.

dhdguysg
Scratcher
100+ posts

Custom c blocks and hat blocks

Cyoce wrote:

Support. Here's how the custom c-blocks could be created:
Just like the “add ___ input” under options, you could have an “add stack” option.
For example, for making a “while” block:
while ([condition] :: custom-arg) {[stack1] :: custom-arg} :: custom-arg
//would become
while () :: custom-arg cstart
end
//the definition:
repeat until <not<condition :: custom-arg>>
stack1 :: custom-arg
end
Similarly, you could have “add else”. This would add an else loop.
Couldn’t represent that properly because the “define” formatting is finicky.

True..
I have been making a concept for a while Of how scratch should do it, check it out:
RPFluffy
Scratcher
1000+ posts

Custom c blocks and hat blocks

Nice suggestions!
Support!

Nothing Is EVER 100%, that is just an assumption.















Some important links: Here and here or need help click Here. Eats followers, Loves helping people.
My “..” and “…” are not spelling mistakes, it means that they are ways of telling someone that I can continue more about it and that the sentence isn't ended the best way. I like putting new indents and lines so I can split up what I am talking about.




































Some important links: Here and here or need help click Here. Eats followers, Loves helping people. Check this MMO out! Kiwi = Support WHAT THAT'S IMPOSSIBLE: Through the drop down ;)
if <> :: control cstart

else :: control
end
TehCow
Scratcher
50 posts

Custom c blocks and hat blocks

Umm… Code Blocks? What kind of code would we be dealing with? I hope the ST doesn't have to Invent a whole new language for this



When a first you don't succeed, tr- WHAT!?! Griffpatch shared a new project?!?! *Views project* Man, I'll never be that good.
Epicness123
Scratcher
1000+ posts

Custom c blocks and hat blocks

Semi-support

Sadly, my kumquats were eaten by an evil forum signature.
dhdguysg
Scratcher
100+ posts

Custom c blocks and hat blocks

TehCow wrote:

Umm… Code Blocks? What kind of code would we be dealing with? I hope the ST doesn't have to Invent a whole new language for this
Oh, Code blocks are just inserting scratch block code, for example the code you put in scratchblocks tags, It's just a way for some things, I just did that for fun
dhdguysg
Scratcher
100+ posts

Custom c blocks and hat blocks

TehCow wrote:

Umm… Code Blocks? What kind of code would we be dealing with? I hope the ST doesn't have to Invent a whole new language for this
Nice idea for scratchstarter, I'm gonna create one for RoScratch, since the project is gonna take lots of support
cwrivera99
Scratcher
500+ posts

Custom c blocks and hat blocks

I support the c-loops thing, but there is a workaround for the hat blocks-
when gf clicked
forever
wait until <>
...
end

when this block is clicked::sensing hat//FYI, this is my old account that I no longer use. My current account is @DaSpudLord.
forever {do (a [scratch v]::events ring)::sound}::extension cstart
say [what the...?] in (the language of [the moon people v]::red)::control
create [spontaneous v] explosion in [a flea's stomach]::motion
That's not right...::cend
If you are reading this… Then congratulations! You have found the part of my signature that was eaten by a kumquat! (On a side note, you are probably in a kumquat's stomach.) Now get out of the kumquat's stomach and go do something productive with your life. Like playing this game over and over again. Very productive.
dhdguysg
Scratcher
100+ posts

Custom c blocks and hat blocks

cwrivera99 wrote:

I support the c-loops thing, but there is a workaround for the hat blocks-
when gf clicked
forever
wait until <>
...
end
Um, we still need this feature because your when gf clicked code gets messy instead of just adding custom blocks which is kinda cleaner.
dhdguysg
Scratcher
100+ posts

Custom c blocks and hat blocks

Cyoce wrote:

Support. Here's how the custom c-blocks could be created:
Just like the “add ___ input” under options, you could have an “add stack” option.
For example, for making a “while” block:
while ([condition] :: custom-arg) {[stack1] :: custom-arg} :: custom-arg
//would become
while () :: custom-arg cstart
end
//the definition:
repeat until <not<condition :: custom-arg>>
stack1 :: custom-arg
end
Similarly, you could have “add else”. This would add an else loop.
Couldn’t represent that properly because the “define” formatting is finicky.

Well i could add c with else
you dont need to add a define for that, It'll just invert your function

while (mouse down?) :: custom cstart
...
else :: custom
...
end :: custom cned
stickfiregames
Scratcher
1000+ posts

Custom c blocks and hat blocks

Support for custom c-blocks. Not sure about hats, because hats respond to events and all events already have a hat associated with them.










If you can read this, my signature cubeupload has been eaten by an evil kumquat!




or you just used Inspect Element, you hacker

;
ilikelegos
Scratcher
100+ posts

Custom c blocks and hat blocks

Hmm, might work. Maybe 99% percent support. I think this needs a few things worked out first.

Hi! I'm a computer science student who learned coding on Scratch!
Cream_E_Cookie
Scratcher
1000+ posts

Custom c blocks and hat blocks

support

















Powered by DjangoBB