User Tools

Site Tools


Python Implementation Notes

This section documents notes that relate to the implementation of Python in Mystic BBS.

The ability to incorporate Python code with Mystic BBS began with the arrival of Mystic 1.12 Alpha 1

+ PYTHON is here!  New menu command 'GY' will execute a Python 2.7 syntax
  script.  By default Mystic looks in the script directory for .MPY files,
  using the same logic as MPX.  If you supply a file with no extention,
  Mystic will add .mpy onto it.  If you do not supply a path, then Mystic
  will look in the current theme's script directory, and then the default
  script directory if fallback is enabled.


       Command: GY
          Data: testpython

    The above executes testpython.mpy from the Scripts directory


       Command: GY
          Data: c:\mystic\derp\herpderp

    The above executes herderp.mpy from the c:\mystic\derp directory, or
    if it is not found and fallback is enabled for the current theme, Mystic
    will look in the default scripts directory.

+ Moved the Python intialization code to only execute the first time a
  script is ran, so that if Python is incorrectly installed it will not
  prevent Mystic from loading with an error.

  If you get a "Import error: no module named site" when you DO try to
  execute a Python script, its because you have Python on your system but
  it is not completely installed.  You'll need to set your environment
  variables.  For example if you have Python installed in C:\Python27:


+ Prompts beginning with a # will now execute a Python script similar to
  MPL and display files:

     @myansi     <- Shows myansi from your theme's text dir
     !mympl      <- Execute mympl.mpx from theme's script dir
     #mypython   <- Execute mypython.mpy from theme's script dir

  In the small case that you ever need to start a prompt with one of
  these characters, you can prefix it with the "dummy" MCI code <pipe>XX

+ Added "getuser" and "onekey" functions into Python and updated the
  testpython.mpy in the default install.  This will continue to be updated
  as new functions and features are added and I need to test them.
+ Added a keypressed function to Python engine   
+ Mystic now prints a message if Python is executed when it is not detected
  on the system.

+ Mystic now prints a message if Python fails to initialize when executing

+ Python scripts can now be executed from the command line, just like MPL
  scripts.  The format is the same except -Y is used, so for example:

    mystic -uSysop -ppassword -ytestpython
python_devnotes.txt · Last modified: 2017/02/16 03:52 by avon