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.3.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.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

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

Hashes for pymlogic-0.0.3.tar.gz
Algorithm Hash digest
SHA256 25076693e622fb8800510b21ea594f56eae911a8806ca966786b6170bb6ef416
MD5 cc3eb0a668b9f59fba5445f99cae9d56
BLAKE2b-256 b70cd85b9920bbeaf1edd57677906c2ad6c65cfb726da2c6572b93f391139496

See more details on using hashes here.

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

Hashes for pymlogic-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 abbf2289b1f6c7327e9966b9acfbe9d534cd1c002a3a9867c9f3419b2634a577
MD5 5b355b0dd4051681aa579eb34d9847e3
BLAKE2b-256 e9c221edfe214e174f8e13d30a6de7d665ea842ff09c2b7a9c562b67c243bc31

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