Blok | Visual scripting plugin devlog 1 (On hold)

Hello gamers, this is the first devlog for blok a new visual scripting plugin for Roblox. You might be thinking:

“But there are loads of those(may have missed some)

Well you’re right. Here are a few reason why I’m still making it and why you should use it (there a bit mixed-up):

  • I like writing code so why not make something?
  • This project will be fully open-source on Github & free forever.
  • Built with things I want to learn or grow in.

I started off creating a new Rojo project (bare in mind I’m quite new to Rojo and all the other formatting, linting, autocompleting and package managing tools). Then I got into thinking what things I needed to make it. In the end I chose Fusion and Janitor (I probs will need more later).

The start of the “Backend”


First I started with writing the blocks file. It holds all the info for the blocks and it also has a thing called type which follows the Scratch docs (reporter, c, hat, stack, cap and boolean are the types a block can have).
Then I started writing the code generator. This is the bit that parses the BlockTree (as I’m calling it). Btw this is what a BlockTree looks like:

BlockTree
{
	{
		type = "onstart",
		inputs = {
			{
				type = "print",
				inputs = {
					{
						type = "join",
						inputs = {
							{
								type = "string",
								inputs = {
									"Hello, ",
								},
							},
							{
								type = "string",
								inputs = {
									"world!",
								},
							},
						},
					},
				},
			},
			{
				type = "ifthen",
				inputs = {
					{
						type = "equal",
						inputs = {
							{
								type = "string",
								inputs = {
									"abc",
								},
							},
							{
								type = "string",
								inputs = {
									"def",
								},
							},
						},
					},
					{
						type = "print",
						inputs = {
							{
								type = "string",
								inputs = {
									"What!?",
								},
							},
						},
					},
				},
			},
		},
	},
}

What the code generator should do is turn the above BlockTree into these few lines:

-- @generated by blok. This is not intended for manual editing.

local function start()
	print('Hello, ' .. 'world!')
	if ('abc' == 'def') then
	print('What!?')
end
end

start()

:uhh: that’s not formatted right …
15 minutes later

 -- @generated by blok. This is not intended for manual editing.

local function start()
	print('Hello, ' .. 'world!')
	if ('abc' == 'def') then
		print('What!?')
	end
end

start()

Better :+1:.

Here is a list of things that still need to be done:

  • Clean up the Blocks file; add categories.
  • Write the BlockTree generator.
  • Upload to Github and add a TODO project for it.
  • Frontend :uhh:.

Anyway, if you have any ideas or think I could be doing something differently let me know below.

Thanks for reading,
Almost89

3 Likes

Hi!

This seems cool. Does the code generator works now or what you showed is just a plan?
Also I suggest working on the frontend first, because it’s hard. Of course it’s your decision.

Good luck and have a great day!

1 Like

Hello, in answer to your question the code generator is implemented. Thanks for the kind words this will probably take a lot of inspiration from your plugin so thanks for the contribution to the community!

1 Like

Are you going to implement classes (based on each block type, having also parameters when used) in the backend code? @ me in the next devlog!

2 Likes

Do you mean OOP classes (if not I’d love if you could explain to me what you meant)? If so I started the project with them and then after awhile I decided to remove them. Anyway, it’s nice to hear your interested and I’ll be sure to @ you in the next one!

Yeah, I meant OOP. Every block should have a specific module that handles them, and when the backend code is ran, a loop should “loop” through all the blocks in order and activate their function.

For example:

Action block

  • Sets the position/orientation of something

  • Creates an Instance

Event block

  • Listens for an event parameter and an Instance parameter (the one that has the Roblox event)

Looks block

  • Handles UI elements

I recommend reading this article for more ideas.

1 Like