User Tools

Site Tools


python_devnotes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
python_devnotes [2017/02/16 02:51] – added python implementation notes avonpython_devnotes [2017/12/05 13:01] (current) avon
Line 1: Line 1:
 ====== Python Implementation Notes ====== ====== Python Implementation Notes ======
  
-This section documents all notes from WHATSNEW.TXT that relates to the implementation of Python in Mystic BBS. +This section documents notes that relate to the implementation of Python in Mystic BBS. As new functions or additional changes are made, you will see them noted below.
  
 The ability to incorporate Python code with Mystic BBS began with the arrival of Mystic 1.12 Alpha 1 The ability to incorporate Python code with Mystic BBS began with the arrival of Mystic 1.12 Alpha 1
Line 68: Line 68:
      
       mystic -uSysop -ppassword -ytestpython       mystic -uSysop -ppassword -ytestpython
 +      
 +  + Mystic now logs whenever a Python script is executed.
 +  
 +  + New Python function "getuserid(ID)" returns a user dictionary of the user
 +   associated with ID.  If no user is found it will return None:
 +  
 +     import mystic_bbs as bbs;
 +  
 +     user = bbs.getuserid(1)
 +  
 +     if not user is None:
 +       bbs.writeln(user["handle"]);
 +    
 +  + New Python function "getmbase(num)" returns a Message Base dictionary of
 +   the record physically located at (num).  This example will print all of
 +   the message bases out:
 +  
 +     import mystic_bbs as bbs;
 +  
 +     count = 0;
 +  
 +     while not bbs.shutdown():
 +       mbase = bbs.getmbase(count);
 +  
 +       if mbase is None:
 +         break;
 +  
 +       bbs.writeln(mbase["name"]);
 +  
 +       count = count + 1;
 +  
 +     bbs.writeln("List complete. |PA");
 +  
 +  + New Python function "getmbaseid(ID)" returns a Message Base dictionary of
 +   the Message Base with ID of (ID).
 +  
 +  + New Python functions for reading Message Bases:
 +  
 +     msg_open, msg_seek, msg_found, msg_next, msg_prev, msg_gethdr,
 +     msg_gettxt, msg_close
 +  
 +    Rather than try to document them all here there is a "msgread.mpy"
 +    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 'related links' section on this
 +    Wiki page to see an example of this script.
          
  
 +=== Related Links ===
  
 +  * [[python_examples|Mystic BBS Python Examples]] 
python_devnotes.1487235107.txt.gz · Last modified: 2017/02/16 02:51 by avon

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki