I need help on custom blocks (just for fun)

I’m trying to go above and beyond here. I just figured out that I can make custom blocks by editing them when I import them. In doing this, I’m trying to design a switch, but this switch also has outputs branching off the OFF and ON inputs, which should basically look like this:
Switch On Off Triggers
The only problem is that blocks (most likely) are grouped by type, and therefore might not be able to accept more nodes than allowed…
If anyone knows how to do this, can you give me a lesson on how to do so?

People that can probably do this

@grazer @JR01 @TinkerSmith

2 Likes

Okay, so rn I’m trying to look through the source code to see how blocks work…
Wait, you guys stole code from TWITTER?
image

I don’t understand exactly what you are trying to do, but there is a mechanism to create your own custom blocks already - that’s what Bundles are for.

2 Likes

Not so fast!
Bundles have limitations, and have several blocks inside. Custom blocks, however, are only one block and can do virtually anything given the right properties. I just have to spend hours scrolling through the source code to see how it actually works…
I WILL PUSH THE ENVELOPE!!!

thinking

You’re looking at the header for bootstrap.js

I “stole” bootstrap via the insidious method of downloading and using the library as they recommended.

If you want to make a website using bootstrap, you can steal it too right here:

Just don’t tell anyone.

3 Likes

Nice :upside_down_face:
So basically, bootstrap looks like a selection system? (From what I’ve read in the code so far)

No, it’s a very popular CSS framework (from Twitter) - read the site if you’re curious:

1 Like

I think you might end up disappointed with this approach. There is no easy way to create a completely new custom block from imported JSON. The import/export text just tells the engine which existing blocks to use, and how to configure them. All of the actual functionality is actually inside the engine.

2 Likes

Oh, it’s just icons, lol :sweat_smile:

Yes, but if I try to combine a switch with another block (or label it under the functionality/type of that block), then maybe I can cause the other outputs to function properly.

Also, in the Advanced Ease bundle JR_01 was able to import JSON and create properties he wanted.

Ok, @grazer, question:
If I were to try to make this custom switch, which of these approaches would work the best? (or just say none if none of them would work)

Approach 1: Create a custom bundle, then try to convert it to a single block (tried it once, and it was kinda janky)

Approach 2: Try to insert On and Off outputs to a switch

Approach 3: Make a router, and try to insert switch-like values into it

I converted the equations from easings.net into Haxe that can be used in an expression block.

I didn’t import json or modify behaviors, behaviors run by a check for executable code.
So if you do make inputs and outputs, they most likely won’t work.

1 Like

Yup.
I realized after hours of tinkering that what I’m trying is literally impossible unless I develop my own software.

On a side note, I found some old gag when Mhx was playing around with this idea.

5 Likes

That’s good quality stuff :joy:
I made a 6666666666666666666666666666 node router and my screen started rapidly shaking and then it went rainbow and then closed all my tabs :thinking:

Alright how about this:
image
image

I introduce to you…
THE MULTI-EXTRACTOR!

1 Like

On another note, behaviors with adjustable inputs/outputs could be changed.
Behaviors like Routers and Expressions.

image

1 Like

But wouldn’t it top off at 8 outputs?
Wouldn’t the router just… not work?

No, only the input/output that can be updated in the settings itself.

This uses a set value in the import code that can adjust its Routes and its number of outputs.
Adjusting the “routes” value is the key that allows this to work.

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":2,"outputCount":14,"name":"Router","behaviorType":"logic.logic.Router","x":0,"y":928,"group":"e68d1dad4c467c45","id":"e66507b2bb10bf42","loop":true,"routes":14,"mode":0}],"links":[]}}}

Notice “outputCount” and “routes” is both changed to 14

1 Like