🪛Modding Guide

Modifying the source code & functionality of BFSC has been made easy so users can add on to the compiler & or fit it to their needs. This guide will show you how to start adding custom features.

BFSC v1.2.0 - v1.2.1:

Make sure you have any version of BFSC 1.2.0 to 1.2.1 downloaded & working properly.

💻Creating custom Terminal Commands

Open the "BFSC_commands" folder/directory & there you should find all the base Terminal Commands as files.

Create a new file with any name in the folder, in here you will put all the code that will be executed when the command is run.

Names:

Command names are defined by putting a names data comment in the command file. Example: #!names: helloworld,hw,hulowrld If no names are defined then your Terminal Command will not be available. *names are not available for v1.2.0, the file name is used instead*

Description & Sort order:

Commands can have descriptions which can be defined by putting a description data comment in the command file. Example: #!description: Example. Command descriptions are used in the help message.

Additionally you can define the command’s sort order with #!order: <int>. "<int>" should be replaced with a full value number. The lower the number, the higher the command will show up on the help message. However using a negative number will not work as expected, 0 should be the lowest number used. *sort order is not available for v1.2.0*

Example Commands:

  • BFSC_commands/helloworld.py #!names: helloworld,hw,hulowrld #!order: 0 #!description: Prints "hello world" print('hello world')

🏷️Creating custom Keyword Handlers

Open the "BFSC_kwHandlers" folder, there you should find all of the base keyword handlers as files. (On v1.2.0 keyword handlers were called statement types)

Create a new file in the folder, the name doesnt matter. In this file you will put all the code that will be executed when one of the defined keywords is called.

Define Keywords:

You’ll need to add a data comment named "keywords" & it should contain a list of names. Example: #!keywords: helloworld,hw,hello.

Essential Variables:

  • lenSTP: The amount of parameters used in the statement.

  • STP: Array of parameters used in the statement. Each item is a Dict with 2 key value pairs, "t" (the data type of the parameter) & "v" (the value of the parameter).

  • newLine: A function that adds a new line to the given mcfunction file. Parameter 1 is the mcfunction name to add the text to, param 2 is the text to add.

There are plenty of variables & functions that are very useful however I can’t cover all of them in-depth here, I highly recommend learning & taking from the base statement type files.

Example Keyword Handlers:

  • BFSC_kwHandlers/helloworld.py #!keywords: helloworld,hw,hello print('Hello world')

  • BFSC_kwHandlers/profile.py #!keywords: profile,pf if lenSTP != 3: return f'takes 2 parameters.' name = STP[1] bio = STP[2] if name['t'] != 'str': return f'parameter 1 must be of type String' if bio['t'] != 'str': return f'parameter 2 must be of type String' print(f'Name: {name["v"]}\nBio: {bio["v"]}')

BFSC v1.1.1 & Below:

Modding in any version below 1.2.0 is highly discouraged, the code is not as readable & modular as newer versions which are designed with collaboration in mind.

Last updated