python_devnotes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
python_devnotes [2017/02/16 02:44] – avon | python_devnotes [2017/12/05 13:01] (current) – avon | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Python Implementation Notes ====== | ====== Python Implementation Notes ====== | ||
- | This section documents | + | This section documents notes that relate |
+ | 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 ' | + | |
- | | + | |
- | | + | script. |
- | | + | 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' |
+ | script directory if fallback is enabled. | ||
| | ||
Example: | Example: | ||
Line 26: | Line 28: | ||
if it is not found and fallback is enabled for the current theme, Mystic | if it is not found and fallback is enabled for the current theme, Mystic | ||
will look in the default scripts directory. | will look in the default scripts directory. | ||
- | | ||
- | |||
- | |||
- | + Moved the Python intialization code to only execute the first time a | ||
- | | ||
- | | ||
| | ||
- | If you get a " | + | + 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 " | ||
+ | execute a Python script, its because you have Python on your system but | ||
+ | it is not completely installed. | ||
+ | variables. | ||
+ | |||
+ | SET PYTHONHOME=C: | ||
+ | SET PYTHONPATH=C: | ||
+ | SET PATH=%PYTHONHOME%; | ||
| | ||
- | SET PYTHONHOME=C: | ||
- | SET PYTHONPATH=C: | ||
- | SET PATH=%PYTHONHOME%; | ||
- | |||
- | |||
- | |||
+ Prompts beginning with a # will now execute a Python script similar to | + Prompts beginning with a # will now execute a Python script similar to | ||
- | MPL and display files: | + | |
| | ||
- | | + | @myansi |
- | !mympl | + | |
- | # | + | |
| | ||
- | In the small case that you ever need to start a prompt with one of | + | |
- | | + | these characters, you can prefix it with the " |
- | + | ||
+ | + Added " | ||
+ | testpython.mpy in the default install. | ||
+ | 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. | ||
+ | |||
+ | + Python scripts can now be executed from the command line, just like MPL | ||
+ | scripts. | ||
+ | |||
+ | mystic -uSysop -ppassword -ytestpython | ||
+ | |||
+ | + Mystic now logs whenever a Python script is executed. | ||
+ | |||
+ | + New Python function " | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | user = bbs.getuserid(1) | ||
+ | |||
+ | if not user is None: | ||
+ | | ||
+ | |||
+ | + New Python function " | ||
+ | the record physically located at (num). | ||
+ | the message bases out: | ||
+ | |||
+ | | ||
+ | |||
+ | count = 0; | ||
+ | |||
+ | while not bbs.shutdown(): | ||
+ | mbase = bbs.getmbase(count); | ||
+ | |||
+ | if mbase is None: | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | count = count + 1; | ||
+ | |||
+ | | ||
+ | |||
+ | + New Python function " | ||
+ | the Message Base with ID of (ID). | ||
+ | |||
+ | + New Python functions for reading Message Bases: | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | Rather than try to document them all here there is a " | ||
+ | in the default Mystic installation as an example of how to use these | ||
+ | functions. This example implements a very basic message reader using the | ||
+ | user's current message base. Check out the ' | ||
+ | Wiki page to see an example of this script. | ||
+ | |||
+ | |||
+ | === Related Links === | ||
+ | * [[python_examples|Mystic BBS Python Examples]] |
python_devnotes.1487234650.txt.gz · Last modified: by avon