A compiler from simple code to mindustry code
This project is still in development and far from finished. So if you really need all the functionallity of mindustry this won't cut it yet.
The file extension of code files should be '.mdsc' (short for mindustry code)
Each line should end with a ; (Comming in languages as Java, JS, CSS, C, C# and the list goes on)
from // and further the line is a comment so everything after // to the end of the line is ignored
At the top of your script define all the blocks for easy acces and changing in the future:
%DEFINE msg_block = message1;
%DEFINE memory = cell1;
%DEFINE core = nucleus1;
Variable setting is very straight forward.
var = 1;
one_plus_two = 1 + 2;
!! Warning. Please don't use variables starting with mdsc_
those are reserved for the compiler.
Printing is a function of the "class" msg_block.
msg_block.print("print_value");
// prints (and flushes) the value to message1
Writing and reading is also a function of a memory "class".
memory.write(100, 0); // write the value 100 to location 0
memory.read(0); // read the value at position 0
You can get information of any block as if it is a variable of the class.
amount_of_copper_in_nucleus = core.copper;
nucleus_item_cap = core.itemCapacity;
Comming soon
Comming soon
If you for some reason especially need to write in standard mindustry code you can by calling the exec
function.
exec("set x 10"); // will set the variable x to the value 10
If I have enough motivation this will be the order in which I will add functionality. If I don't have enough motivation this project will prob come to a halt, before the all the items have been added.
- Add all mindustry functionality
- Read
- Write
- Draw
- Draw Flush
- Print Flush
- Get Link
- Control
- Rader
- Sensor
- Set
- Operation
- End
- Jump
- Unit Bind
- Unit Control
- Unit Radar
- Unit Locate
- if statements
- Add custom function defining
- Different data types
- List
- dict/ hashmap