Custom blocks with value inputs

To begin, I couldn’t find anything related to this (something I find very surprising) so I decided to create a topic on it myself.

We all know that right now we have custom blocks (I remember they used to be rainbow) in which you place code that you’ll use a lot in that project. This allows you to “create” your own blocks, thus allowing you to more effortlessly code! Great, right?

One problem: what if you have repeating code, but the variables in that code are different?

For example, in, let’s say, a money tapper game, we have different items that we can purchase to increase the amount of cash we make every second. While making the project, you’d have to input the same code in every object that requires it. With custom blocks with value inputs, you simply have to change a few variables and voila!, your work is done. I don’t know if that example made any sense, but hopefully no one’s confused.

I’ve seen this in Scratch, and on Microsoft Excel with functions. I’ve no doubt it’s in other coding languages in one form or another.

Since I can’t photoshop, I don’t have a picture to show everyone of what it would look like, but it’s not hard for me to envision it. However, if someone wants to, they are free to do so.

Personally, I’d use it to simplify my pixel art code even further, as the only difference with each object (each object is a horizontal line of pixels) are a couple of variables.

My paragraphs are probably cattywampus and all in the wrong order or something, but what do people think?

16 Likes

like parameters? there’s a topic like this—cool idea though

7 Likes

Maybe? Like I mentioned, I couldn’t find anything related to this though.

5 Likes

So abilities with parameters
Like in scratch (and pretty much all programming languages with functions)
inhales

YES.

5 Likes

Ah, so they’re called parameters. I had no idea lol.

4 Likes

What I do is, I just give each function 1 or 2 variables (like ‘sort numbers’ gets ‘sn1’ and ‘sn2’ or smth like that)
But that just ends up with like a billion vars

5 Likes

Because of that, I honestly just don’t use custom blocks, unless it’s stuff like making an object 100% visible or invisible, things that literally can’t change because I don’t want them to.

5 Likes

I found that Rawrbear mentions abilities with parameters. They seem to do a better job than I. They call it something completely different, so I had trouble finding it.

Everyone but me probably already knew that.

9 Likes

This idea is great - it would be very useful in Hopscotch!

8 Likes

Based on what I’ve seen in the replies before mine, someone has already made a topic about this. They are called parameters, I believe. Nevertheless, I have came up with a design. Correct me if anything is incorrect.

2 Likes

If I remember right, this is on the roadmap - it should come into hopscotch soon!

2 Likes

yeah

2 Likes

This is possible with awesome es secret blocks btw

1 Like

No it’s not. I only made that to be a label, and there is no actual functionality.

2 Likes