Skip to main content

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:

  • read
  • write
  • draw
    • excluding draw image
  • print
  • format
  • printflush
  • drawflush
  • getlink
  • control
    • only control enabled
  • sensor
    • only @x, @y, @enabled
  • set
  • op
    • excluding op noise
  • packcolor
  • wait
  • stop
  • end
  • jump
  • setrate

Project details


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.2.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymlogic-0.0.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file pymlogic-0.0.2.tar.gz.

File metadata

  • Download URL: pymlogic-0.0.2.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

Hashes for pymlogic-0.0.2.tar.gz
Algorithm Hash digest
SHA256 82e62de023e8ad9f2befa4b89c7774bcfcdf198e12ee16f9414331dde38cc426
MD5 a3452772408b8b2dff0896de92ff8b11
BLAKE2b-256 2ae07a49c4f368cb0e3d921ec179edaf49a56d13c87c9c09125a2ee1d09bf9ee

See more details on using hashes here.

File details

Details for the file pymlogic-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pymlogic-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pymlogic-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e32b049727d15e6f989d840c3ca640ccd4af389be2fe2866e6b202f4ffaa83da
MD5 af71322482bfff798e7e1bafec134d56
BLAKE2b-256 f73db1cb0b664c2bbfb4a427e1887791bef5392bcf6818b69c2841839200817b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page