Creating a new Category
Create a new folder inside blocks/js
Creating a new block
Inside the blocks array you will be defining the blocks.
Every block needs a function to work
Defining the block
func
: function name of the blocktext
: Text that is shown on the block, using brackets you can make[ARGUMENTS]
,/n
will makes a new line and if you use branches it will be on another branch.shape
: For blocks that won´t return anything, but make functions
- STATEMENT - Not actually required, but keeps code consistent.
- EVENT - floating block with an input inside.Can be replaced with FLOATING, but keeps code consistent.
- TERMINAL - block with no blocks allowed to attach after.
- FLOATING - block that cannot have any parent blocks
- TOPPER - cannot have any blocks attached before it
- CUSTOM - can be used if “manual” is used for the block.
output
: Blocks that return values.
- STRING - returns text
- NUMBER - returns number
- BOOLEAN - returns true/false
- ARRY - returns a list / array
- OBJECT - returns a JSON object.
- ANY - can be put inside any block.
- DISCORD - contains multiple values of discord objects
- SERVER
- CHANNEL
- MESSAGE
- MEMBER
branches
: allows you create multiple branches (even is 1 branch)inline
: true/false if the block should be inline or not default - falsearguments
: if you used any arguments you have to define them here. Mostly you will use type of value with checktype
: defines which block can be put here.- VALUE - allows other blocks
- DUMMY - Can be used for seperating content on a block by a new line.
- SPACE - Similar to DUMMY.Can be used for seperating content on a block.
- IMAGE
- ANGLE - Angle field for directional inputs.
- CHECKBOX - Checkbox field usually for toggles.
- COLOR - Color field.
- MENU - Dropdown menu field with options.
- SERIALIZABLE_LABEL - Label that serializes to the project.
- NUMBER - Number field. Used for restricting to certain numbers.
- TEXT - Text field. Used if blocks shouldnt be used here,but text can still be input here.
- MULTILINE_TEXT - Multi-line text field.Similar to TEXT, but new line characters are allowed.
- VARIABLE - Variable field. Similar to MENU, but the options are all variables.
- DISCORD
- SERVER
- CHANNEL
- MESSAGE
check
: check is used to check if the block that user puts has the same values. Same as shapeoptions
: used for menu. as array of inputs where first value is shown and second is returned in the code.
Advanced block
This block changes a variable to another value.
Warnings
WarningType.
- RequiredParent - adds warning when blocks root block isn’t correct
- EmptyInput - when field is empty
fields to define warnings
- ‘warnings’ - list of warnings
- type: WarningType
- message: string
- inputName: string | string[] - a string or a list of strings that are checked whether they are empty
- parentType: string | string[] - a string or a list of strings that check whether root block is the right type
Example
Mutators
Defining it
*required fields for mutator to work
- *
mutator
- string field for defining mutator id. - *
mutatorData
- *
type
:- checkbox
- *
inputs
: MutatorInput[]- *
text
: string of the field name(use single word for it, this will be removed when inputName field will be added!!!) - *
type
: OutputType or string[] of types - *
defaultValue
: Determines if input on start is shown, boolean(this field will be modified for multiple types or kept for only the checkbox mutator!!!) inputName
: is used to get input value when generating js, if left empty will use *text
field for input name and then its used to get the value.(used when *text
field is with multiple words.)
- *
blockType
: id of a block as base for block when opening the mutator menu.color
: color of the block that is inside the mutator menu
- *