The Microcontroller is a semi-advanced programmable component with a persistent 256 bit EEPROM memory.
Warning: This device is largely considered deprecated and might contain bugs. It is recommended to use a Luacontroller instead.
Detailed documentation can be found below:
0
before.after
event happens (see command after
below).:
is a comment."
s. command_name`(`param1`,` param2`,` ...`)`
if(condition) commands [> else_commands];
:
Evaluates the given condition and takes the corresponding branch.
The else branch is optional (as indicated by the [
and ]
). The >
is part
of the syntax and indicates the start of the else branch. The ;
marks the
end of the if command.on(port1, port2, ...)
:
Sets the given ports to 1
.off(port1, port2, ...)
:
Sets the given ports to 0
.print("string" or codition, ...)
:
Evaluates the conditions and prints the concatenation of all params to stdout
(only useful in singleplayer).after(time, "more commands")
:
Executes the commands in the string after the given time in seconds.
There can only be one waiting after
event at once.
Warning: This is not reliable, ie. minetest.after
is used.sbi(port_or_eeprom, condition)
:
Evaluates the condition and sets the port or EEPROM bit to the resulting value.
Note: EEPROM indices don't use #
here, ie. it's sbi(1, #2)
, not sbi(#1, #2)
.0
, 1
: constantA
, ..., D
: value of a port. Takes writes that already happened during the
current execution into account.#1
, ..., #256
: value of an EEPROM bit. Takes writes that already happened
during the current execution into account.!condition
: negation (can only be applied once, ie. not !!1
)condition1 = condition2
: XNOR (equality)condition1 op condition2
where op
is one of:&
: AND|
: OR~
: XOR (inequality)