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.3.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.3-py3-none-any.whl
(11.1 kB
view details)
File details
Details for the file pymlogic-0.0.3.tar.gz.
File metadata
- Download URL: pymlogic-0.0.3.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 |
25076693e622fb8800510b21ea594f56eae911a8806ca966786b6170bb6ef416
|
|
| MD5 |
cc3eb0a668b9f59fba5445f99cae9d56
|
|
| BLAKE2b-256 |
b70cd85b9920bbeaf1edd57677906c2ad6c65cfb726da2c6572b93f391139496
|
File details
Details for the file pymlogic-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pymlogic-0.0.3-py3-none-any.whl
- Upload date:
- Size: 11.1 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 |
abbf2289b1f6c7327e9966b9acfbe9d534cd1c002a3a9867c9f3419b2634a577
|
|
| MD5 |
5b355b0dd4051681aa579eb34d9847e3
|
|
| BLAKE2b-256 |
e9c221edfe214e174f8e13d30a6de7d665ea842ff09c2b7a9c562b67c243bc31
|