4. Block Settings
4.1 OPCODE
OPCODE is the unique ID of a block.
Naming conventions:
- Camel-case naming
- Block function should be clearly stated, such as
resetTimer
4.2 Block category
Category | Description | Example |
---|---|---|
Command | ![]() |
|
String | Returns a string | ![]() |
Number | Returns a numeric value | ![]() |
Boolean | ![]() |
|
Events | ![]() |
|
Conditional | ![]() |
|
Button | ![]() |
4.3 Content
Customize the content of the block. Use "@" to add a parameter. Parameters include common ones in Scratch programming, such as string, number, boolean, and others.
Note: an empty space before "@" is a must.
- String
- Number
- Boolean
- Dropdown
- LED panel
- Color
- Angle
- Image
- Custom Widget
- Variable Dropdown
- Variable input dropdown
String
Parameter input | Parameter processing |
---|---|
Any keyboard input strings. A block of number or boolean category can also be added as the parameter. | All input will be processed as string type |
Any keyboard input strings. A block of number or boolean category can also be added as the parameter. | Number type will be processed with priority. Non-number input will be processed as string type. Note: check the box of "Priority number type". |
Number
Parameter input | Parameter processing |
---|---|
String type input only. A block of number or boolean category can also be added as the parameter. | umber type will be processed with priority. Non-number input will be processed as string type. |
Boolean
Parameter input | Parameter processing |
---|---|
Boolean only. | All will be processed as boolean type. |
Dropdown
LED panel
Parameter input |
---|
Set default value via the LED panel. Following is an example of Codey:![]() |
Color
Angle
Image
Image formats:
- File type: SVG
- Size: 12.6 × 12.6
Custom Widget
Parameter input |
---|
Configure in "Custom widgets". |
Variable Dropdown
Parameter input | Parameter processing |
---|---|
Preset variables only. Selection from drop-down list. | Number type will be processed with priority. Non-number input will be processed as string type. Note: check the box of "Priority number type". |
Variable input dropdown
Parameter input | Parameter processing |
---|---|
Choose from drop-down list, or manually input (string & number both supported) | Number type will be processed with priority. Non-number input will be processed as string type. Note: check the box of "Priority number type". |
4.4 Support platform
Select the mBlock 5 platform supported by the block. There are three options: mBlock PC, mBlock Web, and mBlock APP.
4.5 Block configuration
Item | Example | Note |
---|---|---|
☐ Enlarge gap between two blocks | ![]() |
Group blocks under the same category based on function |
☐ This block comes with a checkbox for reading value. | ![]() |
Valid for string or numeric blocks only |
☐ Default transcoding for scripts in combination with this block | Only blocks combined with this block will be transcoded | |
☐ Disable Live Mode | Block not available in Live Mode | |
☐ Disable Upload Mode | Block not available in Upload Mode | |
☐ Hidden blocks | Hide the block from the list | |
☐ For signin only | Block available to signed-in users |