A package for executing mindustry logic (mlog) code
Project description
pymlogic
a package for executing mindustry logic (mlog) code within python
here's a basic example:
from pymlogic import Env, blocks
#a simple mlog example program
code = r"""
Loop:
op add i i 1
print i
print "\n"
jump Loop lessThan i 50
printflush message1
stop
"""
#create a new mlog environment
env = Env()
#create a message block, and add it to the environment
message = blocks.Message()
env.add(message, (1, 0))
#create a processor with the code from before, and a link to the message block from before
proc = blocks.Processor(code, links=[message])
env.add(proc, (0, 0))
while not env.halted:
env.tick() #Env.tick() will execute a single tick for all processors in the environment
env.wait() #Env.wait() waits some time so that the loop runs at 60 tps
#and finally print the contents of the message block
print(message.message)
State of development
Implemented instructions:
readwritedraw- excluding
draw image
- excluding
printformatprintflushdrawflushgetlinkcontrol- only
control enabled
- only
sensor- only
@x,@y,@enabled
- only
setop- excluding
op noise
- excluding
packcolorwaitstopendjumpsetrate
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pymlogic-0.0.1.tar.gz
(8.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pymlogic-0.0.1-py3-none-any.whl
(10.9 kB
view details)
File details
Details for the file pymlogic-0.0.1.tar.gz.
File metadata
- Download URL: pymlogic-0.0.1.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bcc2bc5002655044f719d410f305de6ade3421b6623e8383b6b33206dc20722
|
|
| MD5 |
7c47714d5068bfb8259d055a28b5ca9f
|
|
| BLAKE2b-256 |
ba3f8d426e4d071e1cf23c23d7dc0b70317a8757972c0d30e2aeb3080dc8ba0a
|
File details
Details for the file pymlogic-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pymlogic-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1482c8be9d8f579c55098fb8fa41060c12ed3e36792eaa478bf8091e4d6262b0
|
|
| MD5 |
d18211886d123d2e7106623f67a23507
|
|
| BLAKE2b-256 |
5127185a06d0295d02c5ee3b79b8f4712f1eebf60922d6a1367e2f0b8f9817ba
|